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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

BIT AND CONTROL FUNCTION MAPPINGThere is not a precise one-<strong>to</strong>-one correspondencebetween configuration and control functions of the<strong>PIC18F</strong> and <strong>PIC24F</strong> architectures. The most commondifferences are shown in Table 15. Details arediscussed later in this section.TABLE 15:COMPARISON OF OSCILLATOR BIT AND CONTROL FUNCTION MAPPINGOscilla<strong>to</strong>r Block Function <strong>PIC18F</strong> <strong>PIC24F</strong>Define Start-up Oscilla<strong>to</strong>rDefine Primary Oscilla<strong>to</strong>r TypeDefine I/O Port Functions in EC Oscilla<strong>to</strong>rModesFOSC3:FOSC0(CONFIG1H) (1)FNOSC2:FNOSC0(Configuration Word 2)POSCMD1:POSCMD0(Configuration Word 2)OSCIOFCN(Configuration Word 2)Enable Secondary Oscilla<strong>to</strong>r T1OSCEN (T1CON) SOSCEN (OSCCON)Select INTOSC/FRC Postscaler IRCF2:IRCF0 (OSCCON) RCDIV2:RCDIV0 (CLKDIV)Switch Run-Time Clock SourceSCS1:SCS0 (OSCCON)NOSC2:NOSC0, OSWEN(OSCCON), FCKSM0(Configuration Word 2)Active Clock Source Moni<strong>to</strong>ring OSTS, IOFS, T1RUN COSC2:COSC0Enable Two-Speed Start-up IESO (CONFIG1H) IESO (Configuration Word 2)Enable Fail-Safe Clock Moni<strong>to</strong>rFCKSM1:FCKSM0FCMEN (CONFIG1H)(Configuration Word 2)Note 1: <strong>PIC18F</strong>XXXX devices only; FOSC2:FOSC0 (CONFIG2H) on current <strong>PIC18F</strong>XXJ Flash devices.PRIMARY OSCILLATORS (POSC)<strong>PIC18F</strong> microcontrollers, with the latest versions ofnanoWatt Technology, use an oscilla<strong>to</strong>r circuit that supportsa wide range of external components, including avariety of crystals, RC networks or external clock genera<strong>to</strong>rs.To use the oscilla<strong>to</strong>r, users connect their crystal orRC circuit <strong>to</strong> the OSC1 and OSC2 pins, or present theexternal clock on OSC1. The exact oscilla<strong>to</strong>r mode <strong>to</strong> beused is selected during device configuration using theFOSC3:FOSC0 Configuration bits, and must match theactual external circuit <strong>to</strong> be used.<strong>PIC24F</strong> microcontrollers support a similar range ofoscilla<strong>to</strong>r options on the OSC1 and OSC2 pins;however, the options for support of low-power,low-frequency crystals and external RC resonantcircuits have been omitted. These have been replacedby the use of a high-speed internal RC oscilla<strong>to</strong>r, andthe use of the Timer1 oscilla<strong>to</strong>r in the more flexibleclock structure.The primary oscilla<strong>to</strong>r mode is selected during configurationwith a combination of the FNOSC2:FNOSC0 andPOSCMD Configuration bits. Like <strong>PIC18F</strong>devices, the configuration must match the externalcircuit <strong>to</strong> be used in the application.SECONDARY OSCILLATOR (SOSC)All <strong>PIC18F</strong> devices have the option <strong>to</strong> use the Timer1oscilla<strong>to</strong>r as a secondary clock source. The mosttypical arrangement for this option is <strong>to</strong> connect alow-power, 32 kHz watch crystal across pins T1OSIand T1OSO. The oscilla<strong>to</strong>r is controlled separatelyfrom the device clock controls with the T1OSCEN bit(T1CON).<strong>PIC24F</strong> devices also provide a secondary oscilla<strong>to</strong>rthat is identical in function <strong>to</strong> the Timer1 oscilla<strong>to</strong>r; i<strong>to</strong>nly differs in that it is controlled through the OSCCONregister with the SOSCEN bit. The crystal input/outputpins are renamed SOSCI and SOSCO.The <strong>PIC24F</strong> secondary oscilla<strong>to</strong>r takes the place of thePrimary LP Oscilla<strong>to</strong>r mode provided on <strong>PIC18F</strong>devices, but not supported on <strong>PIC24F</strong>. To use SOSC asthe default oscilla<strong>to</strong>r on start-up, it must by selected indevice configuration by the FNOSC2:FNOSC0 bits andenabled in software by setting the SOSCEN bit.DS39764A-page 20© 2006 <strong>Microchip</strong> Technology Inc.

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

Saved successfully!

Ooh no, something went wrong!