Use the code in post#27, (new approch to rotary encoder) is more efficient and you can achieve even higher frequency.
Cheers
Al.
Use the code in post#27, (new approch to rotary encoder) is more efficient and you can achieve even higher frequency.
Cheers
Al.
Last edited by aratti; - 14th January 2012 at 16:45.
All progress began with an idea
Hi Al. I am using the #27 ISR.
The thing that I added was the check for the 4 counts before Q_Count variable is incremented or decremented.
Thats because the encoder I use produces 4 pulses on every step I turn the knob. Thanks Henrik for noting this.
Ioannis
The code was written to read quadrature count. Any rotary encoder with two channels will generate quadrature count.
Al.
All progress began with an idea
Yes that is correct. So the Q_count variable is incrementing by 4.
Ioannis
If this topic was previously mentioned, I apologize for not finding it.
I'm using a 16F877A with a 4 MHz crystal and two 22pf caps with a LED hooked up to portb.1 and the code from example 2 of DT_ints-14.bas on DTs site. I'm using a oscope to look at the timing of the LED flashes and they are occuring around 950msec apart.
My question is, is there a way to tune the oscillator or modify DT interrupts to get it closer to a true 1 second pulse time? I know it's not far off but I was trying to learn something and maybe make it more accurate at the same time. Your help would be appreciated.
Yes I did read the datasheet but I couldn't find anything like OSC tune that I've seen for the 12F683.
Hi,
When using multiple interrupt sources you can prioritize which Interrupt flags to check when vectored to ISR, still the results may not be deterministic every time. Say you are already servicing a lower priority interrupt (not Hardware but DT's scheme) a higher priority interrupt like your time tick occurs. Generally adding the rolling timer with the offset value does the trick however if you would like more precision then use the compare module on the PIC which resets the associated timer automatically and gives a rock solid time base.
Regards
Sougata
You need to fine tune the timer, not the OSC.
Here is an example
http://www.picbasic.co.uk/forum/show...3259#post23259
And here is another
http://www.picbasic.co.uk/forum/show...5912#post75912
And this will help with the calcs.
http://www.picbasic.co.uk/forum/cont....-PICMultiCalc
Dave
Always wear safety glasses while programming.
Bookmarks