Instruction Set
3-27
RISC 16-Bit CPU
BIT[.W]
Test bits in destination
BIT.B
Test bits in destination
Syntax
BIT
src,dst or BIT.W
src,dst
Operation
src .AND. dst
Description
The source and destination operands are logically ANDed. The result affects
only the status bits. The source and destination operands are not affected.
Status Bits
N: Set if MSB of result is set, reset otherwise
Z: Set if result is zero, reset otherwise
C: Set if result is not zero, reset otherwise (.NOT. Zero)
V: Reset
Mode Bits
OSCOFF, CPUOFF, and GIE are not affected.
Example
If bit 9 of R8 is set, a branch is taken to label TOM.
BIT
#0200h,R8
; bit 9 of R8 set?
JNZ
TOM
; Yes, branch to TOM
...
; No, proceed
Example
If bit 3 of R8 is set, a branch is taken to label TOM.
BIT.B
#8,R8
JC
TOM
Example
A serial communication receive bit (RCV) is tested. Because the carry bit is
equal to the state of the tested bit while using the BIT instruction to test a single
bit, the carry bit is used by the subsequent instruction; the read information is
shifted into register RECBUF.
;
; Serial communication with LSB is shifted first:
; xxxx
xxxx
xxxx
xxxx
BIT.B
#RCV,RCCTL
; Bit info into carry
RRC
RECBUF
; Carry −> MSB of RECBUF
; cxxx xxxx
......
; repeat previous two instructions
......
; 8 times
; cccc cccc
; ^
^
; MSB
LSB
; Serial communication with MSB shifted first:
BIT.B
#RCV,RCCTL
; Bit info into carry
RLC.B
RECBUF
; Carry −> LSB of RECBUF
; xxxx
xxxc
......
; repeat previous two instructions
......
; 8 times
; cccc
cccc
; |
LSB
; MSB
Содержание MSP430x4xx Family
Страница 1: ...MSP430x4xx Family 2007 Mixed Signal Products User s Guide SLAU056G ...
Страница 2: ......
Страница 6: ...vi ...
Страница 114: ...3 76 RISC 16 Bit CPU ...
Страница 304: ...5 20 FLL Clock Module ...
Страница 340: ...7 8 Supply Voltage Supervisor ...
Страница 348: ...8 8 16 Bit Hardware Multiplier ...
Страница 372: ...9 24 32 Bit Hardware Multiplier ...
Страница 400: ...10 28 DMA Controller ...
Страница 428: ...13 10 Basic Timer1 ...
Страница 466: ...15 24 Timer_A ...
Страница 522: ...17 30 USART Peripheral Interface UART Mode ...
Страница 544: ...18 22 USART Peripheral Interface SPI Mode ...
Страница 672: ...23 12 Comparator_A ...
Страница 692: ...24 20 LCD Controller ...
Страница 746: ...26 28 ADC12 ...