Sign in to follow this  
Followers 0
Andy_P

Reset high speed counter in CP1L

6 posts in this topic

I want to reset the PV of a high speed counter (which is configured for diff-pase, software reset) in a CP1L when an interrupt task is executed. First of all I tried turning on the HSC reset bit, but since the interrupt task only runs for one cycle, the bit does not go off again, and hence, no further resets take place. I have since used the PRV instruction to set the value to zero, and this seems to work ok. Is this the best way to do what I want, or does a 'better' way exist? (Maybe turn off the HSC reset bit in the main program perhaps?) Thanks for any opinions! Andy.

Share this post


Link to post
Share on other sites
If the HSC to be reset only in the interrupt and the encoder zero pulse not used- just connect physically the HSC reset input with the interrupt input and nothing to be done by the software (only the hardware reset enable bit to be always On). Edited by Sergei Troizky

Share this post


Link to post
Share on other sites
I am unable to do that because the input is taken, and I can only reset the HSC in software. Thank you for the suggestion though. Andy.

Share this post


Link to post
Share on other sites
Well, then I would reset the bit in the cyclic task, if the interrupt cannot appear more often than once per scan. Otherwise reset it in a fast enough timer interrupt. Edited by Sergei Troizky

Share this post


Link to post
Share on other sites
I reset a CJ1M HSC using INI, I just preset the count to 0. This is done in an interrupt and works fine.

Share this post


Link to post
Share on other sites
Cheers, the INI method works well. Thanks, Andy.

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