Dmitry Kiryashov says:
You can't apply btfss/btfsc operations to [the W register]. You need to put W value to some temp location first and finally check temp with btfss/btfsc commands.HINTS:
ANDLW 0x80 ; will test bit .7 in W, other bits are cleared ;-) ANDLW 0x40 ; test bit .6 ;...result of operation in _Z flag (=0 means bit=1 otherwise bit=0 result to _Z=1)
ANDLW is destructive command. You cannot restore W if you didn't save it before.
ADDLW 0x88 ; will test bits .7 and .3results of operation in _C and _DC flags. To restore initial W just ADDLW -0x88 ;-)
- You can also apply XORLW value command to check identity W to some value. It is useful command (sometimes) 'cause you can do comparison for alot of values and restore W after that to initial value.
XORLW A_CONST SKPNZ GOTO A_CONST_MATCH XORLW B_CONST^A_CONST ;compare with B_CONST SKPNZ GOTO B_CONST_MATCH XORLW C_CONST^B_CONST ;compare with C_CONST ;.... XORLW LAST_CONST ;last used const value -> restore initial W ;.....
file: /Techref/scenix/lib/math/bit/testbitsw.htm, 1KB, , updated: 2004/6/10 13:40, local time: 2024/11/27 09:32,
3.145.7.253:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://techref.massmind.org/Techref/scenix/lib/math/bit/testbitsw.htm"> PIC Microcontroller Bit Math Method Testing bits in W</A> |
Did you find what you needed? |
Welcome to massmind.org! |
Welcome to techref.massmind.org! |
.