===== Low-Frequency Pulse Generator =====
There are 4 low-frequency pulse timers in the system
==== Software PLC control ====
^ Address ^ Variable Name ^ Description ^
| 0x10000AB | EXT_MYTIMER_SET | Set up, enable/disable pulse generator |
| 0x10000AC | EXT_MYTIMER_SET_PULSE | Set pulse time (in milliseconds) |
| 0x10000AD | EXT_MYTIMER_SET_PAUSE | Set pause time (in milliseconds) |
=== Pulse generator set up ===
Writing to the Software PLC register number 0x10000AB is used to set up Pulse generator.
* Byte 0 of written value is the OUT port number for the pulse generator
* Byte 2 - set the current state of the pulse generator. Bit #1 is to enable/disable the generator.
* 0 - timer **DISABLED**
* 2 - timer **ENABLED**
* Byte 3 - timer number.
Software PLC example: set up and turn the generator ON
#define port_num 8
#define t_pulse 200
#define t_pause 800
main()
{
gvarset(0x10000ac,t_pulse);
gvarset(0x10000ad,t_pause);
x=port_num|(2<<16);
gvarset(0x10000ab,x);
exit(99);
};
Software PLC example: set up and turn the generator OFF
#define port_num 8
main()
{
gvarset(0x10000ab,port_num);
exit(99);
};
==== Hardware PLC control ====
^ Address ^ Variable Name ^ Description ^
| 8100 | GVAR_TIMER0_ENABLED | 0 - DISABLE; 1- ENABLE |
| 8101 | GVAR_TIMER0_PORT | Set Output pin number for timer/generator 0 |
| 8102 | GVAR_TIMER0_PULSE | Set pulse time in milliseconds for timer/generator 0 |
| 8103 | GVAR_TIMER0_PAUSE | Set pause time in milliseconds for timer/generator 0 |
^ ^ ^ ^
| 8104 | GVAR_TIMER1_ENABLED | 0 - DISABLE; 1- ENABLE |
| 8105 | GVAR_TIMER1_PORT | Set Output pin number for timer/generator 1 |
| 8106 | GVAR_TIMER1_PULSE | Set pulse time in milliseconds for timer/generator 1 |
| 8107 | GVAR_TIMER1_PAUSE | Set pause time in milliseconds for timer/generator 1 |
^ ^ ^ ^
| 8108 | GVAR_TIMER2_ENABLED | 0 - DISABLE; 1- ENABLE |
| 8109 | GVAR_TIMER2_PORT | Set Output pin number for timer/generator 2 |
| 8110 | GVAR_TIMER2_PULSE | Set pulse time in milliseconds for timer/generator 2 |
| 8111 | GVAR_TIMER2_PAUSE | Set pause time in milliseconds for timer/generator 2 |
^ ^ ^ ^
| 8112 | GVAR_TIMER3_ENABLED | 0 - DISABLE; 1- ENABLE |
| 8113 | GVAR_TIMER3_PORT | Set Output pin number for timer/generator 3 |
| 8114 | GVAR_TIMER3_PULSE | Set pulse time in milliseconds for timer/generator 3 |
| 8115 | GVAR_TIMER3_PAUSE | Set pause time in milliseconds for timer/generator 3 |
Hardware PLC example: set up and turn the generator ON
#define port_num 8
#define t_pulse 200
#define t_pause 800
main()
{
gvarset(8100,1);
gvarset(8101,port_num);
gvarset(8102,t_pulse);
gvarset(8103,t_pause);
exit(99);
};
Hardware PLC example: set up and turn the generator OFF
main()
{
gvarset(8100,0);
exit(99);
};