#define command var00 #define parameter var01 //set Spindle speed control via ET10 DAC channel #1 //Spindle Speed is given in **eparam** register main() { command=0x32; //EXT_ET10_DAC_OFFSET; set ADC offset register address parameter=0x800-(eparam/2)+(1<<12); //0x800 - is the middle of 12bits range - represents 0V //Eparam contains 12bits DAC value in 10V range, //ET10 DAC setup in +10V...-10V range, so need half range (/2) //Encoder channel number is given in high 12 bits of 16bit word - //Channel #1 is (1<<12). message=PLCCMD_SET_CNC_EXTVAR; //setup Message register with command for access to [[External CNC Variables]] texit=timer+2;do{timer++;}while(timer0); //Delay to push the Message to myCNC Software //A way to inform myCNC software about new Spindle Speed (to display on it DRO for example) exit(99); //normal exit. };