dsPIC30F2011/2012/3012/3013
7.2
Configuring Analog Port Pins
7.2.1
I/O PORT WRITE/READ TIMING
The use of the ADPCFG and TRIS registers control the
operation of the A/D port pins. The port pins that are
desired as analog inputs must have their correspond-
ing TRIS bit set (input). If the TRIS bit is cleared
(output), the digital output level (V
OH
or V
OL
) will be
converted.
When reading the Port register, all pins configured as
analog input channels will read as cleared (a low level).
Pins configured as digital inputs will not convert an ana-
log input. Analog levels on any pin that is defined as a
digital input (including the ANx pins) may cause the
input buffer to consume current that exceeds the
device specifications.
One instruction cycle is required between a port
direction change or port write operation and a read
operation of the same port. Typically this instruction
would be a
NOP.
EXAMPLE 7-1:
#0xF0, W0;
;
MOV W0, TRISB;
NOP
;
btss PORTB, #7;
MOV
PORT WRITE/READ
EXAMPLE
Configure PORTB<7:4>
as inputs
and PORTB<3:0> as outputs
additional instruction cycle
bit test RB7 and skip if set
DS70139C-page 58
Preliminary
漏
2005 Microchip Technology Inc.