PDA

View Full Version : 32 bit addition



ice
- 16th May 2005, 11:23
Hello..
i would like to increment a 32 bit variable with ticks from a quadrature encoder.

I understand that PBP whorks with 8 bit variables..

Following is a code snip for incrementing a 16bit variable


;Increments _enc_counter (16 bit value), sets Z on exit.

incfsz _enc_counter,W ; Add one to low byte
decf _enc_counter+1,F ; No carry (negates next step)
incf _enc_counter+1,F ; Add one to high byte
movwf _enc_counter ; Store updated low byte back.
iorwf _enc_counter+1,W ; Set Z flag


how would it be implemented for 32 bits?..
i also need to display the 32 bit values on an LCD..

Thank you