User Tools

Site Tools


plc:m07_mist_coolant_on

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revisionBoth sides next revision
plc:m07_mist_coolant_on [2017/07/13 23:53] – created skirillovplc:m07_mist_coolant_on [2017/07/13 23:54] skirillov
Line 37: Line 37:
  
  
- 
- 
-  
- 
-=== Spindle Speed control for ET10_DAC === 
-<code c SPN.plc> 
-#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 0V range, ET10 DAC setup in +10V...-10V range, so need to /2 
-  //Encoder channel number is given in high 12 bits of 16bit word. 
- 
-  message=PLCCMD_SET_CNC_EXTVAR;     
-  //setup Message register with command for access to [[External CNC Variables]] 
-  texit=timer+2;do{timer++;}while(timer<texit); 
-  //2ms delay to push the command from PLC to myCNC Core 
- 
- 
-  //**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<timeout); //Delay to push the Message to myCNC Software 
- 
-  gvarset(7371,eparam);            
-  //myCNC register #7371 contains actual Spindle Speed.  
-  //Another way to inform myCNC software about new Spindle Speed (to display on it DRO for example) 
- 
- 
-exit(99);  //normal exit. 
-}; 
-</code> 
plc/m07_mist_coolant_on.txt · Last modified: 2017/10/02 15:38 by skirillov

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki