Thanks Darrel,
That explains it for sure - but it kind of sucks.... :-/
Basically, the Position and the Setpoint variables are the only longs and the reason for PBPL.
The setpoint is calculated by adding or subtracting the number of steps that has arrived since the last servoloop. For the position I get the lower 16bits from the hardware QEI counter and the upper 16bits by keeping track of the number of over/underflows with the RollOver ISR.
Man, I'm painting myself into a corner here....
BTW, how come these two...
Code:
ByteVar1 = ByteVar1 + (ByteVar2 >> 2) ; <-- Long
ByteVar1 = ByteVar1 + (ByteVar2 >> 1) ; <-- Byte
...are treated different?
Thanks for all the help, I appreciate it!
/Henrik.
Bookmarks