16.9 ASSIGNMENT PROBLEMS
1. Using 3 different methods write a program that will continuously cycle a pattern of 12 lights connected to a PLC output card. The pattern should have one out of every three lights set. The light patterns should appear to move endlessly in one direction.
3. Write an interrupt driven program that will run once every 5 seconds and calculate the average of the numbers from 'f[0]' to 'f[19]', and store the result in 'f_avg'. It will also determine the median and store it in 'f_med'.
4. Write a program for SPC (Statistical Process Control) that will run once every 20 minutes using timed interrupts. When the program runs it will calculate the average of the data values in memory locations 'f[0]' to 'f[39]' (Note: these values are written into the PLC memory by another PLC using networking). The program will also find the range of the values by subtracting the maximum from the minimum value. The average will be compared to upper (f_ucl_x) and lower (f_lcl_x) limits. The range will also be compared to upper (f_ucl_r) and lower (f_lcl_r) limits. If the average, or range values are outside the limits, the process will stop, and an `out of control' light will be turned on. The process will use start and stop buttons, and when running it will set memory bit 'in_control'.
5. Develop a ladder logic program to control a light display outside a theater. The display consists of a row of 8 lights. When a patron walks past an optical sensor the lights will turn on in sequence, moving in the same direction. Initially all lights are off. Once triggered the lights turn on sequentially until all eight lights are on 1.6 seconds latter. After a delay of another 0.4 seconds the lights start to turn off until all are off, again moving in the same direction as the patron. The effect is a moving light pattern that follows the patron as they walk into the theater.
6. Write the ladder logic diagram that would be required to execute the following data manipulation for a preventative maintenance program.
iii) Provide the capability to change the number of motor starts being tracked, prior to triggering of the indicator light. HINT: This capability will only require the change of a value in a compare statement rather than the addition of new lines of logic.
v) After 9000 minutes of operation turn the motor off automatically and also turn on an indicator light on the operator panel.
7. Parts arrive at an oven on a conveyor belt and pass a barcode scanner. When the barcode scanner reads a valid barcode it outputs the numeric code as 32 bits to 'scanner_value' and sets input 'scanner_value_valid'. The PLC must store this code until the parts pass through the oven. When the parts leave the oven they are detected by a proximity sensor connected to 'part_leaving'. The barcode value read before must be output to 'barcode_output'. Write the ladder logic for the process. There can be up to ten parts inside the oven at any time.
10. Implement the following state diagram using JMP statements.
11. Write a traffic light program using a sequencer. Keep the program simple with a 4 second green and yellow in both directions. But, the traffic lights should only function when the system clock (WALLCLOCKTIME) is between 7am and 8pm. Other times the lights should be left green in one direction and red in the other.