bsf PORTA,4 btfss STATUS,C bcf PORTA,4
ie: Assume the bit is one, then change to 0 if it is not. A C/C++ macro for Hitech C is available
Saves 1 instruction over the more standard:
btfsc STATUS,C ; load the data bsf PORTA,4 btfss STATUS,C bcf PORTA,4
This macro...
COPY_BIT MACRO var_A,bit_N,var_B,bit_M NOEXPAND btfsc var_A,bit_N bsf var_B,bit_M btfss var_A,bit_N bcf var_B,bit_M ENDM remember to define the dummy macro variables: var_A equ 0 bit_N equ 0
...will produce the same output if called like this:
COPY_BIT STATUS,C,PORTA,4
but can be used on any current bank registers.
file: /Techref/scenix/lib/math/bit/cuabrr.htm, 1KB, , updated: 2004/6/10 14:40, local time: 2024/9/17 18:19,
13.58.210.142: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://piclist.com/Techref/scenix/lib/math/bit/cuabrr.htm"> PIC Microcontroller Bit Math Method Copy unaligned bits from one register to another:</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 piclist.com! |
.