Hey all!
First of all, search is super slow when trying to find previous relevant posts. Any reason why? I had this forum site hang up on me a couple of times trying to search for pulse count stuff to see this topic has been brought up before.
Anyways, to the question. I see the Pulse Count module resets back to zero once you exceed either the high or low limit. I would like to vale to not exceed, nor reset to zero, when a limit is reached. For instance, if my high limit is 100, when I turn my rotary encoder in a positive direction, the value will increase up to 100 and will stay there for any more positive direction movement. The moment I go in a negative direction, it would immediately come down from the 100 value. And the same behavior for the low limit.
If I could find where in the code that the value updates and count reset when exceeding the limit takes place, I know I could easily put the code I need in to achieve this. A simple rather than reset the count value when exceeding, break before a count value update. I've searched through the source files and I can't seem to find out exactly where that is though. Does anyone have any pointers, no pun intended, on where this takes place? Also, I'm new to ISR's so it's possible I'm overlooking it since I don't know what I don't know when it comes to its operation, at least with how I believe the ISR is working here.
Disable overflow in Pulse Count with limits
-
- Posts: 1708
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: Disable overflow in Pulse Count with limits
Yep, the search definitely has a problem.
You can easily implement this in your application. You could, for example, register watchpoints at 1 and -1. When a watchpoint is hit, you'll receive an event. In the event handler, you examine your last stored value and add +1 or -1 if it's still within limits, else you don't change the stored value. Then reset the counter's value to 0 and wait for the next event.I see the Pulse Count module resets back to zero once you exceed either the high or low limit. I would like to vale to not exceed, nor reset to zero, when a limit is reached. For instance, if my high limit is 100, when I turn my rotary encoder in a positive direction, the value will increase up to 100 and will stay there for any more positive direction movement. The moment I go in a negative direction, it would immediately come down from the 100 value. And the same behavior for the low limit.
Re: Disable overflow in Pulse Count with limits
My bad on the delay. Life happened and I had to step away from my project for a bit.
Thanks for the idea offer MicroController. I had something similar in mind but was hoping I could manipulate some of the lower level code to make it easier for my application. I guess I'll poke around a little longer to see if I can sort out where the actual PCNT ISR is and hopefully backtrack from there.
Thanks for the idea offer MicroController. I had something similar in mind but was hoping I could manipulate some of the lower level code to make it easier for my application. I guess I'll poke around a little longer to see if I can sort out where the actual PCNT ISR is and hopefully backtrack from there.
Who is online
Users browsing this forum: No registered users and 118 guests