#define command var00 #define parameter var01 //set Spindle speed control via DAC channel #1 //Spindle Speed is given in **eparam** register main() { value=eparam; if (value>0xFFF) {value=0xFFF;}; //fix if given value is out of range 0...0xfff if (value<0) {value=0;}; dac01=value; //setup DAC value //**Set Spindle Speed** is asynchronous operation. //It's better to inform myCNC Software New Spindle Speed applied. //Send information about new Spindle Speed to myCNC Software message=PLCCMD_REPLY_TO_MYCNC; //Command code to send to myCNC software command=PLC_MESSAGE_SPINDLE_SPEED_CHANGED; //Message code parameter=eparam; //New Spindle Speed information timeout=timer+10; do { timer++; } while (timer