PeripheralsIP2022 Users Manual
240
www.ubicom.com
outputs. On reads, the RxOUT registers return the data previously
written to the data output buffer registers, which might not
correspond to the states actually present on pins configured as
inputs or pins forced to another state by an external device.
4.1.5
RxDIR Register
The RxDIR registers select the direction of the port pins. For each
output port pin, clear the corresponding RxDIR bit. For each input
port pin, set the corresponding RxDIR bit. Unused pins that are left
open-circuit should be configured as outputs, to keep them from
floating.
For example, to configure Port A pins RA3 and RA2 as outputs
and RA1 and RA0 as inputs, the following code could be used:
The second move instruction in this example writes the RADIR
register, located at address 0x022. Because Port A has only four
I/O pins, only the four least significant bits of this register are used.
mov
w,#0x03
;load W with the value 03h
;(bits 3:2 low, and bits 1:0
;high)
mov
0x022,w
;write 03h to RADIR
;register