CompactLogic HighSpeed Counter Issue (1769-HSC/A)

phuz

Member
Join Date
Jun 2008
Location
Mohnton, PA
Posts
1,044
Being a series A, there is no individual counter reset, so instead they use a preset to 'reset' the count to the CtrXPreset value in the card config. The problem we are having is that the counter is no longer being reset to the preset value, even when forcing the Ctr2SoftPreset value in the output word. The Ctr2Preset value is "0" and it just stays at the current count. I've read through the manual and it only states that setting the CtrXSoftPreset will move the Preset value to the count, so I would expect to see this revert to a "0" value. It does not do this for any of the counters on the card. I've tried enabling/disabling the counters while doing this, too.

Any ideas?
 
For those, and dozens of other reasons, I can't figure out why people insist on trying to use the raw values of "High Speed Counter Modules" in every PLC. Why reinvent the wheel every time you use a different counter module, or PLC, or deal with various odd preset/reset commands and sequences?

Make a couple of tags.... "Last_Scan_Value" (DINT), "Scan_Delta_Count" (DINT), "Total_Counts" DINT), perhaps a "Counter_EU_Scaler" (real) and "Count_EU_Value" (real). Pretend that "HSC_RAW_COUNTER_IN" is an alias to the actual counter module raw value.

Add in this rung somewhere:

SUB HSC_RAW_COUNTER_IN Last_Scan_Value Scan_Delta_Count MOV HSC_RAW_COUNTER_IN Last_Scan_Value ADD Scan_Delta_Count Total_Counts Total_Counts

If you want to scale to engineering units, just use another rung of:
DIV Total_Counts Counter_EU_Scaler Count_EU_Value

To reset the counter to zero, just do:
MOV 0 Total_Counts

To preset the counter to any particular value:
MUL Preset_EU_Value Counter_EU_Scaler Total_Counts

-----------------

The above is a bit crude and dirty, for extra points, on the Logix 5000 platform, if you have the FBD package, it is usually a good idea to run the raw value from the module through a PMUL instruction, with a word size of 12 to 24. The PMUL is nice, as it eliminates the minor math error on integer rollover, and automagically generates the Scan_Delta_Count as its output.

A further refinement, that I usually include, is to use enable bits before the add instruction, so I only count when I actually want to count.

A bonus of the above method, is that as long as your PLC has retentive values, your count is held through power cycles, unlike most HSC modules without major pains.
 
Well, bud, I wasn't asking for your personal philosophy on programming styles...but we all thank you anyway.

I didn't write this program, nor was I asked to modify it. I was asked to troubleshoot it and exhausted all my attempts before coming here. There was no rhyme or reason for what was happening. I took the same program and re-downloaded to the controller, and it magically started working.

[SOLVED]
 

Similar Topics

Hello Dear users, I am writing about a problem that has been bothering me for a few days, i.e. I am trying to establish remote access to the Allen...
Replies
0
Views
86
Hello I need to message read the entire 16 channel raw analog inputs from a 1769-L33ER Compact Logic controller to another 1769-L33ER Compact...
Replies
8
Views
241
Hello, I want to monitor Wonderware historian's heartbeat and trigger a fault if Historian is not communicating /offline in PLC. Currently my...
Replies
0
Views
790
I would like to connect the compactlogic PLC to our network through the A2 port to enable cloud datalogging, but concerned about potential...
Replies
1
Views
1,507
Looking for AOI for Allen Bradley CompacLogix PAC for Statistical Process Control, SPC Functions like XBar, RBar,Average,etc: yakyak:
Replies
0
Views
1,275
Back
Top Bottom