Programming instructions

100
TZCP – Time Zone Compare
The TZCP time compare instruction will compare the hours, minutes, and
seconds as set in the parameters to 2 sets of 3 consecutive registers which hold
the upper and lower limits of the real time clock data to compare.
HTOS – Hours to Seconds (16-Bit)
DHTOS – Hours to Seconds (32-Bit)
These two commands will convert a time value in hours, minutes, and seconds
into a number of seconds and back. The HTOS instruction uses 3 consecutive
registers holding hours, minutes, and seconds and creates a 16-bit output of a
number of seconds. To use 32-bit result, use the DHTOS command.
STOH – Seconds to Hours (16-Bit)
DSTOH – Seconds to Hours (32-Bit)
These two commands will convert a number of seconds into a time value in
hours, minutes, and seconds. The STOH instruction uses a 16-bit input of a
number of seconds to create 3 consecutive registers holding hours, minutes, and
seconds. To use 32-bit seconds source, use the DSTOH command.
TADD – Time Add
TSUB – Time Subtract
The TADD and TSUB commands are used to add or subtract time data. The
data is provided as 3 consecutive source registers for both input devices and a
set of 3 registers are used for the resulting data. These registers are in hours,
minutes, seconds order as with the other time commands.
14.5 EXERCISE Daylight Savings Time
The PLC does not have built in option to control Daylight Savings Time. PLC
code must be written to control the PLC clock for DST. The U.S. standard for
Daylight Savings Time is shown below.
First Sunday in April at 2AM, set clock ahead one hour
Last Sunday in October at 2AM, set clock back one hour.
Write the PLC code to set the clock ahead in the spring and back in the fall.
Be careful in the fall, we only want to set the clock back once!