Ladder
Diagram
to
call
subroutine
Program Description
Main program comprises of simple Master Coil rung, rung for timer and rung to call subroutine.
When Start PB I:1/0 is pressed, Master coil energizes and the TON timer T4:0 is enabled.
After 10 seconds when PRESET=ACCUMULATOR, T4:0/DN bit goes high calling subroutine.
Subroutine has a program that adds two data from addresses N7:0 and N7:1 which are outputs from
Temperature transmitters. These outputs are added and output of addition is converted into BCD and sent to
address O:6 which is connected to Display.
Output data are in Hexadecimal and Displays accept BCD inputs. So TOD instruction is used here to
convert data of temperature addition to BCD.
T4:0/DN is also used as an XIO input to Timer itself, hence it automatically resets to 0 whenever preset and
accumulator values are equal or in other words, it updates the display every 10secs resetting timer.
Dostları ilə paylaş: