These lines checks for 1024 passes through the loop and stops if reached.
andlw 0x04 ; Are we done? (We're done when bit2 of
btfsc STATUS,Z ; the high order byte overflows to 1).
All you need to do is change ....
andlw 0x04
..... to .......
andlw 0x02 for 512(9 bits)
andlw 0x08 for 2048(11 bits)
andlw 0x10 for 4096(12 bits)
andlw 0x20 for 8192(13 bits)
andlw 0x40 for 16384(14 bits)
andlw 0x80 for 32768(15 bits)
If you need better resolution it can be done, but needs more changing in the code.
/Ingvar




Bookmarks