pic32mx320f032h Microchip Technology Inc., pic32mx320f032h Datasheet - Page 74

no-image

pic32mx320f032h

Manufacturer Part Number
pic32mx320f032h
Description
64/100-pin General Purpose And Usb 32-bit Flash Microcontrollers
Manufacturer
Microchip Technology Inc.
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
pic32mx320f032h-40I/PT
Manufacturer:
Microchip Technology
Quantity:
10 000
Part Number:
pic32mx320f032h-40V/PT
Manufacturer:
Microchip Technology
Quantity:
10 000
Part Number:
pic32mx320f032hT-40I/PT
Manufacturer:
Microchip Technology
Quantity:
10 000
Part Number:
pic32mx320f032hT-40V/PT
Manufacturer:
Microchip Technology
Quantity:
10 000
PIC32MX3XX/4XX
12.1
All port pins have three registers (TRIS, LAT, and
PORT) that are directly associated with their operation.
TRIS is a data direction or tri-state control register that
determines whether a digital pin is an input or an out-
put. Setting a TRISx register bit = 1 configures the cor-
responding I/O pin as an input; setting a TRISx register
bit = 0 configures the corresponding I/O pin as an out-
put. All port I/O pins are defined as inputs after a device
Reset. Certain I/O pins are shared with analog
peripherals and default to analog inputs after a device
Reset.
PORT is a register used to read the current state of the
signal applied to the port I/O pins. Writing to a PORTx
register performs a write to the port’s latch, LATx regis-
ter, latching the data to the port’s I/O pins.
LAT is a register used to write data to the port I/O pins.
The LATx latch register holds the data written to either
the LATx or PORTx registers. Reading the LATx latch
register
corresponding port or latch register.
Not all port I/O pins are implemented on some devices,
therefore, the corresponding PORTx, LATx and TRISx
register bits will read as zeros.
12.1.1
Every I/O module register has a corresponding CLR
(clear), SET (set) and INV (invert) register designed to
provide fast atomic bit manipulations. As the name of
the register implies, a value written to a SET, CLR or
INV register effectively performs the implied operation,
but only on the corresponding base register and only
bits specified as ‘ 1 ’ are modified. Bits specified as ‘ 0 ’
are not modified.
Reading SET, CLR and INV registers returns undefined
values. To see the affects of a write operation to a SET,
CLR or INV register, the base register must be read.
To set PORTC bit 0, write to the LATSET register:
LATCSET = 0x0001;
To clear PORTC bit 0, write to the LATCLR register:
LATCCLR = 0x0001;
To toggle PORTC bit 0, write to the LATINV register:
LATCINV = 0x0001;
DS61143F - page 72
Note:
Parallel I/O (PIO) Ports
reads
CLR, SET AND INV REGISTERS
Using a PORTxINV register to toggle a bit
is recommended because the operation is
performed in hardware atomically, using
fewer instructions as compared to the tra-
ditional read-modify-write method shown
below:
PORTC ^= 0x0001;
the
last
value
written
to
Preliminary
the
12.1.2
Pins are configured as digital inputs by setting the cor-
responding TRIS register bits = 1 . When configured as
inputs, they are either TTL buffers or Schmitt Triggers.
Several digital pins share functionality with analog
inputs and default to the analog inputs at POR. Setting
the corresponding bit in the AD1PCFG register = 1
enables the pin as a digital pin.
Digital only pins are capable of input voltages up to
5.5V. Any pin that shares digital and analog
functionality is limited to voltages up to V
.
TABLE 12-1:
Note: Refer to Section 28.0 “Electrical Characteris-
12.1.3
Certain pins can be configured as analog inputs used
by the ADC and Comparator modules. Setting the cor-
responding bits in the AD1PCFG register = 0 enables
the pin as an analog input pin and must have the corre-
sponding TRIS bit set = 1 (input). If the TRIS bit is
cleared = 0 (output), the digital output level (V
V
ured as analog, its digital input is disabled and the cor-
responding PORTx register bit will read ‘ 0 ’. The
AD1PCFG Register has a default value of 0x0000;
therefore, all pins that share ANx functions are analog
(not digital) by default.
12.1.4
Pins are configured as digital outputs by setting the cor-
responding TRIS register bits = 0 . When configured as
digital outputs, these pins are CMOS drivers or can be
configured as open drain outputs by setting the corre-
sponding bits in the ODCx Open-Drain Configuration
register.
Digital output pin voltage is limited to V
12.1.5
Certain pins can be configured as analog outputs, such
as the CV
module. Configuring the Comparator Reference mod-
ule to provide this output will present the analog output
voltage on the pin, independent of the TRIS register
setting for the corresponding pin.
OL
Note:
Input Pin Mode(s)
) will be converted. Any time a port I/O pin is config-
Digital + Analog
tics” regarding the V
Digital Only
Analog
REF
DIGITAL INPUTS
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.
ANALOG INPUTS
DIGITAL OUTPUTS
ANALOG OUTPUTS
output voltage used by the comparator
MAXIMUM INPUT PIN
VOLTAGES
© 2009 Microchip Technology Inc.
IH
specification.
V
V
IH
IH
V
= V
= V
V
IH =
IH
DD
DD +
DD +
(max)
DD +
5.5v
.
0.03v
0.03v
0.3V.
OH
or

Related parts for pic32mx320f032h