Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

BCD,HEX,BINARY,DECIMAL ?? 1

Status
Not open for further replies.

lrob

Industrial
Oct 3, 2003
56
I have been programming with A-B and GE. In their programming software they display and manipulate numerical values in a decimal format. I have resently been exposed to programming an Omron CPM2A plc. I have a real problem tracking when the result of an instruction is going to end up with a Hex or BCD value. Some instructions use BCD, while others have results that are in Hex. With more exposure to these PLC's and others I need to increase my knowledge of utilizing the different units. Does anyone have a suggestion of a book or website that will help me understand programming issues related to this topic?
 
Replies continue below

Recommended for you

With Omron programming we are definitly taking a step back in time. An easy way to convert eveything to Des. is using you windows calculator set to scientific mode.
Good Luck!
 
Converting number with the calculator I have done. When the instructions have a result that is hex and you use that result in an instruction that is BCD based, the BCD based instruction does not recognize the A-F of hex. I have a program issue.

I am receiving a binary number representing a length in inches with one decimal digit. I need to automatically detect if the decimal is anything other than 0 or 5 (half inch increments) and round it down to either o or 5. For example if 11.8 needs to round to 11.5. My problem is this value altimately needs to be in BCD.

Most of the Omron math instructions give me a Hex result. I have converted the binary to BCD then used the BCD ADD instruction and the result was Hex(that made no sense to have a BCD instruction and a result in Hex).

One thing I left out, as far as I can tell Omron has no way to convert Hex numbers to another format, so once the value is considered Hex there is no way to get rid of the A-F values. Other instructions error with the Hex values. I have been rambling about my project, that is just program frustration coming out.
 
A small simple type PLC si the CPM2A. You will find the CJ1 and CS1 are awsome beasts with heaps of different tyupes of calculations such as floating point, binary etc etc.
What specific instructions are you have trouble with? Send me a sample. Are you using Syswin or CX-Programmer?
 
OldPfart
I am having a problem with selecting the correct instructions to accomplish what I have outlined above. I seem to use several instructions then one will convert or not accept a value. Luckly the .5" problem is no longer as big of an issue as it was. I no longer need to round ,however as a matter of learning I still need to figure this out. I am using CX-Programmer.
 
I would suggest that you visit this site where all manner of Omron manuals are available.

May I indicate to you the I prefer Omron above all others, particularly because of CX-Programmer and Omron's Controller Link network. I often network 10 or more PLCs. Controller Link is brilliant.

Many of the earlier Omron PLCs were very much BCD based. The later PLCs such as the CS1 and CJ1 allow you to select timers and counters to be either BCD or HEX based. It si your choice.

Binary and BCD are the same really.

The CS1 and CJ1 allow 64 bit wiord combinations and mathematics. Most useful sometimes.

One of the things I love about CX-Programmer is that the # symbol before a number means BCD while the @ symbol means binary. Very easy to program.
 
One thing I might add is that the BCD instruction will convert hex to BCD. However, if A-F are present in the hex value, it cannot convert to BCD as BCD only goes to 9. This will create an error if these values are present. Makes sense really.

 
OldPfart,
I was thrown into this Omron PLC after the project was already started. I had only the CX-Programming software. I spent more converting my program to Omron than reading all the programming info. You tip about the # and @ will help me sove several problems with my program.
 
Glad to be of help. Hope you enjoy the software, as you become more accustomed to it. I know I do, love the fact that I can program function keys to do what I want to do.

In monitor mode, if you use the watch window you can lok at up to 4 channels in a single line. The latest version allows you to see that information as words and as binary bits. Very useful.

Reply here if you require more assistance.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor