Ti Cmp Instruction Help Tisoft Software.

BOWRIDER

Member
Join Date
Mar 2003
Location
FLORIDA
Posts
58
Hi everyone. It’s been a while since I posted anything but I am hoping one or more of you can help me with this small problem. I am working with an old TI plc. We only have two in our plant and I probably know more than anyone here about the programming software. (Witch isn’t much I might add).

I would like to take a range of the accumulated value of a timer and energize an output when the timer is within that range. For example, if the timer preset is 25 seconds, I would want to energize the output while the timers accumulated value is within the range of 2.2 seconds and 2.8 seconds for a total .6 seconds. The instruction I believe I need to use is the CMP instruction. I have attached, (I hope), a jpg image of the instruction as it appears when I create it in the tisoft software. The manual I have is of little help, it states and I quote,

“compares a number in memory location A to a number in memory location B. The comparison is made for equal to, less than, or greater than. Values in the A and B memory locations are not affected.”

Ok, here is what I think I have figured out. When the A and B areas of the instruction are highlighted I have multiple memor locations to choose to compare. Wx, wy, v, tcp, tcc, stw, dsp, dcp, dsc, and dcc. I believe what I want to use is the tcc, witch I believe is timer/counter/accumulated. That would be my value for A I would plug in. For the B value I would Choose V witch would be my static value I wish to compare my timer accumulated value too. Here is my dilemma. When the Lt: and Gt: areas of the instruction are highlighted, I only have two instruction types to choose from, Y and C. Y is an output coil or so I believe, C is a internal coil I believe, like the Allen Bradley b3: bit in a slc controller.

How do I actually define the terms greater than or less than in the instruction and how can I use Y and or C to do this? I am stumped! Does anyone have any experience with this software? Am I attempting to use the correct instruction? Any help would be greatly appreciated.
 
Last edited:
Sorry, Bowrider,

I'm an old fan of the TI stuff - I won't hear things like "the manual ... is of little help"!!!

Anyway let's see if we can get you going.

The CMP instruction does it all for you. It constantly compares the two values A: and B: and sets or clears the bits you have designated for LT: and GT:. Also, don't forget the actual output of the box (the right-hand power-flow) which gives you the EQ signal.

You are absolutely correct with your interpretation of TCC (Timer/Counter Current) for one of the values A: or B:, and using a V-location for the other. Remember to check whether you are comparing an ordinary timer (programmed as TMRxxx) with a time base of 0.1s or a fast timer (programmed as TMRFxxx) with a time base of 1mS. The equivalent of 2.2S in a TMR will be shown as 00022 in your V-location, but would have to hold 02200 for a TMRF.

So let's say we are comparing A:TCC123 against memory location B:V200. And let's say we've designated the LT: flag as C99 and the GT: flag as C101. The output of the box is connected to a coil, C100, and V200 is loaded with 00022. As the timer begins running it times down from the preset to zero, so initially the comparison of TCC123 against V200 will be that the timer value is greater than V200. So C101 will be 'true', and C99 and C100 will be 'false'. When TCC123 is equal to V200, both C99 and C101 will be 'false' and C100 will be 'true'. As the timer continues to time C99 will become 'true' and C100 and C101 will be 'false'.

Where you are trying to identify a mid-range period, you will have to perform two comparisons, one against the 2.2s and one against the 2.8s. If you're not interested in identifying the LT: and GT: for both then just leave the entries blank. Perhaps you only need to detect LT: for 2.8 and GT: for 2.2 Then combine both these logic states (i.e. the bits for 'less than 2.8' AND 'greater than 2.2') to drive your output.

Finally make sure you check correctly which end of the timing period you are looking at. If you want 2.2 and 2.8 seconds after the timer starts, then because your preset is 25s you should be comparing against 228 and 222 as the TCC value, since the timer counts down from 250. On the other hand if you want 2.8 and 2.2 seconds before it expires, then 22 and 28 are the correct values to use.

Good luck, and come back and tell us how easy it all was!!:)

Regards

Ken
 
Ken M is right on in his explanation. If your Compare value is always the same, you can use a K memory location instead of a V.

Ken M and myself answer most of the TI questions, there used to be another "expert" by the name of Terry Wood, but he hasn't been active for a while now.

Do you have the instruction set reference?
What processor are you using? 545, 555, 565, 575?
 
Thanks bunches Ken and Ken.
Thats just the kind of help I needed and always get from this forum. As regards to the manual ( or in my case a pdf I got off line somewhere) the only referance it had to the cmp instruction use was the quote I referred to in my first post. I would like to know where I could get a copy of this instruction set referance (preferably in pdf format). It seems to me we had something like that around here at one time and now it has disappeared. I believe it is a 520 C series 500 controler. I will certainly let you know how I make out.
P.S. I meant no insult Ken when I said the manual was no help. Mayby as Ken M suggested I just don't have the right one. Thanks again guys!!!!!
 

Similar Topics

I've recently picked up AB again after spending 5 years on Siemens and noticed a frustration immediately with monitoring of CMP (Compare)...
Replies
6
Views
2,763
Hello, I've been having trouble getting the syntax correct in my expression for a CMP instruction. My expression is: (VarA > VarB) AND (VarA >...
Replies
20
Views
13,891
I an trying to use the CMP instruction to compare the value of 4 differnt INT's to see if they are all equall. I am able to compare "tag1 = tag2"...
Replies
11
Views
4,758
Situation: Single [EQU] instruction with single [OTE] on a rung, nothing else/simple. [EQU] operand(A) is a real number data type...
Replies
16
Views
2,574
Hi All, I was wondering what your thoughts are on why Rockwell has this disabled by Default on Series B (Series A this is always enabled I...
Replies
4
Views
2,178
Back
Top Bottom