PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Dec 27, 2004 12:50 pm |
|
|
To fix that routine, you need to move "data" into the W register,
and then mask it down so that only bit 0 is valid. See the two
lines that I've added right above the "return" statement at the end.
Code: | int8 find_parity(int8 data)
{
#asm
swapf data, W
xorwf data, F
rrf data, W
xorwf data, F
btfsc data, 2
incf data, F
movf data, W
andlw 1
movwf _return_
#endasm
}
|
|
|