Hi!
1.
You are using the wrong interrupt.
Four of PORTB’s pins, RB<7:4>, have an interrupt-onchange feature.
Use two of these pins for the A/B encoder signals.
2.
Use assembly code for the interrupt.
(See PicBasic Pro manual).
3.
In your code the variables "new" and "old" will have
most of the time the same values.
In your code you are doing that:
new= PORTB & %00000011 'get encoder A/B
old=new & %00000011 'old is now same as new
new= PORTB & %00000011 'get encoder A/B again
When you get A/B again, it is very likely that the encoder is
still in the same position, therefore the variables new and old
will have the same values.
* * * *
Did you try the code I posted the 12th April 2005, 11:00?
Does it work if you turn the encoder slowly?
Luciano
Bookmarks