Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Color has a deprecated constructor in /homepages/23/d548214462/htdocs/clickandbuilds/Joomla/MyCMS/templates/rt_chapelco/features/color.php on line 11
myCNC - advanced CNC control, software - PLC programming - PLC (Programmable logic control)

Frequently Asked Questions - PLC (Programmable logic control)

FAQs - PLC (Programmable logic control)

FAQ for PLC programming.

1) THC Voltage reference register is mapped to CNC variables array address "0xA3" and Global variables array address "7229".

For example, M-code "M190 P1500" will value "1500" to THC Voltage reference register.
Source code for M190.plc (version 1)

#include src/common.const.h
#define variable          var00
#define parameter         var01
variable=0xa3; //Set Voltage reference
parameter=eparam; //Voltage ref value
message=PLCCMD_SET_CNC_VAR;
texit=timer+2;do{timer++;}while(timer<texit);
exit(99);

 

 

 

 

 

 

Source code for M190.plc (version 2)

#include src/common.const.h
gvarset(7229,eparam);
exit(99);

 

 

 

 

2) Parameters "Piece time", "Ignition height" and "Cutting height" are used in Cutting-ON procedure (M03, M21, M71, C07 - depends on postprocessor and profile configuration). It's possible to store values of this variables in PLC variables array in one PLC-procedure and use it later from another PLC-procedure.

PLC Variables array is array of 32 long int values (int32_t plc_variables[32]) which is mapped to Global varoables to addresses 7230...7361

For example running "M191 P1450" will set value of "1450" to PLC-variables register #0.
Cutting-ON procedure uses ths register as "Pierce time"

Source code for M191.plc

#include src/common.const.h
gvarset(7230,eparam);
exit(99);

 

 

 

 

Source code for M71.plc (part)

#include src/common.const.h
#include src/pins.h

#define variable          var00
#define parameter         var01

#define pierce_time       var09
....................
pierce_time=gvarget(7230);

....................