Implement Pulse Width Modulation in PLC using Ladder Diagram programming language.
Problem Solution
To perform this two timers are used to Turn ON and OFF an output according to the length of a pulse.
Timer preset value should vary such that when preset of one timer is increased, preset value of other timer
should decrease in order to maintain Turn ON and OFF time of output.
Select input bits such that we can directly enter digits and place it into Preset value of a timer.
This can be done by using a digital input device which generates 0-9 numerical digits.
Output of this Digital device is always in BCD form and Timers preset values store data in Hexadecimal, so
whichever data are sent to preset register of a time, it has to be converted into Hexadecimal form.
FRD instruction can be used to perform BCD to Hex conversion.
Output of this conversion is directly moved to preset register of timer which can be performed by MOV
instruction.
PLC Program
Here is PLC program to Perform Pulse Width Modulation, along with program explanation and run time
test cases.
List
of Inputs and Outputs
I:1/0
=
Master Start PB
(Input)
I:1/1
=
Master Stop PB
(Input)
O:2/15 =
Master Coil
(Output)
T4:0
= Timer 0,
ON time
(Timer)
T4:0.PRE = Timer 0 Preset value address (Timer)
T4:1
= Timer 1,
OFF time
(Timer)
T4:1.PRE = Timer 1 Preset value address (Timer)
-(RES)- =
Timer reset coil
(Output)
I:5
= 0-100
BCD input
(Input)
N7:1
= BCD-Hex
conversion storing register
(Register)