PLC Program to Convert BCD to Excess-3

This is a PLC Program to Implement BCD to Excess-3 Code Conversion.

Problem Description

Implementing BCD to Excess-3 code conversion in PLC using Ladder Diagram programming language.

Problem Solution
  • Excess-3 code can be derived from BCD code by adding 3 to each number.
  • For example, Decimal number 12 is represented as 0001 0010 in BCD. If we add 3 that is to add 0011 0011 then the corresponding Excess-3 code is 0100 0101.
  • Write the truth table relating BCD and Excess-3.
  • Write Karnaugh-Map for each output and obtain simplified expression.
  • Implement BCD to Excess-3 code conversion circuit using Logic Gates.
  • Implement Logic Gates’ circuit in PLC using Ladder Diagram programming language.

Truth Table relating BCD and Excess-3 codes

Decimal	BCD inputs	                Excess-3 Code outputs
	B3	B2	B1	B0	E3	E2	E1	E0
0	0	0	0	0	0	0	1	1
1	0	0	0	1	0	1	0	0
2	0	0	1	0	0	1	0	1
3	0	0	1	1	0	1	1	0
4	0	1	0	0	0	1	1	1
5	0	1	0	1	1	0	0	0
6	0	1	1	0	1	0	0	1
7	0	1	1	1	1	0	1	0
8	1	0	0	0	1	0	1	1
9	1	0	0	1	1	1	0	0

Boolean expression for each Excess-3 code bits

 E3= m(5, 6, 7, 8, 9)
 E2= m(1, 2, 3, 4, 9)
 E1= m(0, 3, 4, 6, 7, 8)
 E0= m(0, 2, 4, 6, 8)

Karnaugh-Map solution for each output
plc-program-implement-bcd-excess-3-code-converter-01
plc-program-implement-bcd-excess-3-code-converter-02

advertisement
advertisement

Realizing code conversion using Logic Gates
plc-program-implement-bcd-excess-3-code-converter-03

PLC Program

Here is PLC program to Implement BCD to Excess-3 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)
 E3=		O:2/0	(Output)
 E2=		O:2/1	(Output)
 E1=		O:2/2	(Output)
 E0=		O:2/3	(Output)

Ladder Diagram to obtain Excess-3 code output
plc-program-implement-bcd-excess-3-code-converter-04

Program Description
  • In RUNG000 as we can see, to perform B0+B1, both inputs are connected in parallel to each other and this parallel connection is in series with B2 (I:1/1) to obtain B2(B0 + B1) as in simplified expression. To finally obtain output E3 (O:0/0), B3 (I:1/0) is connected in parallel to entire term B2(B0 + B1) that is I:1/1 (I:1/3 + I:1/2).
  • Similarly in all rungs, XIO and XIC are connected according to simplified expression.
  • RUNG002 and RUNG003, it can be noted in the Circuit Diagram that XIO connections of B0 and B1 are made in order to set E0 and E1 to 1 which makes E3E2E1E0 = 0011 (03).
Runtime test Cases
Decimal	BCD inputs              	Excess-3 Outputs
	B3	B2	B1	B0	E3	E2	E1	E0
0	0	0	0	0	0	0	1	1
1	0	0	0	1	0	1	0	0
2	0	0	1	0	0	1	0	1
3	0	0	1	1	0	1	1	0
4	0	1	0	0	0	1	1	1
5	0	1	0	1	1	0	0	0
6	0	1	1	0	1	0	0	1
7	0	1	1	1	1	0	1	0
8	1	0	0	0	1	0	1	1
9	1	0	0	1	1	1	0	0

Sanfoundry Global Education & Learning Series – PLC Algorithms.

advertisement

To practice all PLC programs, here is complete set of 100+ PLC Problems and Solutions.

advertisement
If you find any mistake above, kindly email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.