Sign in to follow this  
Followers 0
sbaum

Retentive HSC in CP1H

13 posts in this topic

Hi all. Is it possible to retain a High Speed Counter value during a power-fail? I am using the built-in HSC on the CP1H. Currently the HSC value is set to zero after cycling power. I understand the positioning implications with equipment moving when the power is off, but in my application this is not an issue. Ideally I could write to the HSC value... am using High Speed Counter #2 (A316 - A317) but that area appears to be read-only. I've done this on Micrologix 1400s... on the first-cyle I just disable the HSC, write the retained value back to accumulated value and I'm off to the races. I can't figure out how to do this with the CP1H...

Share this post


Link to post
Share on other sites
You will need to use the INI instruction. Some sample code is shown below:
1 person likes this

Share this post


Link to post
Share on other sites
Perfect! I overlooked that instruction.

Share this post


Link to post
Share on other sites
possibly you could also use the power off task to copy the last known value of the HSC... good work Michael..

Share this post


Link to post
Share on other sites
Sleepy, I had considered that, but something was bugging me about it, so I checked and the CP1H does not have a power off task....

Share this post


Link to post
Share on other sites
Be aware, though, that the Michael's code will not restore exact HSC reading, as it stores a value only once per scan. If you need more precise restore, you have to execute this in the fastest available timer interrupt, and use PRV instruction for the HSC PV reading. Edited by Sergei Troizky

Share this post


Link to post
Share on other sites
You also need to realize that whatever you are driving/measuring with the HSC will not stop instantly during a power failure. This means that even if you capture the very last HSC reading (which is unlikely) your actual position will not be there but somewhere else. If you need to know exactly where your device is positioned when power is restored then you need some type of absolute encoder for position feedback.

Share this post


Link to post
Share on other sites
Yes. There is a particular type of absolute encoder that will send the position at power up via pulses. So, if you were at position 5000, when the power went out, the encoder will actually send 5000 pulses at the next power up. This type of absolute encoder will actually work with a high speed counter and does not require a special interface.

Share this post


Link to post
Share on other sites
Thanks again for the direction guys. Yes I am aware of the possible movement when the power is off. That isn't an issue for my specific application.

Share this post


Link to post
Share on other sites
Mendon and Sergei are not just referring to movement when the power is off, but also the case when the encoder is moving at the moment that the power is turned off. Due to the delay of the program execution and the momentum of the movement, the count would not be accurate when the power is turned back on.

Share this post


Link to post
Share on other sites
The only way the above example will work without special encoder is for the shaft to be dead stopped when the power goes off.

Share this post


Link to post
Share on other sites
Or PLC powered by an UPS. http://www.ab.com/en/epub/catalogs/12768/229240/1151309/3720962/11635099/print.html

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