BCD to Integer conversion

DellSuperman

Member
Join Date
Apr 2011
Location
Singapore
Posts
5
Hi all,

I am quite new to PLC programming, so pardon my noob-ness.

First, I have counters & timers in my program that I use to calculate total units/pass. But these functions are counted in BCD & when I need to multiply them, I tend to get weird things...

My current ladder program is something like that.

Counter for total Pass (D2000) --> value of total pass X 100 (D2001) --> D2001 / Total tested --> Yield (in percentage)

When I set them at the default setting (all in BCD), the calculation for the multiply & division will go wrong.
When I set them as Integer, the initial calculation for the counters will go wrong because they count from 1-9, 16-25...

The test box on my UI reads integers.

Someone please help me..!
Thank you in advance.
 
Looks like an old Omron. Change CX-P to read in BCD for correct figures and make sure multiply and divide are BCD not binary.
 
See this:
0007(hex)=0007(bcd)

Binary multiply:
0007*0007==(0000 0111)*(0000 0111)==(0000 0000 0011 0001)==0031(hex)

BCD Multiply:
0007*0007==0049(BCD)

Convert all data from BIN to HEX than use BCD multiply/divide to get a correct reult.
 

Similar Topics

Hi, I'm communicating with a generator controller via Modbus, and not sure how best to write the time to it. The generator is expecting the...
Replies
0
Views
1,108
I am receiving 16 I/O pts. into an Integer called LC. I want to convert this to a BCD. What is the easiest way (instruction?) to do this? If...
Replies
2
Views
2,438
Hi all, BCD to Integer instruction in STEP7 reads the contents specified in the input parameter as a three digit number in binary coded decimal...
Replies
2
Views
7,820
hi... i have an issue in s7 300 plc, while we run the machine(in idle there is no fault) , plc cpu goes in SF mode, after restart the power cycle...
Replies
2
Views
107
Hi. I’m doing a PV 1400e to PVP 7 migration and I don’t know how to convert the old 8digit BCD type from PB1400e into something that will work on...
Replies
2
Views
586
Back
Top Bottom