Does the DM area hold both integer and floats. If yes, how in many words?
For years, the AB instruction set was superior to the Omron instruction set as far as real or floating point numbers are concerned. The C200H Series (H,S,E,G,X,Z,etc.) does not handle floating point numbers, only BCD, Signed BCD and Hex values (both single and double length words - more on that later.) This fact has generated a number of creative solutions by innovative Omron programmers.
Does the DM accepts only in Hex. I also notice the timers and counters all are in BCD.
The DMs (Data memories) are 16 bit data retentive registers that hold binary representations of BCD, signed BCD and Hex numbers. Omron does not treat this area as any particular data type. It is the function or instruction which interprets the binary data found in each DM register as the data type that it needs or requires.
So does I need to convert all back and forth in order to get a sensible number to the operator. If so, how to do that.
If you are displaying the data to an operator on a small display or a computer screen, you may need to string or concatenate data from several registers separated by a fixed decimal point.
What I’m trying to do is to count the total good parts and bad parts, good parts/track number, bad parts/track number, percentage of each, average occurance of each fault etc.
This is a pretty classic application for machines that have counters for total parts and rejected parts. Sooner or later, the concept of percentage pops up and you are faced with a need for an algorithm to calculate it.
Most Omron C-Series programmers solve this with the following solution. Take the total parts and multiply by 10000. Take the rejected parts and multiply by 10000. Divide the rejected parts by the total parts. Take the result and myltiply by 100. The decimal portion of the percentage should appear in the result DM and the integer portion of the percentage should appear in the DM + one.
This is known as a fixed point number rather than a floating point number.
If the original values exceed 9999, you will need to apply double length math to the above (ADDL,SUBL,MULL, DIVL, etc.)
I’m using CX-Programmer Ver.3.0
A word of advice. Until you are comfortable with IEC-61131 data types, always monitor values in the PLC as Channel or Bool. These are the only literal or WYSIWYG values from the PLC. All other data types are conversion of the binary data found in the DMs.
Thanks, Bob, for the other clarifications.