Previous page Table of contents Next page
General Purpose Input/Output Port:
Peripheral multiplexing
on-line
 

On a PIC24F architecture, many pins support one or more peripheral modules. When configured to operate with a peripheral, a pin may not be used as a general purpose input or output. In most of the cases, a pin must still be configured as an input or output by writing the TRISx register, although some of the peripheral overwrite the TRISx configuration.

For some PIC24F devices, you will find that more than one peripheral may be multiplexed on the same I/O. In this case, only one peripheral module can use the pin, and the priority is coming from order of the pin description. For example, the description of the pin number 35 of a PIC24FJ128GA006 device is U1RTS/BCLK1/SCK1/INT0/RF6, meaning that the UART1 Request to Send Output functionality is having the highest priority, followed by the UART1 IrDA® Baud Clock, SPI1 Serial Clock Output, External Interrupt Input 0, and PORTF Digital I/O functionality with lowest priority.

If an I/O pin has an A/D function multiplexed with a digital I/O function, in order to use the pin as a digital I/O, the corresponding bits in the AD1PCFG register must be set to ‘1’, even if the A/D module is turned off.

PIC24F IO Shared Peripheral Port Structure

Multiplexing Digital Input Peripheral:

The peripherals does not control the TRISx register, therefore the USER should maintain the TRISx bits for input.

The data input path to the PORTx register is unaffected. If the software is reading the corresponding PORTx bit while a digital input is used by a peripheral module, the value of the pin will be read.

The data path to the peripheral module is independent of the data path to the PORTx register. A special input buffer is placed on the peripheral data path.

Multiplexing Digital Output Peripheral:

The software needs to configure the pin as an output by clearing the associated TRISx bits.

The peripheral module controls the output data; a write to the PORTx register has no effect on the state of pin. Reading from the PORTx register, still returns the pin state.

The pad output driver type is selected by the peripheral module. If the output has an automatic tri-state feature (PWM outputs for example), the peripheral has the ability to tri-state the pin.

Multiplexing Digital Bidirectional Peripheral:

Peripheral can automatically configure the pin as an output, but not as an input. User needs to configure the pin as an input by setting the associated TRISx bit.

Peripherals control output data and writing to the PORTx register has no effect on the pin state; PORTx register can read pin value.

Pad output driver type could be affected by peripheral.

Multiplexing Analog Input Peripheral:

All digital port input buffers are disabled and PORTx registers read ‘0’ to prevent crowbar current.

Multiplexing Analog Output Peripheral:

All digital port input buffers are disabled and PORTx registers read ‘0’ to prevent crowbar current.

Analog output is driven onto the pin independent of the associated TRISx setting.

Software Input Pin Control:

Some of the functions assigned to an I/O pin may be input functions that do not take control of the pin output driver. In this case, if the associated I/O pin is configured as an output, using the appropriate TRISx control bit, the user can manually affect the state of the input function assigned to the pin through its corresponding PORTx bit. This behavior can be useful for testing purposes, when the external signal connected to the input pin can be emulated by writing the corresponding PORTx bit.

In general, the following peripherals allow their input pins to be controlled manually through the PORTx registers:

  • External Interrupt pins;
  • Timer Clock Input pins;
  • Input Capture pins;
  • PWM Fault pins;

Previous page Table of contents Next page
 

© Copyright 2008 - 2009 pic24micro.com All Rights Reserved.