
Instruction Set
4-252
XOR
XOR
Examples
This example turns on Timer 2 by setting the Enable (EN) and Inhibit (INH) bits in the
Timer 2 Mode and Control (T2CON) register.
This example procedure turns an LED on or off by toggling the signal level of programmable
I/O (PIO) pin 3 in the PIO Data 0 (PDATA0) register.
Tips
To clear a register to 0, use XOR to exclusive OR the register with itself.
Related Instructions
If you want to
See
Clear particular bits of a component to 0
AND
Toggle all bits of a component
NOT
Set particular bits of a component to 1
OR
TMR2_CNT_ON
EQU
0C000h
; mask for enable & inhibit bits
; turn on Timer 2
MOV
DX,TMR2_CTL_ADDR
; address of T2CON register
IN
AX,DX
; read T2CON into AX
XOR
AX,TMR2_CTL_ON
; set enable & inhibit bits
OUT
DX,AX
; write AX to T2CON
PIO3_MASK
EQU
0008h
; PDATA0 bit 3
; toggle PDATA0 bit 3
TOGGLE_PIO3
PROC
NEAR
; save registers
PUSH
AX
PUSH
DX
MOV
DX,PIO_DATA0_ADDR
; address of PDATA0 register
IN
AX,DX
; read PDATA0 into AX
XOR
AX,PIO3_MASK
; toggle bit 3
OUT
DX,AX
; write AX to PDATA0
; restore saved registers
POP
DX
POP
AX
RET
TOGGLE_PIO3
ENDP
Summary of Contents for Am186 Series
Page 1: ...Am186 and Am188 Family Instruction Set Manual February 1997...
Page 10: ...Table of Contents x...
Page 18: ...Programming 1 8...
Page 40: ...Instruction Set Listing 3 14...