Peculiar thing about the Equal instruction

gbradley

Lifetime Supporting Member
Join Date
Apr 2002
Location
Corona, Ca.
Posts
1,637
I had a misconception about how the ACC integer is written.
I've been working on a demo program with a couple of counters counting up and down.
I mistakenly thought that I could make a counter by trapping for some random number in the ACC value and then add 1 to an integer value.
I was using 4000, and my Preset was 5000, so I assumed (Big word) that the ACC value had to go by this number.
The funny thing is, It didn’t always see the ACC value that I was trapping for. About 10% of the time it missed it.
When I think about how the scan time works I guess it makes sense.
I replaced the EQU with a Done bit on the timer, and it works every time.
attachment.php



ACCEQU.jpg WithDoneBit.jpg
 
Exactly. A programmer must always be aware that a scan take time. The programmer must notice any effects that time would have relative to the instructions in the program.

A GEQ with 4000 followed by a one shot would have caught on the first scan when the ACC was at or past 4000. If your timer had a long time base, like one second, the ADD would have fired many times.
 
There is something else weird about displaying large values in the panelview. PanelView Component (2711C-K3M)
If the value in the Integer location is above 20,000,000 the Panelview display seems to be off, like it won't display odd values.
L9:0 __________ PanelView
20,000,000 >>>> 20,000,000
20,000,001 >>>> 20,000,000
20,000,002 >>>> 20,000,002
20,000,003 >>>> 20,000,004
20,000,004 >>>>20,000,004
20,000,005 >>>>20,000,004
20,000,006 >>>>20,000,006
20,000,007 >>>>20,000,008
20,000,008 >>>>20,000,008
20,000,009 >>>> 20,000,008
My Display is set to 8 digits and the Tag is Real
 
My Display is set to 8 digits and the Tag is Real

Why would a tage be 'Real' if the source is a 'Long'? That may itself be the problem. You are getting near the upper end of a 32 bit real's being able to hold an increment of just 1. Actually that cutoff is at about 16.7 million.
 
Last edited:
Why would a tage be 'Real' if the source is a 'Long'? That may itself be the problem. You are getting near the upper end of a 32 bit real's being able to hold an increment of just 1. Actually that cutoff is at about 16.7 million.

I changed the tag to 32 Bit Integer and that fixed it.
Thanks
 

Similar Topics

hi guys, Can you help me to understand the logic rung 10 (pls find the attachment).It has rather contradicting instructions , but it works when...
Replies
5
Views
1,718
hi guys, I am facing a peculiar problem with a flex input card that does not communicate with plc.The inputs go high in the module but is not...
Replies
7
Views
2,477
The customer wants to use an existing function block from previous projects to generate variable length pulses. The block looks pretty simple...
Replies
66
Views
13,953
I am latching and unlatching "result_Data_latch" bit within same rung. Will This copy/move instruction execute correctly??
Replies
4
Views
198
So, I'm really just trying to get some experience by practicing with arrays. I'm using studio 5000 v33. I have one rung with an XIC bit that's...
Replies
5
Views
240
Back
Top Bottom