Programming instructions

88
13.4 EXERCISE Parking Lot
Write a program for the following parking lot control application:
X10 indicates a car coming in
X11 indicates a car going out
Y0 is a sign which turns on to indicate the lot is full
C200 (bi-directional 32-bit counter) will keep track of the number of cars in lot
D0 will store the maximum number of cars (for this exercise write 10 to D0)
When a car comes in, count that car. When a car goes out, reduce the current
count by 1. When the lot is full we need to turn on the Lot Full sign.
13.5 EXERCISE Conveyor Control Part 2
Rewrite the Conveyor Control program, using ONLY ONE timer and using
compare statements to control the outputs.
13.6 Conversion Instructions
The conversion instructions are placed at the end of the rung. Commands are
available to convert data to and from many numerical formats and ASCII strings.
The ones which will be covered in this class convert integer numbers to floating
point numbers and back.
FLT – Integer to Floating Point
DFLT – 32-Bit Integer to Floating Point
The FLT command converts from a 16-bit integer to a 32-bit floating point
number. DFLT would convert a 32-bit integer to a 32-bit floating point number.
The command above would convert an integer value stored in D0 to a floating
point number and use D10 and D11 to store this number.
INT – Floating Point to 16-Bit Integer
DINT – Floating Point to 32-Bit Integer
The INT
command converts from a 32-bit floating point number to a 16-bit integer
number. Decimal places are lost, only the integer portion is converted. DINT
would convert a 32-bit floating point number to a 32-bit integer number.
The command above would convert a floating point number stored in D10 and
D11 and store it as a 16-bit integer in D1.