Maths Instructions in Omron C200HE (AB guy struggling with Omron)

chavak

Member
Join Date
Jul 2002
Posts
750
:oops:

Hi everybody (especially Jay)

Can anybody help explaining please. I am used to AB programming methods, the ‘Compute’ instruction, or divide, multiply etc is used there to do mathematical calculation in its own format (Decimal or float) and write the answer to a destination – maybe to an address N7:0, F8:0 etc. How should I go about it in Omron C200HE. I don’t see any separate data structure for real numbers.

Does the DM area hold both integer and floats. If yes, how in many words?

Does the DM accepts only in Hex. I also notice the timers and counters all are in BCD.

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.

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.

I’m using CX-Programmer Ver.3.0

Thank You
 
In symbol view you can select Variable types.

Geberally in math operation, you must use INT variables for
for INT-based commands, dint for dint and real(Float) for
real-based operations.

In Omron world it means you must use numbers of Variable
type changing commands before Computing and maybe after you must
change real result back to INT Or DINT variable.

1 Tip! Chage degrees to radians for sine etc. functions and asine etc.
functions returns radians for You.
 
Oh boy! Been here before. I program any PLC the customer insists on using but prefer Omron so may be able to help.
The C200HE does not handle IEEE754 floating point maths for starters. If you need that format, you need to go to the CS or CJ. Got caught myself but I guess it happens to all of us somewhere along the line.
The DM (data memory or register) area of the PLC handles BCD, binary (integer), hex and ASCII strings. It is just a storage and calculation area. Be careful, the DM memory area is retentive and if you turn a calculation off and do not want the figures to remain in the channel, you have to write zeros to the channel. The area is also retentive on power down and back up again. If you do not want the memory to be retentive, use normal channels. Suggest channels 300 up and these are not retentive.
There are a variety of functions that enable you to convert one format to another eg BIN, BCD etc. The danger is that if you are going to convert from say HEX to BCD, you have to make sure your number does not exceed 270F (9999) or you will generate an error.
CX-Programmer handles numbers differently to Syswin and you have to make sure that when you use a number or a function that the DM is specified in the symbols with the correct data type or you will get an error. For example, if a number in a function is binary (hex or integer) if you describe it in the symbols as BCD an error may occur.
There is a floating point command in the HE but it is a bit of a dog to use. I normally just use divide and then shift digits (SLD or SRD) to put the remainder in the correct position in the word to enable another divide to take place with the correct answer.
This way of handling numbers appears to be to satisfy IEC but I could be wrong. Syswin and the older PLCs just used channels in the symbols. This is also a less secure data type. Maybe if you just describe the words as "channels" instead of using integer etc, it may make more sense to you.
Like any PLC going from one brand where you have a great degree of comfort to a brand you do not know can be quite traumatic. I have found in the past that the main thing that confuses people with Omron is the huge blank sheet of paper, channels are channels whether they contain physical I/O or internal bits. Once you get used to it the big sheet of paper is excellent. No channels are tied up strickly for I/O but can be used for anything.
Not sure waht you are trying to accomplish. If you supply more detail, I may be able to help further.
:confused:
 
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.
 
Last edited:
Thankyou Seppo, BobB and Jay,

Roughly I am getting to know how DM is structured in Omron. Definetely I'll will be working out to see the data given out is what it is supposed to.

Today I managed to loan a CPM1A from a friend of mine, now I have the luxury to try it out before implementation. I've completed the machine sequences and alarm generation. Working on production data now, it is an indexer machine to assemble certain components together. One of the criteria by the customer was to display how many components used, good products count, reject part count(there are 3 different kinds of inspection involved, including a vision system). The machine produce 12 parts per index, so they want it to display in each track data, and all the percentages.

The number of products per track itself is more than 9999, so the total parts count is going to be much higher.

The HMI is a Hakko Touch Screen.

Thank You again
 
If the numbers are much higher than 9999 there are several ways you can handle them. If they are under 99999999 you can use the ADDL function (add long) and this will add into 2 words giving you a maximum of 99999999. You can also use the differentiated variant of the function - just use @ADDL. Each time a new part is detected, the function will add #1 on the rising edge only.
If the numbers are larger than that, I would suggest you use CMPL (compare long) and when the count = 99999999, use another ADDL function and add #1 again into this. This would give you 9999999999999999.
You will be able to experiment with this function in the CPM1A.
beerchug
 
Question for Jay

When doing math in Omron, I have always changed the data type of the DM in the symbols table to INTEGER. This way I could do math the way I was comfortable. I have also employed Jay's method of multiplying and dividing by 100 or 10000.

I wish Omron had a few things when it comes to math:

1. A compute instruction like AB
2. A check box for the available data types. Omron has a lot of data types which is good I guess. But, I would like to have the choice to "expand" this set only if needed. By default, I would like Boolean, BCD, Real, and Integer. It seems like this should cover about 95% of the needs.
3. At least a 32-bit processor to handle double numbers.

Quote from Jay: For years, the AB instruction set was superior to the Omron instruction set as far as real or floating point numbers are concerned. This fact has generated a number of creative solutions by innovative Omron programmers.


Jay - Has Omron changed this any with the new CS/CJ? This is one area I would like to see some improvement in the Omron PLC/Software.
 
Hi Drew
The answer is yes. They also handle IEEE754 and quad words. Also have inbuilt auto tune PID. Check this link
http://oeiweb.omron.com/Home.shtm and go to the document library. There is a new manual for the CS/CJ and covers all instructions.
You will be surprised.
 
Last edited:

Similar Topics

Hi Folks I hope this is not a dumb question,I am a newbie . I want to perform simple math functions like multiplication, addition etc in TIA...
Replies
6
Views
2,797
Hi all, I am trying to copy paste a routine from rs logix500 into rs logix5000, I get an error on rung where they are searching for scada values...
Replies
1
Views
1,848
Hi I am fairly new to PLC programming and I am self learning. I have written a simple program to detect and store the RPM and ultimately the...
Replies
0
Views
1,411
Hi All, Rockwell Compact Logix processor. I'm using an Add function that I trigger by a using an XIC instruction followed by a ONS. The add...
Replies
6
Views
2,100
Hi everyone, I am generally comfortable with AB PLC's and programming but have recently acquaired a job where I need to modify an Omron Cqm1h...
Replies
2
Views
3,715
Back
Top Bottom