12.07.2015 Views

PIC18F to PIC24F Migration: An Overview - Microchip

PIC18F to PIC24F Migration: An Overview - Microchip

PIC18F to PIC24F Migration: An Overview - Microchip

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>PIC24F</strong> PERIPHERAL SETI/O Ports<strong>PIC24F</strong> ports are very similar <strong>to</strong> <strong>PIC18F</strong> but have noteworthydifferences. Both devices have data PORT, LATand TRIS registers. Both analog and digital peripheralsare multiplexed on<strong>to</strong> ports. Ports on the <strong>PIC24F</strong> featuremore pins on more ports that have configurableopen-drain and interrupt-on-change (CNx) inpu<strong>to</strong>ptions.TABLE 18:COMPARISON BETWEEN <strong>PIC18F</strong> AND <strong>PIC24F</strong> PORT FEATURESFeature Description <strong>PIC18F</strong> <strong>PIC24F</strong>Voltage Inputs Above VDD + 0.3V Permitted No Digital-only pinsPull-up Option PORTB (all pins) Multiple pins, individuallyselectableInterrupt-on-Change PORTB (3 pins) Multiple pins, individuallyselectableControl Registers PORTx, LATx and TRISx PORTx, LATx, TRISxand ODCxConfigured <strong>to</strong> Inputs on Reset Yes YesFor both architectures, pins configured as analoginputs are read as ‘0’ when the associated PORTx bitis read by the CPU and the output driver is disabled.This prevents shoot-through current in the port outputdriver.Reading the PORTx register will return the digitalrepresentation of the pin voltage. This value will reflectan override from either a peripheral or external pinvoltage.Peripherals with digital outputs require the TRISx bit <strong>to</strong>be cleared in software. While the peripheral is enabled,the pin output can be read with the PORTx register.Enabling the peripheral may affect the output’s slewrate and/or drive strength. Peripherals with the ability <strong>to</strong>tri-state the output will override the TRISx register,although the change will not affect the TRISx registervalue. Refer <strong>to</strong> the product data sheet for moreinformation on peripheral outputs.Bidirectional peripherals can override the port outputbut not the input. Setting the TRISx bit <strong>to</strong> ‘1’ allows theperipheral <strong>to</strong> control the data direction. Reading thePORTx register will provide the port levels. The outputmay be affected by the peripheral’s slew rate or drivestrength overrides.Reading the PORTx register will read the digital representationof the voltages on the pins. Reading the LATxregister, reads the latched output value. Writing thePORTx register or the LATx register will write the LATxregister.On all Resets, the TRISx bits are set, causing the ports<strong>to</strong> configure as inputs and, where possible, analoginputs. This minimizes the pin load on<strong>to</strong> the applicationand the potential for shoot-through current in the digitalport inputs.© 2006 <strong>Microchip</strong> Technology Inc. DS39764A-page 27

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!