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.