Dmitry Kiryashov says:
You can't apply sb/snb operations to [the W register ]. You need to put W value to some temp location first and finally check temp with sb / snb commands. [ed: unless you have optionx_carryx (or optionx on the old parts) in your device directive and have the RTW bit 7 of the option register cleared, then register 1 becomes the W register rather than the RTCC. The RTCC continues to work, but can't be read untill that bit is set. This is specific to the SX line of processors]HINTS:
and W, #$80 ; will test bit .7 in W, other bits are cleared ;-) and W, #$40 ; test bit .6 ;...result of operation in Z flag (=0 means bit=1 otherwise bit=0 result to Z=1)
and W, #$xx is destructive command. You cannot restore W if you didn't save it before.
- 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.
xor W, #A_CONST snb Z jmp A_CONST_MATCH xor W, #B_CONST^A_CONST ;compare with B_CONST snb Z jmp B_CONST_MATCH xor W, #C_CONST^B_CONST ;compare with C_CONST ;.... xor W, #LAST_CONST ;last used const value -> restore initial W ;.....
file: /Techref/scenix/lib/math/bit/testbitsw_sx.htm, 1KB, , updated: 2004/6/10 14:40, local time: 2024/10/9 19:01,
44.200.94.150:LOG IN ©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!
|
©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://www.piclist.com/techref/scenix/lib/math/bit/testbitsw_sx.htm"> PIC Microcontroller Bit Math Method Testing bits in W</A> |
Did you find what you needed? |
PICList 2024 contributors:
o List host: MIT, Site host massmind.org, Top posters @none found - Page Editors: James Newton, David Cary, and YOU! * Roman Black of Black Robotics donates from sales of Linistep stepper controller kits. * Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters. * Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated! * Contributors: Richard Seriani, Sr. |
Welcome to www.piclist.com! |
.