Spectrum Controls 1746sc-NI8u User Manual
Page 71

Chapter 5: Ladder Program Examples
59
This is an example of how to automatically switch between reading the
channel status words and channel data words. Specifically, this
example shows a very simple method of utilizing a timer to periodically
switch between reading the channel status and data words.
The program utilizes a timer accumulator value to determine when to
set up the configuration words, and when to read in the channel status
and channel data information. The channel status information is copied
from the I:2.0 to I:2.7 registers into registers N7:10 to N7:17. The
channel data information is copied from I:2.0 to I:2.7 into registers N7:0
to N7:7. This allows sensor data and channel status information to be
accessed at any time from these registers. However, when the module
channels are configured to read sensor data, the channel status words
(as reflected in N7:10 to N7:17) are not being dynamically updated, and
vice-versa.
A longer interval between reading in the channel status information
could be achieved through the utilization of a combination of counters
and timers. If you are utilizing an SLC 5/03 or SLC 5/04 or later
processor, the internal processor clock registers S:40 to S:42 could be
utilized to determine the timing.
Rung 2:0
TON
TIMER ON DELAY
Timer
T4:0
Timer Base 0.01
Preset 1001
Accum
0
(EN)
(DN)
Timer T4:0 counts out a 10 second interval. Its accumulator indicates
the progress it has made toward completion. The accumulator value
shall be utilized to determine when to set the channel configuration
word to send sensor data or to send status information.
A longer interval between transitions can be achieved using a
combination of timers and counters.