11 PLC Program To Implement BCD To Gray Code Conversion
11 PLC Program To Implement BCD To Gray Code Conversion
Conversion
This is a PLC Program to Implement BCD to Gray Code Conversion.
Problem Description
Implementing BCD TO Gray Code conversion in PLC using Ladder Diagram
programming language.
Problem Solution
In Gray Code only one bit changes at a time.
Writing truth table showing the relation between Binary as input and Gray code as
output.
Since input is BCD, only 10 combinations can be made using 4 bits. (0 to 9).
For each Gray code output D3, D2, D1 and D0, write Karnaugh-Map.
From the K-Map, obtaining a simplified expression for each Gray Code output in
terms of BCD inputs.
Realize the code converter using the Logic Gates.
By following actual process to convert BCD into Gray Code, Truth Table can be
written as given below.
PLC Program
Here is PLC program to Implement BCD to Gray Code Conversion, along with
program explanation and run time test cases.
List of Inputs and Outputs
B3= I:1/0 (Input)
B2= I:1/1 (Input)
B1= I:1/2 (Input)
B0= I:1/3 (Input)
D3= O:2/0 (Output)
D2= O:2/1 (Output)
D1= O:2/2 (Output)
D0= O:2/3 (Output)
Program Description
Simply by observing the logic circuit, ladder diagram is made.
RUNG000 for output bit D3 (O:2/0) is as described earlier that the MSB of Gray
Code and Binary are same, so passed the same B3 (I:1/0) bit directly.
Since inputs are BCD, D2 (O:2/1) is obtained by just ORing inputs B2 (I:1/1) and
B3 (I:1/0).
By simplifying Boolean expressions, we can see that each inputs are EX-ORed
with each other in different Rungs.