I am using the PIC12F509. Its FSR register is only 5 bits. My data bytes start at 0x07 and go to 0x16 (in this example). As I cycle through the data, I increment FSR and need to know when it reaches 0x16.
I can do it like this:
But going at it bit wise is cumbersom. So, I tried:
The second method doesn't work at all. Its designed advantage is that I can simply make the xorwf with the last register location I want loaded and not have to go at it bit by bit as in the first method.
What is wrong with the second method? Is there another alternative that would allow me to do the same thing?
Thanks,
John
I can do it like this:
Code:
btfss fsr,4
goto Byte_plus ;a sequence that increments FSR and loads next data byte
btfss fsr,2
goto Byte_plus
btfss fsr,1
goto Byte_plus
call delays ; sets a flash rate
goto set_FSR ;starts data loading again
But going at it bit wise is cumbersom. So, I tried:
Code:
bcf status,z
movlw b'10110'
xorwf fsr,w
btfss status,z ;looking for zero
goto Byte_plus
call delays
goto set_FSR
The second method doesn't work at all. Its designed advantage is that I can simply make the xorwf with the last register location I want loaded and not have to go at it bit by bit as in the first method.
What is wrong with the second method? Is there another alternative that would allow me to do the same thing?
Thanks,
John