Sign in to follow this  
Followers 0
Weld_Man

Max Instruction

10 posts in this topic

Hello, I am having trouble figuring out how to use the MAX instruction for my Omron C200HE PLC. I have read the manual and have experimented with different ways to try it, but with no luck. I was wondering if anyone would be able to help. I'm using CX-Programmer V.6 What I am trying to do is find my Max value between DM2600 to DM3800, and put that max value in DM80. The values are coming in from an analog input. I am a little confused as to what they mean by Control Data, and how to specify the range of values to find the max in. Also, with the C200HE, it looks like the MAX instruction cannot be executed in the background (requires an on/off), while the CS1G the MAX can be executed in the background, am I correct? It also looks like my limitations to find the max value can only be read from 999 BCD values? I've experimented with using the instruction from only DM2600 to DM 2650 but I still cannot get it to work. Any help would be greatly appreciated. Thank you

Share this post


Link to post
Share on other sites
The control word defines how the instruction will work and the number of words in the range. Bit 15 on means the values in the range are signed binary values, if off normal binary values. Bit 14 on indicates Max value memory location will be output to destination word + 1. Bits 11 - 0 in BCD define the size of the range (0-999). You will need to execute two different MAX instruction to cover the 1200 registers you want for your range. You are correct, there is no background execution in the C200HE. Hope this will help.

Share this post


Link to post
Share on other sites
Hmm, I must be doing something wrong as the instruction still will not work. Here is what I'm doing My control word Is DM0002 Here is what DM0002 looks like in Binary: Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 1 0 0 0 0 1 1 1 1 1 0 0 1 0 1 That is C3E5 in Hex. So what I think my control word is telling it to do is: Signed Binary Values Max output address to desitnation Word +1 And finally, search through 999 words to find the Max So my MAX instruction looks like this: MAX DM0002 DM2600 DM80 It still won't accept it. Should my MAX control Word be an IR, would that matter?? Thanks. Edited by Weld_Man

Share this post


Link to post
Share on other sites
Weld_Man, The right most three digits of the control word MUST be BCD. Try changing it to DM0002 to #C990 and see what happens. Edited by gtsuport

Share this post


Link to post
Share on other sites
The number 999 should be entered as BCD, not as binary, so the control word should be #C999 (hex) instead. As you have an "E" in your current control word, all you probably do with that instruction is to turn on the ER (error) flag.

Share this post


Link to post
Share on other sites
Thanks for the help guys! Well I changed the Instruction so the control word is BCD. I tried it two different ways. The first one I entered the control word just as #c999. Then I tried converting DM0003 Binary to BCD and put the BCD in DM0002, and used DM0002 as my control word. It still is not accepting my instruction. I attached a PDF file of how my instruction looks. Keep in mind that these instructions still do not work and the program check has failed. I am lost as to what to try next as it seems i have tried everything. The manual is not much help, because it seems like i am doing the right thing. I know I am not that good dealing with the different number systems yet, so that could still be my problem. If anyone has time could they write up a quick example? Any other ideas? Does it look like im writing my instruction wrong? Thanks a lot again! MAXHelp.pdf

Share this post


Link to post
Share on other sites
In CX-Programmer, I'll bet the MAX is RED? The MAX instruction is an expansion instruction. You must map it to an instruction / function number. In the left frame is an Expansion Instructions choice, click on it, then Remove an unused instruction and set that number to the MAX instruction. I think things will start working after you do that and download the program to the processor.

Share this post


Link to post
Share on other sites
You can always find the reason for the program check failure in the output window, (Alt+2) at the compile tab. It tells you the number of warnings and errors, scroll up the compile output to see where the error occurs. In this case gtsupport most likely is right, by default the MAX instruction is not mapped in a C200HE.

Share this post


Link to post
Share on other sites
Awesome! It works, and I learned something new! Gtsuport, I did have to map the instruction. I would have never figured this out on my own. Thank you Gtsuport! Thanks everyone for your help, I really appreciate it. The more I learn the funner this stuff gets.

Share this post


Link to post
Share on other sites
Great!! Glad you got it working. The "tip off" to the problem was in your pdf file. There was no function number on the MAX instruction. Without the "picture" we would probably still been chasing this. Let us know if you have any other questions.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0