Hello,
I'm having problems converting BCD (binary-coded decimal) to Decimal in VB6. At issue is the received value from a PLC that is already in BCD format (part of the problem is I don't know which flavor of BCD but I would guess it is 8 4-2-1) I know the existing value in BCD (serial port)and I know the real world value in degrees F. (coolant temperature) So, once I figure out the general BCD --> Decimal 10 algorithm I may be able to tweak it to determine the BCD format.
In general, my knowledge of VB allows me to convert a given value from decimal to BCD (any) and back to decimal - easy peasy, but in the problem mentioned above, I do not know what the incoming value was before the PLC converted it to BCD. I am sure it is something simple like getting the correct endianess...
Direct Logic PLC, Modbus RTU.
Any help would be appreciated.
Thanks.
I'm having problems converting BCD (binary-coded decimal) to Decimal in VB6. At issue is the received value from a PLC that is already in BCD format (part of the problem is I don't know which flavor of BCD but I would guess it is 8 4-2-1) I know the existing value in BCD (serial port)and I know the real world value in degrees F. (coolant temperature) So, once I figure out the general BCD --> Decimal 10 algorithm I may be able to tweak it to determine the BCD format.
In general, my knowledge of VB allows me to convert a given value from decimal to BCD (any) and back to decimal - easy peasy, but in the problem mentioned above, I do not know what the incoming value was before the PLC converted it to BCD. I am sure it is something simple like getting the correct endianess...
Direct Logic PLC, Modbus RTU.
Any help would be appreciated.
Thanks.