A-13
Appendices
CJ-series PROFIBUS Master Unit Operation Manual for NJ-series CPU Unit (W509)
A-4 Application Program
App
A-4 Application Program
The ladder program, as shown in the figure below, will regularly set switch number 15 in the Software
Switches word (*_SwCmd, where n in the example is 1500), and start a counter. The counter will count
the amount of CPU I/O refresh cycles, before the Master Unit resets the switch. If the counter reaches
the maximum value (e.g. 40 as in the example ladder program), without the switch being reset, a CPU
error will be generated.
The counter must be configured by the user, and depends on the PROFIBUS cycle. The longer that
cycle is, the longer the counter has to count up. It is recommended to include a safety margin to avoid
the CPU error being generated too soon. An estimate for the value can be made using the formula
below.
2*
T
TR
Timer value = Max ( 40, ----------------------- )
min. CPU Cycle
(T
TR
= Target Rotation Time)
In the ladder program shown as example below, the minimum value of 40 has been used. The unit
number for the example Unit is 0.