Question: PLC Measuring Scan Time Now design a circuit that will enable us to measure the actual scan time. Using PB1 as the input waveform we
PLC Measuring Scan Time
Now design a circuit that will enable us to measure the actual scan time. Using PB1 as the input waveform we will create a circuit that allows us to measure the pulse width of PB1 and calculate the total PLC scan time.
Tie PB1 directly to the input of a retentive timer and directly to the input of the incremental adder without an OSR. Utilize PB2 to reset the retentive timer and set the adder constant and memory sources = 1. Now press and release PB1. The retentive timer will show how long PB1 was active and also how long the incremental adder was adding. The adder will increment once per scan and will therefore show how many scans occurred when PB1 was pressed. If you divide the timer value by the incremental adder value this will give you the scan time.
Since we do not have floating point capability, if you use a DIV function you will have to manipulate the timer value so that it becomes larger than the incremental adder value in order to divide correctly. You can multiply the timer value by 1000, divide that number then you will get a number that is 1000 times as long as the actual scan. If you divide the timer by a larger number you will get a number that is less than 1 and will show up as a 0 since we don't have floating point capability.
Next utilize an OSR, tied to the input of an RTO (timer) to measure how long a scan took to complete.
Perform this step twice, once with only the PB, OSR, RESET and the RTO and measure the scan time. Next add the following code in immediately after the RTO:
Output Light 1 = SW1 & SW2 & SW3 & SW4 & SW5
Output Light 2 = SW1 or SW2 or SW3 or SW4 or SW5
Output Light 3 = (SW1& SW2 & SW3) or (SW3 & SW4 & SW5)
Output Light 4 = Output Light 1 & Output Light2 & Output Light3
Output Light 5 = (Output Light 4)
Output Light 6 = Output Light 1 or Output Light2 or Output Light3
Output Light 7 = SW1 or SW1
Output Light 8 = SW2 and SW2
PB 1 is tied to the input of an additional timer T4:2 and 2 counters C5:1 and C5:2
Perform the test again and measure the scan time, is it the same as the initial circuit?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
