Sign in to follow this  
Followers 0
Minty

CMP (20) Instruction

10 posts in this topic

Hi Guys I have 2 CMP (20) instructions as example 1. The problem is when either 25505 or 25507 or 25506 both of the outputs get activated. Example 1 ---------------------- CMP (20) INSTUCTION | |----| |--------O- Greater Than (25505) | |----| |--------O- Less Than (25507) | |----| |--------O- Equal to (25506) ---------------------- CMP (20) INSTUCTION | |----| |--------O- Greater Than (25505) | |----| |--------O- Less Than (25507) | |----| |--------O- Equal to (25506) So logicaly i should do as example 2 and add 2 switches. But now the problem is how do i drive the switches. I need to drive them one at a time with only one switch ever being on at one time. Oh in the final program there is going to be at least 10 different compare statements. Can anyone offer me any advice? Sorry if my expanation isnt clear! Example 2 Switch1 ---| |------------------- CMP (20) INSTUCTION | |----| |--------O- Greater Than (25505) | |----| |--------O- Less Than (25507) | |----| |--------O- Equal to (25506) Switch2 ---| |------------------- CMP (20) INSTUCTION | |----| |--------O- Greater Than (25505) | |----| |--------O- Less Than (25507) | |----| |--------O- Equal to (25506)

Share this post


Link to post
Share on other sites
Oh the switch in example 2 is before the down ladder link to the outputs. It came out wrong once posted!

Share this post


Link to post
Share on other sites
25505, 25506 and 25507 need to drive internal bits for use in the program. -------CMP (20) --------[25505]-------5.00 Which PLC are you using? Is it the C20 you mentioned in a previous post? If it is, be careful they have very little memory. How do you want to control your compares? If just in turn, use a shift register. Edited by BobB

Share this post


Link to post
Share on other sites
Thanks for your quick reply. The PLC i`m unsure of at the moment which one we will finally use (hopefully i will get a better idea next week to the hardware used. Essentialy i`m driving 3 seperate axis in both forward and reverse. I`m using the compare command to drive the motor forward and backwards depending on the result of the compare command. I think driving the outputs in turn will be fine for my application. Though i`m only a newbie it would be nice if somehow there was more than one set of < > = registers.

Share this post


Link to post
Share on other sites
Ok i had another idea what if i did the following:- Execute compare1 Copy results to location1 Execute compare2 Copy results to location2 etc......... Then had the logic lines which are controlled from location 1 to location 10 say as below Location1 ----| |-----------------O- etc........... is this possible? Many thanks for your patience with me!

Share this post


Link to post
Share on other sites
There is a fundamental flaw in the way you are trying to use CMP(20) instruction. The Condition Flags are reset at the end of program scan and are set by the Comparison Instructions. Each time the Comparison Instruction is executed, the Condition Flags are reset from their previous conditions and assume the value of the new Comparison. Because of this characteristic, special precautions must be taken so that the Condition Flags represent the true value of the programmer’s intent. When using the Condition Flags, be sure to enable the condition flags by the same initiating contact that drives the compare instruction. If not, succeding use of the condition flags will give erroneous status because they will be energized by the previous compare. See graphic below. Also please read the link to the compare tutorial. It is perfectly legitimate to use an infinite number of CMP(20) instructions as long as the below template is reproduced. Use of Compare with Omron PLCs @ MrPLC.com

Share this post


Link to post
Share on other sites
Indeed i understand now. Cant wait till my CX Programmer arrives next week i`m still stuck here converting examples into Syswin. On another point is there a demo of CX programmer? Many Thanks!

Share this post


Link to post
Share on other sites
Try here

Share this post


Link to post
Share on other sites
Interesting! My Norton antivirus says the Cx-programmer.exe on that site is infected with backdoor.trojan.dr anyone else get the same result?

Share this post


Link to post
Share on other sites
I only down loaded part of the files but NOD32 did not report anything funny. I have had this with Norton before. Had trouble installing Microsoft Project, although you cannot be too careful these days. The latest versions of CX-Programmer have advanced from the trial version substantially. Syswin is very good and still is used extensively on the older PLCs. The CS1 and CJ1 require CX-Programmer. If you use the CJ1, CS1 or even the C200HE-Z you will find there are a great many variants of the compare function. Suggest CJ1 or CS1 if you have not purchased the PLC yet. These are the latest processors and have the longest life expectancy.

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