PLC Programming Examples
Programming Examples
Example 1:
Write a program (instruction list) to put the number (4000) in a memory location, and the number (41) in another location. divide the first one by the second and put the result in a memory location.solution:
Example 2:
Make a program to increase the counter by one with each pulse from the pulse generator SM0.4 (on rising edge) , and decrease another counter by the same pulse.
Solution:
steps of solution would be like this:
1. put zero in memory location vw100.
2. put (10) in the memory location vw110.
3. with each rising edge from SM0.4 (every 30 sec), we increase memory location vw100 by one. and at the same time decrease vw110 by one. the program will continue like that without any instruction to stop.
#please note that:
MOVW => move word
INCW => increment word
DECW => decrement word
Example 3:
Put a value in memory location vw200, and using shifting method, move this value to the output of the PLC.
Solution:
when we press the PLC input button (I0.0), the PLC will put the value (980) inside memory location vw200, and when the rising edge of the pulse arrives, the contents of memory location will be shifted to the left for one bit (the instruction SLW = shift left word). we could put 2 after # to shift two bits to left. If we put 7 after the #, the overflow indicator will be activated (SM1.1=1) which will activate the output in question.
here is the ladder diagram:
Example 4:Using two timers, write a program so we have a pulse on PLC output with (TON = 10 sec.) and (TOFF = 10 sec.)
*TON: timer output on, TOFF: timer output off.
Solution:
Example 5:
Using up-counter (CTU), make the PWM algorithm.
solution:
there is inside the PLC places for generating a series of pulses with fixed durations, one of these places is SM0.5, it generates a pulse of 1 second (on time is 0.5 sec and off time is 0.5 sec). another one is SM0.4, it generates a 60 second pulses.
.. and timing diagram:
Put a value in memory location vw200, and using shifting method, move this value to the output of the PLC.
Solution:
when we press the PLC input button (I0.0), the PLC will put the value (980) inside memory location vw200, and when the rising edge of the pulse arrives, the contents of memory location will be shifted to the left for one bit (the instruction SLW = shift left word). we could put 2 after # to shift two bits to left. If we put 7 after the #, the overflow indicator will be activated (SM1.1=1) which will activate the output in question.
here is the ladder diagram:
Example 4:Using two timers, write a program so we have a pulse on PLC output with (TON = 10 sec.) and (TOFF = 10 sec.)
*TON: timer output on, TOFF: timer output off.
Solution:
Example 5:
Using up-counter (CTU), make the PWM algorithm.
solution:
there is inside the PLC places for generating a series of pulses with fixed durations, one of these places is SM0.5, it generates a pulse of 1 second (on time is 0.5 sec and off time is 0.5 sec). another one is SM0.4, it generates a 60 second pulses.
.. and timing diagram:
in which PLC
ReplyDeletehi Mr!
ReplyDeleteI read this blog of yours in which you mentioned the example of PLC example number 4 you are using two timers .I have learned a lot of knowledge from it
Electrical Engineering