#include vars.h //set the Spindle Speed through DAC main() { val=eparam; dac01=val; //send the value to the DAC register //Change the Spindle State gvarset(7371,eparam); timer=30;do{timer--;}while (timer>0); //30ms delay s=gvarget(7370); if (s!=0) //if spindle should be ON { k=671223; freq=val*k; //calculate the RAW frequency using the multiplier if (freq>515499348) {freq=515499348;}; gvarset(8130,freq); timer=30;do{timer--;}while(timer>0); //30ms delay }; exit(99);//normal exit };