PIC18F26K22-I/SO Microchip Technology, PIC18F26K22-I/SO Datasheet

IC PIC MCU 64KB FLASH 28SOIC

PIC18F26K22-I/SO

Manufacturer Part Number
PIC18F26K22-I/SO
Description
IC PIC MCU 64KB FLASH 28SOIC
Manufacturer
Microchip Technology
Series
PIC® XLP™ 18Fr

Specifications of PIC18F26K22-I/SO

Core Size
8-Bit
Program Memory Size
64KB (32K x 16)
Core Processor
PIC
Speed
64MHz
Connectivity
I²C, SPI, UART/USART
Peripherals
Brown-out Detect/Reset, HLVD, POR, PWM, WDT
Number Of I /o
24
Program Memory Type
FLASH
Eeprom Size
1K x 8
Ram Size
3.8K x 8
Voltage - Supply (vcc/vdd)
1.8 V ~ 5.5 V
Data Converters
A/D 19x10b
Oscillator Type
Internal
Operating Temperature
-40°C ~ 85°C
Package / Case
28-SOIC (0.300", 7.50mm Width)
Controller Family/series
PIC18
No. Of I/o's
25
Eeprom Memory Size
1KB
Ram Memory Size
3896Byte
Cpu Speed
64MHz
No. Of Timers
7
Processor Series
PIC18F
Core
PIC
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
Lead Free Status / RoHS Status
Lead free / RoHS Compliant

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
PIC18F26K22-I/SO
Manufacturer:
NXP
Quantity:
928
Part Number:
PIC18F26K22-I/SO
Manufacturer:
MICROCHIP/微芯
Quantity:
20 000
PIC18(L)F2X/4XK22
Data Sheet
28/40/44-Pin, Low-Power,
High-Performance Microcontrollers
with nanoWatt XLP Technology
Preliminary
 2010 Microchip Technology Inc.
DS41412A

Related parts for PIC18F26K22-I/SO

PIC18F26K22-I/SO Summary of contents

Page 1

... High-Performance Microcontrollers  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 28/40/44-Pin, Low-Power, with nanoWatt XLP Technology Preliminary Data Sheet DS41412A ...

Page 2

... REAL ICE, rfLAB, Select Mode, Total Endurance, TSHARC, UniWinDriver, WiperLock and ZENA are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. SQTP is a service mark of Microchip Technology Incorporated in the U.S.A. All other trademarks mentioned herein are property of their respective companies. ...

Page 3

... DAC with positive and negative reference selection • Charge Time Measurement Unit (CTMU) module: - Supports capacitive touch sensing for touch screens and capacitive switches  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 Extreme Low-Power Management with nanoWatt XLP: • Sleep mode: 100 nA, typical • ...

Page 4

... PIC18(L)F44K22 16K 8192 768 PIC18(L)F45K22 32K 16384 1536 PIC18(L)F46K22 64k 32768 3896 Note 1: One pin is input only. 2: Channel count includes internal FVR and DAC channels. DS41412A-page 4 MSSP 256 256 256 1024 256 256 256 1024 Preliminary  2010 Microchip Technology Inc. ...

Page 5

... Pin Diagrams 28-pin PDIP, SOIC, SSOP MCLR/V PP (1) 28-pin QFN, UQFN RA2 RA3 RA4 RA5/ V RA7 RA6 Note 1: The 28-pin UQFN package is available only for PIC18(L)F23K22 and PIC18(L)F24K22.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 28 1 /RE3 2 27 RA0 26 3 RA1 4 25 RA2 5 ...

Page 6

... RA7 13 28 RA6 14 27 RC0 15 26 RC1 16 25 RC2 17 24 RC3 18 23 RD0 19 22 RD1 20 21 Preliminary RB7 RB6/ RB5 RB4 RB3 RB2 RB1 RB0 RD7 RD6 RD5 RD4 RC7 RC6 RC5 RC4 RD3 RD2  2010 Microchip Technology Inc. ...

Page 7

... Pin Diagrams (Cont.’d) 44-pin TQFP RC7 RD4 RD5 RD6 RD7 RB0 RB1 RB2 RB3 44-pin QFN RC7 RD4 RD5 RD6 RD7 RB0 RB1 RB2  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 RC0 2 32 RA6 RA7 PIC18(L)F4XK22 RE2 7 RE1 8 26 RE0 9 25 ...

Page 8

... SCL1 SDI1/ SDA1 SDO1 CCP3/ TX1/CK1 (4) P3A P3B RX1/DT1 Preliminary T0CKI OSC2/ CLKO OSC1/ CLKI INT0 Y INT1 Y INT2 Y Y T5G IOC Y T1G IOC Y (2) T3CKI IOC Y PGC IOC Y PGD SOSCO/ T1CKI (2) T3CKI T3G SOSCI T5CKI MCLR  2010 Microchip Technology Inc. ...

Page 9

... RE0 AN5 Note 1: CCP2 multiplexed in fuses. 2: T3CKI multiplexed in fuses. 3: Pins are enabled on -ICE derivative only, otherwise they are No Connects. 4: CCP3/P3A multiplexed in fuses. 5: P2B multiplexed in fuses.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 V - REF DACOUT V + REF SRQ SRNQ HLVDIN SRI FLT0 CTED1 ...

Page 10

... NC Note 1: CCP2 multiplexed in fuses. 2: T3CKI multiplexed in fuses. 3: Pins are enabled on -ICE derivative only, otherwise they are No Connects. 4: CCP3/P3A multiplexed in fuses. 5: P2B multiplexed in fuses. DS41412A-page 10 P3B CCP5 Preliminary  2010 Microchip Technology Inc. Y MCLR ...

Page 11

... Packaging Information............................................................................................................................................................. 465 Appendix A: Revision History............................................................................................................................................................ 479 Appendix B: Device Differences ....................................................................................................................................................... 479 Index ................................................................................................................................................................................................. 481 The Microchip Web Site .................................................................................................................................................................... 491 Customer Change Notification Service ............................................................................................................................................. 485 Customer Support ............................................................................................................................................................................. 485 Reader Response ............................................................................................................................................................................. 492 Product Identification System ........................................................................................................................................................... 493  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 Preliminary DS41412A-page 11 ...

Page 12

... When contacting a sales office or the literature center, please specify which device, revision of silicon and data sheet (include literature number) you are using. Customer Notification System Register on our web site at www.microchip.com/cn to receive the most current information on all of our products. DS41412A-page 12 Preliminary  2010 Microchip Technology Inc. ...

Page 13

... DEVICE OVERVIEW This document contains device specific information for the following devices: • PIC18F23K22 • PIC18LF23K22 • PIC18F24K22 • PIC18LF24K22 • PIC18F25K22 • PIC18LF25K22 • PIC18F26K22 • PIC18LF26K22 • PIC18F43K22 • PIC18LF43K22 • PIC18F44K22 • PIC18LF44K22 • PIC18F45K22 • PIC18LF45K22 • PIC18F46K22 • ...

Page 14

... All other features for devices in this family are identical. These are summarized in Table 1-1. The pinouts for all devices are listed in the pin summary tables: Table 1 and Table 2, and I/O description tables: Table 1-2 and Table 1-3. Preliminary  2010 Microchip Technology Inc. ...

Page 15

... TABLE 1-1: DEVICE FEATURES  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 Preliminary DS41412A-page 15 ...

Page 16

... Reset Timer Precision FVR Band Gap Reset Reference Timer1 Timer2 Timer3 Timer4 CTMU Timer5 Timer6 MSSP1 EUSART1 SR Latch MSSP2 EUSART2 Preliminary PORTA RA0:RA7 PORTB RB0:RB7 PORTC RC0:RC7 PORTD RD0:RD7 PORTE RE0:RE2 (1) RE3 DAC ADC FVR 10-bit  2010 Microchip Technology Inc. ...

Page 17

... Note 1: Default pin assignment for P2B, T3CKI, CCP3 and CCP2 when Configuration bits PB2MX, T3CMX, CCP3MX and CCP2MX are set. 2: Alternate pin assignment for P2B, T3CKI, CCP3 and CCP2 when Configuration bits PB2MX, T3CMX, CCP3MX and CCP2MX are clear.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 Pin Buffer ...

Page 18

... Analog Analog input 8. I/O TTL Digital I/ CTMU Edge 2 input. O CMOS Enhanced CCP2 PWM output. I/O ST Capture 2 input/Compare 2 output/PWM 2 output. O — SPI data out (MSSP2). I Analog Comparators C1 and C2 inverting input. I Analog Analog input 9. Preliminary  2010 Microchip Technology Inc. 2 C™ mode ...

Page 19

... Note 1: Default pin assignment for P2B, T3CKI, CCP3 and CCP2 when Configuration bits PB2MX, T3CMX, CCP3MX and CCP2MX are set. 2: Alternate pin assignment for P2B, T3CKI, CCP3 and CCP2 when Configuration bits PB2MX, T3CMX, CCP3MX and CCP2MX are clear.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 Pin Buffer ...

Page 20

... TTL Digital I/O. O CMOS Enhanced CCP3 PWM output EUSART 1 asynchronous receive. I/O ST EUSART 1 synchronous data (see related TXx/CKx). I Analog Analog input 19 Digital input. P Programming voltage input Active-Low Master Clear (device Reset) input. Preliminary  2010 Microchip Technology Inc. 2 C™ mode ...

Page 21

... Default pin assignment for P2B, T3CKI, CCP3/P3A and CCP2/P2A when Configuration bits PB2MX, T3CMX, CCP3MX and CCP2MX are set. 2: Alternate pin assignment for P2B, T3CKI, CCP3/P3A and CCP2/P2A when Configuration bits PB2MX, T3CMX, CCP3MX and CCP2MX are clear.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 Pin Buffer ...

Page 22

... I ST External interrupt CTMU Edge 1 input. I Analog Analog input 8. I/O TTL Digital I/ CTMU Edge 2 input. (2) O CMOS Enhanced CCP2 PWM output. (2) I/O ST Capture 2 input/Compare 2 output/PWM 2 output. I Analog Comparators C1 and C2 inverting input. I Analog Analog input 9. Preliminary Description  2010 Microchip Technology Inc. ...

Page 23

... Default pin assignment for P2B, T3CKI, CCP3/P3A and CCP2/P2A when Configuration bits PB2MX, T3CMX, CCP3MX and CCP2MX are set. 2: Alternate pin assignment for P2B, T3CKI, CCP3/P3A and CCP2/P2A when Configuration bits PB2MX, T3CMX, CCP3MX and CCP2MX are clear.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 Pin Buffer ...

Page 24

... Synchronous serial clock input/output for I mode (MSSP2). I Analog Analog input 20. I/O TTL Digital I/O. I/O ST Capture 4 input/Compare 4 output/PWM 4 output SPI data in (MSSP2 C™ data I/O (MSSP2). I Analog Analog input 21. Preliminary  2010 Microchip Technology Inc. Description 2 C™ 2 C™ ...

Page 25

... Default pin assignment for P2B, T3CKI, CCP3/P3A and CCP2/P2A when Configuration bits PB2MX, T3CMX, CCP3MX and CCP2MX are set. 2: Alternate pin assignment for P2B, T3CKI, CCP3/P3A and CCP2/P2A when Configuration bits PB2MX, T3CMX, CCP3MX and CCP2MX are clear.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 Pin Buffer ...

Page 26

... Capture 5 input/Compare 5 output/PWM 5 output I Analog Analog input Digital input. P Programming voltage input Active-low Master Clear (device Reset) input. P — Positive supply for logic and I/O pins — Ground reference for logic and I/O pins. SS Preliminary Description  2010 Microchip Technology Inc. ...

Page 27

... PLLEN (OSCTUNE<6>) 5. HFOFST (CONFIG3H<3>) 6. IRCF<2:0> (OSCCON<6:4>) 7. MFIOSEL (OSCCON2<4>) 8. INTSRC (OSCTUNE<7>)  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 The HFINTOSC, MFINTOSC and LFINTOSC are factory calibrated high, medium and low-frequency oscillators, respectively, which are used as the internal clock sources. /4) for OSC by the Preliminary ...

Page 28

... PLL Select (5) FOSC<3:0> Primary Oscillator 0 4xPLL INTOSC 1 INTSRC 3 3 HF HF-500 kH Z HF-250 kH Z INTOSC HF-31. MF-500 kH Z MF-250 kH Z MF-31. LF-31.25 kHz Preliminary Low-Power Mode Event Switch (SCS<1:0>) 2 Secondary Oscillator 01 (3) (4) Primary 0 Clock 00 1 INTOSC 1x  2010 Microchip Technology Inc. ...

Page 29

... On device Resets, the output frequency of the internal oscillator is set to the default frequency of 1 MHz.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 2.2.3 LOW FREQUENCY SELECTION When a nominal output frequency of 31.25 kHz is selected (IRCF< ...

Page 30

... FOSC (any source) OSC1/OSC2 (external source) INTOSC (internal source) INTOSC (internal source) DS41412A-page 30 FIGURE 2-3: FOSC<3:0> = 100x PLLCFG 3 PLLEN INTOSC FOSC<3:0> PLLCFG 0000-1111 0 0000-0111 1 1010-1111 0 1000-1001 x x Preliminary PLL SELECT BLOCK DIAGRAM PLL Select PLLEN PLL Select  2010 Microchip Technology Inc. ...

Page 31

... SECONDARY OSCILLATOR AND EXTERNAL CLOCK INPUTS SOSCEN EN SOSCI Secondary Oscillator SOSCO T1CKI T3G SOSCEN T3CKI SOSCEN SOSCEN T3CKI T1G T5CKI T5G  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 SOSCGO T1SOSCEN T3SOSCEN T5SOSCEN SOSCOUT T1CKI T1CKI T3G T3CKI 0 T3CKI 1 T3CMX T1G T5CKI T5CKI ...

Page 32

... INTOSC source may be determined by the INTSRC bit in OSCTUNE and the MFIOSEL bit in OSCCON2. 3: Default output frequency of HFINTOSC on Reset. DS41412A-page 32 R/W-1 R-q R-0 (1) OSTS HFIOFS U = Unimplemented bit, read as ‘0’ ‘0’ = Bit is cleared (2) (3) Preliminary R/W-0 R/W-0 SCS<1:0> bit depends on condition x = Bit is unknown  2010 Microchip Technology Inc. ...

Page 33

... MFIOFS: MFINTOSC Frequency Stable bit 1 = MFINTOSC is stable 0 = MFINTOSC is not stable bit 0 LFIOFS: LFINTOSC Frequency Stable bit 1 = LFINTOSC is stable 0 = LFINTOSC is not stable Note 1: The SOSCGO bit is only reset  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 R/W-0/0 R/W-0/u R/W-1/1 (1) MFIOSEL SOSCGO PRISD U = Unimplemented bit, read as ‘0’ ...

Page 34

... Section 1.0 “Device Overview”. Preliminary Oscillator Delay Oscillator Warm-Up Delay (T ) WARM 2 instruction cycles 1 cycle of each 1024 Clock Cycles (OST) 1024 Clock Cycles (OST s (approx.) EXTERNAL CLOCK (EC) MODE OPERATION OSC1/CLKIN ® PIC MCU (1) I/O OSC2/CLKOUT  2010 Microchip Technology Inc. ...

Page 35

... The value of R varies with the Oscillator mode F selected (typically between 2 M M.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 Note 1: Quartz crystal characteristics vary according to type, package and manufacturer. The user should consult the manufacturer data sheets for specifications and recommended application ...

Page 36

... Section 24.0 “Special Features of the CPU” for more information. The CLKOUT signal may be used to provide a clock for external circuitry, synchronization, calibration, test or other application requirements. ) values EXT Preliminary (High-Frequency Internal via software using the (Low-Frequency Internal general purpose I/O. See  2010 Microchip Technology Inc. ...

Page 37

... The PLLEN bit is active only when the HFINTOSC is the primary clock source (FOSC<2:0> = 100X) and the selected frequency is 8 MHz or 16 MHz (IRCF<2:0> = 11x). Otherwise, the PLLEN bit is unavailable and always reads ‘0’.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 as the Power-up Timer (PWRT), Watchdog Timer ...

Page 38

... If the measured time is much less than the calculated time, the internal oscillator block is running too slow; to compensate, increment the OSCTUNE register. Preliminary Compensating with the EUSART Compensating with the Timers Compensating with the CCP Module in Capture Mode  2010 Microchip Technology Inc. ...

Page 39

... MHz MHz. The PLL then multiplies the oscillator output frequency produce an internal clock frequency MHz. Oscillator frequencies below 4 MHz should not be used with the PLL.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 2.6.2 PLL IN HFINTOSC MODES The 4x frequency multiplier can be used with the ...

Page 40

... HFINTOSC is stable. When the HFOFST bit is set, the main system clock starts immediately. In either case, the HFIOFS bit of the OSCCON register can be read to determine whether the HFINTOSC is operating and stable. Preliminary , following POR, while CSD  2010 Microchip Technology Inc. ...

Page 41

... IRCF<2:0> bits of the OSCCON register. • When SCS<1:0> = 01, the system clock source is the 32.768 kHz secondary oscillator shared with Timer1, Timer3 and Timer5.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 OSC1 Pin At logic low (clock/4 output) Configured as PORTA, bit 6 ...

Page 42

... SCS<1:0> (of the OSCCON register) = 00. • FOSC<2:0> bits of the CONFIG1H Configuration register are configured for LP mode. Two-Speed Start-up mode becomes active after: • Power-on Reset (POR) and, if enabled, after Power-up Timer (PWRT) has expired, or • Wake-up from Sleep. Preliminary  2010 Microchip Technology Inc. ...

Page 43

... New Clock New Clk Ready IRCF <2:0> Select Old System Clock Note 1: Start-up time includes T OST  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 2.10.3 CHECKING TWO-SPEED CLOCK STATUS Checking the state of the OSTS bit of the OSCCON register will confirm if the microcontroller is running from the external clock source, as defined by the FOSC< ...

Page 44

... Safe clock monitoring in either HS, XT oscillator modes then the IESO config- uration bit should also be set so that the clock will automatically switch from the internal clock to the external oscillator when the OST times out. Preliminary switchover has successfully  2010 Microchip Technology Inc. ...

Page 45

... CONFIG1H IESO FCMEN PRICLKEN PLLCFG CONFIG2L — — CONFIG3H MCLRE — Legend: — = unimplemented locations, read as ‘0’. Shaded bits are not used for Clock Sources.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 Oscillator Failure Test Test Bit 5 Bit 4 Bit 3 TMR0IE INT0IE ...

Page 46

... PIC18(L)F2X/4XK22 NOTES: DS41412A-page 46 Preliminary  2010 Microchip Technology Inc. ...

Page 47

... Note 1: IDLEN reflects its value when the SLEEP instruction is executed. 2: Includes HFINTOSC and HFINTOSC postscaler, as well as the LFINTOSC source.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 3.1.1 CLOCK SOURCES The SCS<1:0> bits allow the selection of one of three clock sources for power-managed modes. They are: • ...

Page 48

... T If the IRCF bits were previously at a non-zero value INTSRC was set before setting SCS1 and the INTOSC source was already stable, then the HFIOFS or MFIOFS bit will remain set. Preliminary  2010 Microchip Technology Inc. INTOSC (MFINTOSC or . IOBST ...

Page 49

... These intervals are not shown to scale. OST OSC PLL 2: Clock transition typically occurs within 2-4 T TABLE 3-2: INTERNAL OSCILLATOR FREQUENCY STABILITY BITS IRCF<2:0> INTSRC 000 0 000 1 000 1 010 or 001 x 010 or 001 x  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 n-1 n (1) Clock Transition OSC (1) (1) OST ...

Page 50

... Peripheral Clock Program Counter SCS<1:0> bits Changed Note1 1024 (approx). These intervals are not shown to scale. OST OSC PLL 2: Clock transition typically occurs within 2-4 T DS41412A-page (1) PLL (1) OST n-1 n Clock (2) Transition PC OSTS bit Set . OSC Preliminary  2010 Microchip Technology Inc. ...

Page 51

... Clock Peripheral Clock Sleep Program PC Counter  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 3.4 Idle Modes The Idle modes allow the controller’s CPU to be selectively shut down while the peripherals continue to operate. Selecting a particular Idle mode allows users to further manage power consumption. ...

Page 52

... T3SOSCEN or T5SOSCEN) must be set when the SLEEP instruction is executed. Otherwise, the main system clock will con- tinue to operate in the previously selected mode and the corresponding IDLE mode will RC_IDLE Preliminary bits (SOSCGO, T1SOSCEN, be entered (i.e., PRI_IDLE or  2010 Microchip Technology Inc. ...

Page 53

... INTSRC or MFIOSEL bits are set, the HFINTOSC output is enabled. Either the HFIOFS or the MFIOFS bits become set, after the HFINTOSC output stabilizes after an interval For information on the IOBST HFIOFS and MFIOFS bits, see Table 3-2.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 T CSD PC Clocks to the HFINTOSC source stabilizes ...

Page 54

... INTOSCIO modes). However, a fixed delay of interval T following the wake event is still required CSD when leaving Sleep and Idle modes to allow the CPU to prepare for execution. Instruction execution resumes on the first clock cycle following this delay. Preliminary  2010 Microchip Technology Inc. (see Section 3.2 “Run ...

Page 55

... Section 3.4 “Idle Modes”). On Reset, HFINTOSC defaults to 1 MHz. 2: Includes both the HFINTOSC 16 MHz source and postscaler derived frequencies the Oscillator Start-up Timer. t OST 4: Execution continues during the HFINTOSC stabilization period, T  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 Clock Source Exit Delay after Wake-up LP, XT, HS HSPLL T CSD ...

Page 56

... R/W-0 R/W-0 R/W-0 TMR5MD TMR4MD TMR3MD U = Unimplemented bit, read as ‘0’ ‘0’ = Bit is cleared Preliminary reducing its power R/W-0 R/W-0 TMR2MD TMR1MD bit Bit is unknown  2010 Microchip Technology Inc. ...

Page 57

... Module is enabled, Clock Source is connected, module draws digital power bit 0 CCP1MD: CCP1 Peripheral Module Disable Control bit 1 = Module is disabled, Clock Source is disconnected, module does not draw digital power 0 = Module is enabled, Clock Source is connected, module draws digital power  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 R/W-0 R/W-0 R/W-0 ...

Page 58

... Module is disabled, Clock Source is disconnected, module does not draw digital power 0 = Module is enabled, Clock Source is connected, module draws digital power DS41412A-page 58 U-0 R/W-0 R/W-0 CTMUMD CMP2MD — Unimplemented bit, read as ‘0’ ‘0’ = Bit is cleared Preliminary  2010 Microchip Technology Inc. R/W-0 R/W-0 CMP1MD ADCMD bit Bit is unknown ...

Page 59

... LFINTOSC 11-bit Ripple Counter Note 1: See Table for time-out situations. 2: PWRT and OST counters are reset by POR and BOR. See Sections 4.3 and 4.4.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 A simplified block diagram of the On-Chip Reset Circuit is shown in Figure 4-1. 4.1 ...

Page 60

... It is recommended that the POR bit be set after a Power-on Reset has been detected so that subsequent Power-on Resets may be detected. DS41412A-page 60 R/W-1/q R-1/q R-1 Unimplemented bit, read as ‘0’ -n/n = Value at POR and BOR/Value at all other Resets q = depends on condition (1) (2) (3) Preliminary R/W-q/u R/W-0/q (2) POR BOR bit 0  2010 Microchip Technology Inc. ...

Page 61

... POR occurs; it does not change for any other Reset event. POR is not reset to ‘1’ by any hardware event. To capture multiple events, the user must manually set the bit to ‘1’ by software following any POR.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 FIGURE 4-2: V ...

Page 62

... Sleep. If the BOR is disabled, in software or by reentering Sleep before the FVR stabilizes, the BOR circuit will not sense a BOR condition. The FVRST bit of the VREFCON0 register can be used to determine FVR stability. Preliminary and operates as previously  2010 Microchip Technology Inc. ...

Page 63

... The OST time-out is invoked only for XT, LP and HS modes and only on Power-on Reset exit from all power-managed modes that stop the external oscillator.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 BOR Operation 4.5.3 PLL LOCK TIME-OUT ...

Page 64

... DS41412A-page 64 (2) Power-up and Brown-out PWRTEN = 1024 OSC OSC ( 1024 T 1024 T OSC OSC (1) — (1) — (1) — T PWRT T OST T PWRT Preliminary Exit from Power-Managed Mode (2) (2) 1024 OSC 1024 T OSC — — — RISE < PWRT ): CASE OST  2010 Microchip Technology Inc. ...

Page 65

... TIME-OUT SEQUENCE ON POWER-UP (MCLR NOT TIED MCLR INTERNAL POR PWRT TIME-OUT OST TIME-OUT INTERNAL RESET FIGURE 4-6: SLOW RISE TIME (MCLR TIED MCLR INTERNAL POR PWRT TIME-OUT OST TIME-OUT INTERNAL RESET  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 T PWRT RISE > PWRT T OST Preliminary ): CASE 2 ...

Page 66

... TIME-OUT SEQUENCE ON POR W/PLL ENABLED (MCLR TIED MCLR INTERNAL POR PWRT TIME-OUT OST TIME-OUT PLL TIME-OUT INTERNAL RESET Note 1024 clock cycles. OST  max. First three stages of the PWRT timer. T PLL DS41412A-page 66 T PWRT T OST T PLL Preliminary  2010 Microchip Technology Inc ...

Page 67

... STKPTR STKFUL STKUNF Legend: — = unimplemented locations, read as ‘0’. Shaded bits are not used for Resets.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 Table 5-2 describes the Reset states for all of the Special Function Registers. The table identifies differences between Power-On Reset (POR)/Brown- Out Reset (BOR) and all other Resets, (i ...

Page 68

... Legend: — = unimplemented locations, read as ‘0’. Shaded bits are not used for Resets. DS41412A-page 68 Bit 5 Bit 4 Bit 3 Bit 2 — BORV<1:0> BOREN<1:0> WDPS<3:0> P2BMX T3CMX HFOFST CCP3MX — — — LVP Preliminary Register Bit 1 Bit 0 on Page PWRTEN 354 WDTEN<1:0> 355 PBADEN CCP2MX 356 — STRVEN 357  2010 Microchip Technology Inc. ...

Page 69

... Additional detailed information on the operation of the Flash program memory is provided in Section 6.0 “Flash Program Memory”. Data EEPROM is discussed separately in Section 7.0 “Data EEPROM Memory”.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 5.1 Program Memory Organization PIC18 microcontrollers implement a 21-bit program counter, which is capable of addressing a 2-Mbyte program memory space ...

Page 70

... Top-of- Stack (TOS) Special File Registers. Data can also be pushed to, or popped from the stack, using these registers. Preliminary 0000h 0008h 0018h FFFFh 10000h 1FFFFFh 200000h  2010 Microchip Technology Inc. ...

Page 71

... STKFUL bit and reset the device. The STKFUL bit will remain set and the Stack Pointer will be set to zero.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 5.1.2.1 Top-of-Stack Access Only the top of the return address stack (TOS) is readable and writable ...

Page 72

... Example 5-1 shows a source code example that uses the fast register stack during a subroutine call and return. Preliminary R/W-0 R/W-0 bit Clearable only bit x = Bit is unknown  2010 Microchip Technology Inc. ...

Page 73

... RETLW nnh RETLW nnh . . .  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 5.1.4.2 Table Reads and Table Writes A better method of storing data in program memory allows two bytes of data to be stored in each instruction location. Look-up table data may be stored two bytes per program word by using table reads and writes. The ...

Page 74

... Q2, Q3 and Q4 cycles. Data memory is read during Q2 (operand read) and written during Q4 (destination write Execute INST (PC) Fetch INST ( Execute INST ( Execute 1 Fetch 2 Execute 2 Fetch 3 Execute 3 Fetch 4 Preliminary Internal Phase Clock Fetch INST ( Flush (NOP) Fetch SUB_1 Execute SUB_1  2010 Microchip Technology Inc. ...

Page 75

... TSTFSZ 1100 0001 0010 0011 MOVFF 1111 0100 0101 0110 0010 0100 0000 0000 ADDWF  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 The CALL and GOTO instructions have the absolute program memory instruction. Since instructions are always stored on word boundaries, the data contained in the instruction is a word address. The word address is written to PC< ...

Page 76

... This instruction ignores the BSR completely when it executes. All other instructions include only the low-order address as an operand and must use either the BSR or the Access Bank to locate their target registers. Preliminary  2010 Microchip Technology Inc. ...

Page 77

... FFh = 1100 00h Bank 12 FFh = 1101 00h Bank 13 FFh 00h = 1110 Bank 14 FFh 00h = 1111 Bank 15 FFh  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 Data Memory Map 000h Access RAM 05Fh 060h GPR 0FFh 100h GPR 1FFh 200h 2FFh 300h 3FFh 400h ...

Page 78

... Access RAM Low 5Fh 60h Access RAM High (SFRs) FFh also used by SFRs, but are not part of the Access RAM. Users must always use the complete address or load the proper BSR value to access these registers.  2010 Microchip Technology Inc. ...

Page 79

... FFh = 1100 00h Bank 12 FFh = 1101 00h Bank 13 FFh 00h = 1110 Bank 14 FFh 00h = 1111 Bank 15 FFh  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 Data Memory Map 000h Access RAM 05Fh 060h GPR 0FFh 100h GPR 1FFh 200h GPR 2FFh 300h GPR ...

Page 80

... Access RAM Low 5Fh 60h Access RAM High (SFRs) FFh also used by SFRs, but are not part of the Access RAM. Users must always use the complete address or load the proper BSR value to access these registers.  2010 Microchip Technology Inc. ...

Page 81

... Bank Select Note 1: The Access RAM bit of the instruction can be used to force an override of the selected bank (BSR<3:0>) to the registers of the Access Bank. 2: The MOVFF instruction embeds the entire 12-bit address in the instruction.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 Data Memory 000h 7 00h ...

Page 82

... Registers related to the operation of a peripheral feature are described in the chapter for that peripheral. The SFRs are typically distributed among the peripherals whose functions they control. Unused SFR locations are unimplemented and read as ‘0’s. Preliminary  2010 Microchip Technology Inc. ...

Page 83

... T3CON FD8h STATUS FB0h SPBRGH1 Note 1: This is not a physical register. 2: Unimplemented registers are read as ‘0’. 3: PIC18(L)F4XK22 devices only. 4: PIC18(L)F26K22 and PIC18(L)F46K22 devices only.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 Address Name Address FAFh SPBRG1 F87h FAEh RCREG1 F86h FADh TXREG1 ...

Page 84

... ---x xxxx 0000 0000 xxxx xxxx T0PS<2:0> 1111 1111 SCS<1:0> 0011 q000 MFIOFS LFIOFS 00-0 01x0  2010 Microchip Technology Inc. ...

Page 85

... SSP2IE BCL2IE Legend unknown unchanged, — = unimplemented value depends on condition Note 1: PIC18(L)F4XK22 devices only. 2: PIC18(L)F2XK22 devices only. 3: PIC18(L)F23/24K22 and PIC18(L)F43/44K22 devices only. 4: PIC18(L)F26K22 and PIC18(L)F46K22 devices only.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 Bit 5 Bit 4 Bit 3 Bit 2 — — — — ...

Page 86

... TRMT TX9D 0000 0010 OERR RX9D 0000 000x WUE ABDEN 01x0 0-00 xxxx xxxx 2 C Master Mode 0000 0000 UA BF 0000 0000 0000 0000 RSEN SEN 0000 0000 1111 1111 AHEN DHEN 0000 0000  2010 Microchip Technology Inc. ...

Page 87

... Note 1: PIC18(L)F4XK22 devices only. 2: PIC18(L)F2XK22 devices only. 3: PIC18(L)F23/24K22 and PIC18(L)F43/44K22 devices only. 4: PIC18(L)F26K22 and PIC18(L)F46K22 devices only.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 Bit 5 Bit 4 Bit 3 Bit 2 Capture/Compare/PWM Register 2, High Byte Capture/Compare/PWM Register 2, Low Byte DC2B<1:0> ...

Page 88

... PIC18(L)F26K22 and PIC18(L)F46K22 devices only. DS41412A-page 88 Bit 5 Bit 4 Bit 3 Bit 2 ANSC5 ANSC4 ANSC3 ANSC2 ANSB5 ANSB4 ANSB3 ANSB2 ANSA5 — ANSA3 ANSA2 Preliminary Value on Bit 1 Bit 0 POR, BOR — — 1111 11-- ANSB1 ANSB0 --11 1111 ANSA1 ANSA0 --1- 1111  2010 Microchip Technology Inc. ...

Page 89

... For Borrow, the polarity is reversed. A subtraction is executed by adding the two’s complement of the second operand. For rotate (RRF, RLF) instructions, this bit is loaded with either the high-order or low-order bit of the source register.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 It is recommended that only BCF, BSF, SWAPF, MOVFF ...

Page 90

... Example 5-5. EXAMPLE 5-5: HOW TO CLEAR RAM (BANK 1) USING INDIRECT ADDRESSING LFSR FSR0, 100h ; NEXT CLRF POSTINC0 BTFSS FSR0H, 1 BRA NEXT CONTINUE Preliminary  2010 Microchip Technology Inc. ; Clear INDF ; register then ; inc pointer ; All done with ; Bank1? ; NO, clear next ; YES, continue ...

Page 91

... In this case, the FSR1 pair contains ECCh. This means the contents of location ECCh will be added to that of the W register and stored back in ECCh.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 5.4.3.2 FSR Registers and POSTINC, POSTDEC, PREINC and PLUSW In addition to the INDF operand, each FSR register pair also has four additional indirect operands. Like INDF, these are “ ...

Page 92

... Figure 5-11. Those who desire to use byte-oriented or bit-oriented instructions in the Indexed Literal Offset mode should note the changes to assembler syntax for this mode. This is described in more detail in Section 25.2.1 “Extended Instruction Syntax”. Preliminary  2010 Microchip Technology Inc. ...

Page 93

... The bank is designated by the Bank Select Register (BSR). The address can be in any implemented bank in the data memory space.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 000h 060h Bank 0 100h Bank 1 through ...

Page 94

... PIC18 instruction set. These instructions are executed as described in Section 25.2 “Extended Instruction Set”. Bank 0 Bank 1 Window Bank 1 Bank 2 through Bank 14 Bank 15 SFRs Data Memory Preliminary 00h Bank 1 “Window” 5Fh 60h SFRs FFh Access Bank  2010 Microchip Technology Inc. ...

Page 95

... TBLPTRH TBLPTRL Program Memory (TBLPTR) Note 1: Table Pointer register points to a byte in program memory.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 6.1 Table Reads and Table Writes In order to read and write program memory, there are two operations that allow the processor to move bytes ...

Page 96

... Then WR bit is cleared by hardware at the completion of the write operation. Note: The EEIF interrupt flag bit of the PIR2 register is set when the write is complete. The EEIF flag stays set until cleared by firmware. Preliminary Table Latch (8-bit) TABLAT  2010 Microchip Technology Inc. ...

Page 97

... RD bit cannot be set when EEPGD = 1 or CFGS = 1 Does not initiate an EEPROM read Note 1: When a WRERR occurs, the EEPGD and CFGS bits are not cleared. This allows tracing of the error condition.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 R/W-0 R/W-x R/W-0 ...

Page 98

... TBLPTR based on Flash program memory operations. Operation on Table Pointer TBLPTR is not modified TBLPTR is incremented after the read/write TBLPTR is decremented after the read/write TBLPTR is incremented before the read/write TBLPTRH 8 7 (1) TABLE READ – TBLPTR<21:0> Preliminary TBLPTRL 0 TABLE WRITE (1) TBLPTR<n:0>  2010 Microchip Technology Inc. ...

Page 99

... TBLRD*+ MOVFW TABLAT, W MOVF WORD_ODD  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 The internal program memory is typically organized by words. The Least Significant bit of the address selects between the high and low bytes of the word. Figure 6-4 shows the interface between the internal program memory and the TABLAT ...

Page 100

... TBLPTR with the base ; address of the memory block ; point to Flash program memory ; access Flash program memory ; enable write to memory ; enable block Erase operation ; disable interrupts ; write 55h ; write 0AAh ; start erase (CPU stall) ; re-enable interrupts Preliminary  2010 Microchip Technology Inc. ...

Page 101

... Set the EECON1 register for the write operation: • set EEPGD bit to point to program memory; • clear the CFGS bit to access program memory; • set WREN to enable byte writes.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 The long write is necessary for programming the internal Flash. Instruction execution is halted during a long write cycle ...

Page 102

... TBLWT holding register. Preliminary  2010 Microchip Technology Inc. ...

Page 103

... C1IF PIE2 OSCFIE C1IE Legend: — = unimplemented, read as ‘0’. Shaded bits are not used during Flash/EEPROM access.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 ; loop until holding registers are full ; point to Flash program memory ; access Flash program memory ; enable write to memory ...

Page 104

... PIC18(L)F2X/4XK22 NOTES: DS41412A-page 104 Preliminary  2010 Microchip Technology Inc. ...

Page 105

... EECON1 and EECON2. These are the same registers which control access to the program memory and are used in a similar manner for the data EEPROM.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 The EECON1 register (Register 7-1) is the control register for data and program memory access. Control bit EEPGD determines if the access will be to program or data EEPROM memory ...

Page 106

... When a WRERR occurs, the EEPGD and CFGS bits are not cleared. This allows tracing of the error condition. DS41412A-page 106 R/W-0 R/W-x R/W-0 FREE WRERR WREN U = Unimplemented bit, read as ‘0’ ‘0’ = Bit is cleared (1) Preliminary R/S-0 R/S bit Bit is unknown  2010 Microchip Technology Inc. ...

Page 107

... BSF EECON1, WR BSF INTCON, GIE BCF EECON1, WREN  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 Additionally, the WREN bit in EECON1 must be set to enable writes. This mechanism prevents accidental writes to data EEPROM due to unexpected code execution (i.e., runaway programs). The WREN bit should be kept clear at all times, except when updating the EEPROM ...

Page 108

... Set for Data EEPROM ; Disable interrupts ; Enable writes ; Loop to refresh array ; Read current address ; ; Write 55h ; ; Write 0AAh ; Set WR bit to begin write ; Wait for write to complete ; Increment address ; Not zero again ; Disable writes ; Enable interrupts Preliminary Section 27.0 “Electrical  2010 Microchip Technology Inc. ...

Page 109

... C1IP PIR2 OSCFIF C1IF PIE2 OSCFIE C1IE Legend: — = unimplemented, read as ‘0’. Shaded bits are not used during EEPROM access. Note 1: PIC18(L)F26K22 and PIC18(L)F46K22 only.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 Bit 5 Bit 4 Bit 3 Bit 2 TMR0IE INT0IE RBIE TMR0IF EEADR5 EEADR4 EEADR3 EEADR2 EEADR1 EEADR0 — ...

Page 110

... PIC18(L)F2X/4XK22 NOTES: DS41412A-page 110 Preliminary  2010 Microchip Technology Inc. ...

Page 111

... Without hardware multiply unsigned Hardware multiply Without hardware multiply signed Hardware multiply Without hardware multiply unsigned Hardware multiply Without hardware multiply signed Hardware multiply  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 EXAMPLE 8- UNSIGNED MULTIPLY ROUTINE MOVF ARG1, W MULWF ARG2 EXAMPLE 8- SIGNED MULTIPLY ROUTINE ...

Page 112

... PRODL RES1 Add cross PRODH products ; WREG ; ; ARG1H ARG2L ; ARG1H * ARG2L -> ; PRODH:PRODL PRODL RES1 Add cross PRODH products ; WREG ; ; ARG2H ARG2H:ARG2L neg? SIGN_ARG1 ; no, check ARG1 ARG1L RES2 ; ARG1H ARG1H ARG1H:ARG1L neg? CONT_CODE ; no, done ARG2L RES2 ; ARG2H  2010 Microchip Technology Inc. ...

Page 113

... GIE/GIEH bit of the INTCON register is the global interrupt enable which enables all non-peripheral interrupt sources and disables all interrupt sources, including the peripherals. All interrupts branch to address 0008h in Compatibility mode.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 9.2 Interrupt Priority The interrupt priority feature is enabled by setting the IPEN bit of the RCON register ...

Page 114

... INT2IE INT2IP IPEN IPEN GIEL/PEIE IPEN TMR0IF TMR0IE TMR0IP (1) RBIF RBIE RBIP INT1IF INT1IE INT1IP INT2IF INT2IE INT2IP Preliminary  2010 Microchip Technology Inc. Wake- Idle or Sleep modes Interrupt to CPU Vector to Location 0008h GIEH/GIE Interrupt to CPU Vector to Location 0018h GIEH/GIE GIEL/PEIE ...

Page 115

... A mismatch condition will continue to set the RBIF bit. Reading PORTB will end the mismatch condition and allow the bit to be cleared port change interrupts also require the individual pin IOCB enables.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 Note: Interrupt flag bits are set when an interrupt ...

Page 116

... This feature allows for software polling. DS41412A-page 116 R/W-1 U-0 R/W-1 INTEDG2 — TMR0IP U = Unimplemented bit, read as ‘0’ ‘0’ = Bit is cleared Preliminary U-0 R/W-1 — RBIP bit Bit is unknown  2010 Microchip Technology Inc. ...

Page 117

... User software should ensure the appropriate interrupt flag bits are clear prior to enabling an interrupt. This feature allows for software polling.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 R/W-0 R/W-0 U-0 INT2IE INT1IE — ...

Page 118

... R-0 R/W-0 R/W-0 TX1IF SSP1IF CCP1IF U = Unimplemented bit, read as ‘0’ ‘0’ = Bit is cleared Preliminary R/W-0 R/W-0 TMR2IF TMR1IF bit Bit is unknown  2010 Microchip Technology Inc. ...

Page 119

... A TMR1 register capture occurred (must be cleared by software TMR1 register capture occurred Compare mode TMR1 register compare match occurred (must be cleared by software TMR1 register compare match occurred PWM mode: Unused in this mode.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 R/W-0 R/W-0 R/W-0 EEIF BCL1IF HLVDIF U = Unimplemented bit, read as ‘ ...

Page 120

... TMR gate interrupt occurred (must be cleared in software TMR gate occurred DS41412A-page 120 R/W-0 R/W-0 R/W-0 TX2IF CTMUIF TMR5GIF U = Unimplemented bit, read as ‘0’ ‘0’ = Bit is cleared Preliminary R/W-0 R/W-0 TMR3GIF TMR1GIF bit Bit is unknown 2 C master was transmitting  2010 Microchip Technology Inc. ...

Page 121

... A TMR register capture occurred (must be cleared in software TMR register capture occurred Compare mode TMR register compare match occurred (must be cleared in software TMR register compare match occurred PWM mode: Unused in PWM mode.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 U-0 U-0 R/W-0 — — ...

Page 122

... TMR4 to PR4 match occurred (must be cleared in software TMR4 to PR4 match occurred DS41412A-page 122 U-0 U-0 R/W-0 — — TMR6IF U = Unimplemented bit, read as ‘0’ ‘0’ = Bit is cleared Preliminary  2010 Microchip Technology Inc. R/W-0 R/W-0 TMR5IF TMR4IF bit Bit is unknown ...

Page 123

... TMR2IE: TMR2 to PR2 Match Interrupt Enable bit 1 = Enables the TMR2 to PR2 match interrupt 0 = Disables the TMR2 to PR2 match interrupt bit 0 TMR1IE: TMR1 Overflow Interrupt Enable bit 1 = Enables the TMR1 overflow interrupt 0 = Disables the TMR1 overflow interrupt  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 R/W-0 R/W-0 R/W-0 TX1IE SSP1IE CCP1IE U = Unimplemented bit, read as ‘ ...

Page 124

... TMR3IE: TMR3 Overflow Interrupt Enable bit 1 = Enabled 0 = Disabled bit 0 CCP2IE: CCP2 Interrupt Enable bit 1 = Enabled 0 = Disabled DS41412A-page 124 R/W-0 R/W-0 R/W-0 EEIE BCL1IE HLVDIE U = Unimplemented bit, read as ‘0’ ‘0’ = Bit is cleared Preliminary R/W-0 R/W-0 TMR3IE CCP2IE bit Bit is unknown  2010 Microchip Technology Inc. ...

Page 125

... Enabled 0 = Disabled bit 1 TMR3GIE: TMR3 Gate Interrupt Enable bit 1 = Enabled 0 = Disabled bit 0 TMR1GIE: TMR1 Gate Interrupt Enable bit 1 = Enabled 0 = Disabled  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 R/W-0 R/W-0 R/W-0 TX2IE CTMUIE TMR5GIE U = Unimplemented bit, read as ‘0’ ‘0’ = Bit is cleared ...

Page 126

... U = Unimplemented bit, read as ‘0’ ‘0’ = Bit is cleared U-0 U-0 R/W-0 — — TMR6IE U = Unimplemented bit, read as ‘0’ ‘0’ = Bit is cleared Preliminary  2010 Microchip Technology Inc. R/W-0 R/W-0 CCP4IE CCP3IE bit Bit is unknown R/W-0 R/W-0 TMR5IE TMR4IE ...

Page 127

... Low priority bit 1 TMR2IP: TMR2 to PR2 Match Interrupt Priority bit 1 = High priority 0 = Low priority bit 0 TMR1IP: TMR1 Overflow Interrupt Priority bit 1 = High priority 0 = Low priority  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 R/W-1 R/W-1 R/W-1 TX1IP SSP1IP CCP1IP U = Unimplemented bit, read as ‘0’ ...

Page 128

... Low priority bit 0 CCP2IP: CCP2 Interrupt Priority bit 1 = High priority 0 = Low priority DS41412A-page 128 R/W-1 R/W-1 R/W-1 EEIP BCL1IP HLVDIP U = Unimplemented bit, read as ‘0’ ‘0’ = Bit is cleared Preliminary R/W-1 R/W-1 TMR3IP CCP2IP bit Bit is unknown  2010 Microchip Technology Inc. ...

Page 129

... Low priority bit 1 TMR3GIP: TMR3 Gate Interrupt Priority bit 1 = High priority 0 = Low priority bit 0 TMR1GIP: TMR1 Gate Interrupt Priority bit 1 = High priority 0 = Low priority  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 R/W-0 R/W-0 R/W-0 TX2IP CTMUIP TMR5GIP U = Unimplemented bit, read as ‘0’ ...

Page 130

... U = Unimplemented bit, read as ‘0’ ‘0’ = Bit is cleared U-0 U-0 R/W-0 — — TMR6IP U = Unimplemented bit, read as ‘0’ ‘0’ = Bit is cleared Preliminary  2010 Microchip Technology Inc. R/W-0 R/W-0 CCP4IP CCP3IP bit Bit is unknown R/W-0 R/W-0 TMR5IP TMR4IP ...

Page 131

... MOVFF BSR_TEMP, BSR MOVF W_TEMP, W MOVFF STATUS_TEMP, STATUS  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 9.9 TMR0 Interrupt In 8-bit mode (which is the default), an overflow in the TMR0 register (FFh  00h) will set flag bit, TMR0IF. In 16-bit mode, an overflow in the TMR0H:TMR0L regis- ter pair (FFFFh 0000h) will set TMR0IF. The interrupt can be enabled/disabled by setting/clearing enable bit, TMR0IE of the INTCON register ...

Page 132

... CCP4IE CCP3IE 126 TMR5IE TMR4IE 126 TMR2IF TMR1IF 118 TMR3IF CCP2IF 119 TMR1GIF 120 CCP4IF CCP3IF 121 TMR5IF TMR4IF 122 RB1 RB0 152 POR BOR 60 Register Bit 1 Bit 0 on Page PBADEN CCP2MX 356 — STRVEN 357  2010 Microchip Technology Inc. ...

Page 133

... TRISA bit (= 0) will make the corresponding PORTA pin an output (i.e., enable the output driver and put the contents of the output latch on the selected pin).  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 Reading the PORTA register reads the status of the pins, whereas writing to it, will write to the PORT latch. ...

Page 134

... LATA<5> data output; not affected by analog input TTL PORTA<5> data input; disabled when analog input enabled DIG Comparator C2 output DIG SR Latch Q output TTL SPI slave select input (MSSP1 High/Low-Voltage Detect input A/D input 4. 1 Preliminary Description Schmitt Trigger input with  2010 Microchip Technology Inc. ...

Page 135

... TABLE 10-3: CONFIGURATION REGISTERS ASSOCIATED WITH PORTA Name Bit 7 Bit 6 CONFIG1H IESO FCMEN PRICLKEN PLLCFG Legend: — = unimplemented locations, read as ‘0’. Shaded bits are not used for PORTA.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 ANSEL Pin Buffer Setting Type Type O DIG LATA< ...

Page 136

... CCP2 SCK1 (6) P2A RC3 RB3 (1) P1D SDA1 RB4 RC4 Preliminary (2) (2) PORTD PORTE (8) SCL2 CCP3 (8) SCK2 P3A RD0 RE0 SDA2 P3B CCP4 RE1 RD1 P2B CCP5 (4) RD2 RE2 P2C MCLR RD3 V PP RE3 SDO2 P2D RD4  2010 Microchip Technology Inc. ...

Page 137

... PIC18(L)F4XK22 devices. 3: Function default pin. 4: Function default pin (28-pin devices). 5: Function default pin (40/44-pin devices). 6: Function alternate pin. 7: Function alternate pin (28-pin devices). 8: Function alternate pin (40/44-pin devices)  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 Port Function Priority by Port Pin PORTB PORTC (3) CCP3 ...

Page 138

... Interrupt Service Routine, can clear the interrupt in the following manner: a) Any read or write of PORTB to clear the mis- match condition (except when PORTB is the source or destination of a MOVFF instruction). b) Clear the flag bit, RBIF. Preliminary  2010 Microchip Technology Inc. which also have their ...

Page 139

... Alternate pin assignment for P2B, T3CKI, CCP3 and CCP2 when Configuration bits PB2MX, T3CMX, CCP3MX and CCP2MX are clear. 3: Function on PORTD and PORTE for PIC18(L)F4XK22 devices.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 10.3.3 ALTERNATE FUNCTIONS PORTB is multiplexed with several peripheral functions (Table 10-5) ...

Page 140

... Interrupt-on-change pin DIG Enhanced CCP2 PWM output DIG Enhanced CCP3 PWM output DIG Compare 3 output/PWM 3 output Capture 3 input Timer3 clock input Timer1 external clock gate input Analog input 13. 1 Preliminary Description Schmitt Trigger input with I C.  2010 Microchip Technology Inc. ...

Page 141

... T5GPOL TRISB TRISB7 TRISB6 WPUB WPUB7 WPUB6 Legend: — = unimplemented locations, read as ‘0’. Shaded bits are not used for PORTB. Note 1: Available on PIC18(L)F4XK22 devices.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 ANSEL Pin Buffer Setting Type Type O DIG LATB<6> data output; not affected by analog input. ...

Page 142

... Initialize PORTC by ; clearing output ; data latches ; Alternate method ; to clear output ; data latches ; Value used to ; initialize data ; direction ; Set RC<3:0> as inputs ; RC<5:4> as outputs ; RC<7:6> as inputs ; Value used to ; enable digital inputs ; No ANSEL bits for RC<1:0> ; RC<7:6> dig input enable  2010 Microchip Technology Inc. ...

Page 143

... Default pin assignment for P2B, T3CKI, CCP3 and CCP2 when Configuration bits PB2MX, T3CMX, CCP3MX and CCP2MX are set. 2: Alternate pin assignment for P2B, T3CKI, CCP3 and CCP2 when Configuration bits PB2MX, T3CMX, CCP3MX and CCP2MX are clear. 3: Function on PORTD and PORTE for PIC18(L)F4XK22 devices.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 ANSEL Pin Buffer setting Type ...

Page 144

... PORTC<7> data input; disabled when analog input 1 0 enabled. O CMOS Enhanced CCP3 PWM output EUSART 1 asynchronous receive data in DIG EUSART 1 synchronous serial data output EUSART 1 synchronous serial data input Analog input 19 Preliminary Description Schmitt Trigger input with I C.  2010 Microchip Technology Inc. ...

Page 145

... TABLE 10-10: CONFIGURATION REGISTERS ASSOCIATED WITH PORTC Name Bit 7 Bit 6 CONFIG3H MCLRE — Legend: — = unimplemented locations, read as ‘0’. Shaded bits are not used for PORTC.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 Bit 5 Bit 4 Bit 3 ANSC5 ANSC4 ANSC3 P1SSAC<1:0> DC1B<1:0> ...

Page 146

... SR Latch inputs, are not shown in the priority lists. These inputs are active when the I/O pin is set for Analog mode using the ANSELx registers. Digital output functions may control the pin when Analog mode with the priority shown below. Preliminary  2010 Microchip Technology Inc. ...

Page 147

... AN = Analog input or output; TTL = TTL compatible input High Voltage Open Drain; XTAL = Crystal; CMOS = CMOS compatible input or output Schmitt Trigger input with CMOS levels; I Note 1: Default pin assignment for P2B, T3CKI, CCP3 and CCP2 when Configuration bits PB2MX, T3CMX, CCP3MX and CCP2MX are set.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 ANSEL Pin Buffer ...

Page 148

... Schmitt Trigger input with I C. Register on Bit 1 Bit 0 Page ANSD1 ANSD0 154 WUE ABDEN 276 203 203 203 LATD1 LATD0 156 RD1 RD0 152 OERR RX9D 275 SLRB SLRA 157 258 TRISD1 TRISD0 155 Register Bit 1 Bit 0 on Page 356  2010 Microchip Technology Inc. ...

Page 149

... Value used to ; initialize data ; direction MOVWF TRISE ; Set RE<0> as input ; RE<1> as output ; RE<2> as input  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 10.6.2 PORTE ON 28-PIN DEVICES For PIC18F2XK22 devices, PORTE is only available when Master Clear (MCLR = 0). In these cases, PORTE is a single bit, input only port comprised of RE3 only ...

Page 150

... TRISE2 Preliminary Description Schmitt Trigger input with I C. Reset Bit 1 Bit 0 Values on page ANSE1 ANSE0 155 — RBIP 116 LATE1 LATE0 156 (1) (1) (1) RE1 RE0 153 SLRB SLRA 157 (1) (1) (1) TRISE1 TRISE0 155  2010 Microchip Technology Inc. ...

Page 151

... CONFIG3H — MCLRE CONFIG4L DEBUG XINST Legend: — = unimplemented locations, read as ‘0’. Shaded bits are not used for Interrupts. Note 1: Can only be changed when in high voltage programming mode.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 Bit 5 Bit 4 Bit 3 Bit 2 P2BMX T3CMX HFOFST CCP3MX PBADEN CCP2MX — ...

Page 152

... EMI. The reduced transition time is the default slew rate for all ports. R/W-u/x R/W-u/x R/W-u/x Rx4 Rx3 Rx2 U = Unimplemented bit, read as ‘0’ Bit is unknown (2) Preliminary R/W-u/x R/W-u/x Rx1 Rx0 bit 0  2010 Microchip Technology Inc. ...

Page 153

... ANSA5: RA5 Analog Select bit 1 = Digital input buffer disabled 0 = Digital input buffer enabled bit 4 Unimplemented: Read as ‘0’ bit 3-0 ANSA<3:0>: RA<3:0> Analog Select bit 1 = Digital input buffer disabled 0 = Digital input buffer enabled  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 U-0 R/W-u/x R/W-u/x (1) (2), (3) — RE3 RE2 U = Unimplemented bit, read as ‘ ...

Page 154

... R/W-1 R/W-1 ANSD4 ANSD3 ANSD2 U = Unimplemented bit, read as ‘0’ ‘0’ = Bit is cleared Preliminary R/W-1 R/W-1 ANSB1 ANSB0 bit Bit is unknown U-0 U-0 — — bit Bit is unknown R/W-1 R/W-1 ANSD1 ANSD0 bit Bit is unknown  2010 Microchip Technology Inc. ...

Page 155

... Pull-up disabled on PORT pin bit 6-3 Unimplemented: Read as ‘0’ bit 2-0 TRISE<7:0>: PORTE Tri-State Control bit 1 = PORTE pin configured as an input (tri-stated PORTE pin configured as an output Note 1: Available on PIC18(L)F4XK22 devices only.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 U-0 U-0 R/W-1 (1) — — ...

Page 156

... R/W-1 R/W-1 WPUB4 WPUB3 WPUB2 U = Unimplemented bit, read as ‘0’ ‘0’ = Bit is cleared Preliminary R/W-x/u R/W-x/u LATx1 LATx0 bit Bit is unknown R/W-x/u R/W-x/u LATE1 LATE0 bit Bit is unknown R/W-1 R/W-1 WPUB1 WPUB0 bit Bit is unknown  2010 Microchip Technology Inc. ...

Page 157

... All outputs on PORTA slew at a limited rate 0 = All outputs on PORTA slew at the standard rate Note 1: These bits are available on PIC18(L)F4XK22 devices. 2: The slew rate of RA6 defaults to standard rate when the pin is used as CLKOUT.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 R/W-1 U-0 U-0 IOCB4 — ...

Page 158

... PIC18(L)F2X/4XK22 NOTES: DS41412A-page 158 Preliminary  2010 Microchip Technology Inc. ...

Page 159

... Microchip Technology Inc. PIC18(L)F2X/4XK22 The T0CON register (Register 11-1) controls all aspects of the module’s operation, including the prescale selection both readable and writable. ...

Page 160

... Timer0 is updated with the contents of TMR0H when a write occurs to TMR0L. This allows all 16 bits of Timer0 to be updated at once. ). OSC 1 Sync with Internal Clocks Programmable 0 Prescaler (2 T Delay Preliminary Set TMR0IF TMR0L on Overflow 8 8 Internal Data Bus  2010 Microchip Technology Inc. ...

Page 161

... GIE/GIEH PEIE/GIEL TMR0IE INTCON2 RBPU INTEDG0 INTEDG1 INTEDG2 T0CON TMR0ON T08BIT TMR0H TMR0L TRISA TRISA7 TRISA6 Legend: — = unimplemented locations, read as ‘0’. Shaded bits are not used by Timer0.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 1 Sync with Internal TMR0L Clocks Delay 11.3.1 ...

Page 162

... PIC18(L)F2X/4XK22 NOTES: DS41412A-page 162 Preliminary  2010 Microchip Technology Inc. ...

Page 163

... T1CKI is not available when the secondary oscillator is enabled. (SOSCGO = 1 or TXSOSCEN = 1) 6: T3CKI is not available when the secondary oscillator is enabled, unless T3CMX = 1.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 • Special Event Trigger (with CCP/ECCP) • Selectable Gate Source Polarity • Gate Toggle Mode • ...

Page 164

... Timer1/3/5 is disabled (TMRxON = 0) when TxCKI is high then Timer1/3/5 is enabled (TMRxON=1) when TxCKI is low. TxSOSCEN System Clock ( OSC Instruction Clock (F x OSC External Clocking on TxCKI Pin 0 Osc.Circuit On SOSCI/SOSCO Pins 1 Preliminary internal clock source is selected, the Clock Source /4)  2010 Microchip Technology Inc. ...

Page 165

... Note: When switching from synchronous to asynchronous operation possible to skip an increment. When switching from asynchronous to synchronous operation possible to produce an additional increment.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 12.5.1 READING AND WRITING TIMER1/3/5 IN ASYNCHRONOUS COUNTER MODE Reading TMRxH or TMRxL while the timer is running from an external asynchronous clock will ensure a valid read (taken care of in hardware) ...

Page 166

... Source Selection” for more information. Preliminary TIMER1/3/5 GATE SOURCES Timer1/3/5 Gate Source GATE RESOURCES FOR TIMER2/4/6 MATCH TO PR2/4/6 Timer1/3/5 Gate Match Selection TMR2 Match to PR2 TMR4 Match to PR4 TMR6 Match to PR6 TxG Pin Gate Operation Timer2/4/6 Match Gate Operation  2010 Microchip Technology Inc. ...

Page 167

... Note: Enabling Toggle mode at the same time as changing the gate polarity may result in indeterminate operation.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 12.7.4 TIMER1/3/5 GATE SINGLE-PULSE MODE When Timer1/3/5 Gate Single-Pulse mode is enabled possible to capture a single-pulse gate event. ...

Page 168

... In the event that a write to TMRxH or TMRxL coincides with a Special Event Trigger from the CCP, the write will take precedence. For more information, see Section 17.2.8 “Special Event Trigger”. Preliminary  2010 Microchip Technology Inc. see Section 14.0 period register for ...

Page 169

... Note 1: Arrows indicate counter increments Counter mode, a falling edge must be registered by the counter prior to the first incrementing rising edge of the clock. FIGURE 12-4: TIMER1/3/5 GATE ENABLE MODE TMRxGE TxGPOL TxG_IN TxCKI TxGVAL Timer1/3/5 N  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 Preliminary DS41412A-page 169 ...

Page 170

... TIMER1/3/5 GATE SINGLE-PULSE MODE TMRxGE TxGPOL TxGSPM TxGGO/ Set by software DONE Counting enabled on rising edge of TxG TxG_IN TxCKI TxGVAL TIMER1/3/5 N Cleared by software TMRxGIF DS41412A-page 170 Cleared by hardware on falling edge of TxGVAL Set by hardware on falling edge of TxGVAL Preliminary  2010 Microchip Technology Inc Cleared by software ...

Page 171

... Reset and disconnects the module’s clock source. The Module Disable bits for Timer1 (TMR1MD), Timer3 (TMR3MD) and Timer5 (TMR5MD) are in the PMD0 Register. See Section 3.0 “Power-Managed Modes” for more information.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 ...

Page 172

... Enables Timer1/3 Stops Timer1/3/5 Clears Timer1/3/5 Gate flip-flop DS41412A-page 172 R/W-0/u R/W-0/u R/W-0/u TxSOSCEN TxSYNC U = Unimplemented bit, read as ‘0’ -n/n = Value at POR and BOR/Value at all other Resets ) OSC /4) OSC ) OSC Preliminary R/W-0/0 R/W-0/u TxRD16 TMRxON bit 0  2010 Microchip Technology Inc. ...

Page 173

... TxGSS<1:0>: Timer1/3/5 Gate Source Select bits 00 = Timer1/3/5 Gate pin 01 = Timer2/4/6 Match PR2/4/6 output (See Table 12-6 for proper timer match selection Comparator 1 optionally synchronized output (SYNCC1OUT Comparator 2 optionally synchronized output (SYNCC2OUT)  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 R/W-0/u R/W/HC-0/u R-x/x TxGSPM ...

Page 174

... TMR5IF TMR4IF 122 TMR2MD TMR1MD 56 T1RD16 TMR1ON 172 T1GSS<1:0> 173 T3RD16 TMR3ON 172 T3GSS 173 T5RD16 TMR5ON 172 T5GSS 173 — — TRISB1 TRISB0 155 TRISC1 TRISC0 155 Reset Bit 1 Bit 0 Values on Page PBADEN CCP2MX 356  2010 Microchip Technology Inc. ...

Page 175

... Optional use as the shift clock for the MSSPx modules (Timer2 only) See Figure 13-1 for a block diagram of Timer2/4/6. FIGURE 13-1: TIMER2/4/6 BLOCK DIAGRAM Prescaler F /4 OSC 1:1, 1:4, 1:16, 1:64 2 TxCKPS<1:0>  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 TMRx Output Reset TMRx Postscaler Comparator 1 PRx TxOUTPS< ...

Page 176

... The Module Disable bits for Timer2 (TMR2MD), Timer4 (TMR4MD) and Timer6 (TMR6MD) are in the PMD0 Register. See Section 3.0 “Power-Managed Modes” for more information. Preliminary the input for the 4-bit module is selected using the  2010 Microchip Technology Inc. ...

Page 177

... TMRxON: TimerX On bit 1 = TimerX TimerX is off bit 1-0 TxCKPS<1:0>: Timer2-type Clock Prescale Select bits 00 = Prescaler Prescaler Prescaler is 16  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 R/W-0 R/W-0 R/W-0 TMRxON U = Unimplemented bit, read as ‘0’ -n/n = Value at POR and BOR/Value at all other Resets ...

Page 178

... C4TSEL<1:0> 206 INT0IF RBIF 115 TMR2IP TMR1IP 127 TMR5IP TMR4IP 130 TMR2IE TMR1IE 123 TMR5IE TMR4IE 126 TMR2IF TMR1IF 118 TMR5IF TMR4IF 122 TMR1MD 56 — — — T2CKPS<1:0> 172 T4CKPS<1:0> 172 T6CKPS<1:0> 172 — — —  2010 Microchip Technology Inc. ...

Page 179

... PIC18(L)F43K22 PIC18(L)F44K22 Enhanced PWM PIC18(L)F45K22 Full-Bridge PIC18(L)F46K22  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 Note 1: In devices with more than one CCP module very important to pay close attention to the register names used. A number placed after the module acronym is used to distinguish between separate modules ...

Page 180

... CCPx pin, the Timer resource must be clocked from the instruction clock (F /4) or from an external clock source. OSC Preliminary CCPRxH CCPRxL Capture Enable TMR1/3/5H TMR1/3/5L the CCP output pin PIC18(L)F4XK22 I/O pin RB3 RC1 RE0 RB5 ) should not be OSC  2010 Microchip Technology Inc. ...

Page 181

... ADIE Legend: — = Unimplemented location, read as ‘0’. Shaded bits are not used by Capture mode. Note 1: These registers/bits are available on PIC18(L)F4XK22 devices.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 14.1.5 CAPTURE DURING SLEEP Capture mode requires a 16-bit TimerX module for use as a time base ...

Page 182

... T5GSS 173 — — — — — — TRISA2 TRISA1 TRISA0 155 TRISB2 TRISB1 TRISB0 155 TRISC2 TRISC1 TRISC0 155 TRISD2 TRISD1 TRISD0 155 (1) (1) (1) TRISE1 TRISE0 155 Register Bit 1 Bit 0 on Page PBADEN CCP2MX 356  2010 Microchip Technology Inc. ...

Page 183

... TimerX Interrupt Flag, (TMRxIF) is not set Additional Function on • CCP5 will - Set ADCON0<1>, GO/DONE bit to start an ADC Conversion if ADCON<0>, ADON = 1.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 14.2.1 CCP PIN CONFIGURATION The user must configure the CCPx pin as an output by clearing the associated TRIS bit. ...

Page 184

... OSC Register Bit 2 Bit 1 Bit 0 on Page CCP1M<3:0> 203 CCP2M<3:0> 203 CCP3M<3:0> 203 CCP4M<3:0> 203 CCP5M<3:0> 203 — — — — — — — — — — — C1TSEL<1:0> 206 C4TSEL<1:0> 206 TMR0IF INT0IF RBIF 115  2010 Microchip Technology Inc. ...

Page 185

... CONFIGURATION REGISTERS ASSOCIATED WITH CAPTURE Name Bit 7 Bit 6 Bit 5 CONFIG3H MCLRE — P2BMX Legend: — = Unimplemented location, read as ‘0’. Shaded bits are not used by Capture mode.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 Bit 5 Bit 4 Bit 3 RC1IP TX1IP SSP1IP C2IP EEIP BCL1IP — ...

Page 186

... Configure the CCP module for the PWM mode by loading the CCPxCON register with the appropriate values. 5. Load the CCPRxL register and the DCxB<1:0> bits of the CCPxCON register, with the PWM duty cycle value. Preliminary  2010 Microchip Technology Inc. TMRx = PRx CCPxCON<5:4> CCPx TRIS ...

Page 187

... CCPRxH. Note: The Timer postscaler (see Section 13.0 “Timer2/4/6 Module”) is not used in the determination of the PWM frequency.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 14.3.5 PWM DUTY CYCLE The PWM duty cycle is specified by writing a 10-bit value to multiple registers: CCPRxL register and DCxB< ...

Page 188

... PRx + 1 ----------------------------------------- - bits 2   log = 32 MHz) 250 kHz 333.3 kHz 1 1 0x1F 0x17 7 6 MHz) 156.3 kHz 208.3 kHz 1 1 0x1F 0x17 7 6 MHz) 153.85 kHz 200.0 kHz 1 1 0x0C 0x09 5 5  2010 Microchip Technology Inc. ...

Page 189

... TABLE 14-11: CONFIGURATION REGISTERS ASSOCIATED WITH CAPTURE Name Bit 7 Bit 6 CONFIG3H MCLRE — P2BMX Legend: — = Unimplemented location, read as ‘0’. Shaded bits are not used by Capture mode.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 Bit 5 Bit 4 Bit 3 DC1B<1:0> DC2B<1:0> DC3B<1:0> DC4B<1:0> ...

Page 190

... ECCP module waits until the start of a new PWM period before generating a PWM signal. PxM<1:0> CCPxM<3:0> CCPx/PxA TRISx PxB TRISx Output Q Controller PxC TRISx PxD TRISx PWMxCON Preliminary the generation of an CCPx/PxA PxB (2) PxC (2) PxD  2010 Microchip Technology Inc. ...

Page 191

... Pulse Width = T * (CCPRxL<7:0>:CCPxCON<5:4>) * (TMRx Prescale Value) OSC • Delay = (PWMxCON<6:0>) OSC Note 1: Dead-band delay is programmed using the PWMxCON register (Section 14.4.5 “Programmable Dead-Band Delay Mode”).  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 CCPx/PxA PxB (1) (1) Yes Yes Yes Yes ...

Page 192

... Pulse Width = T * (CCPRxL<7:0>:CCPxCON<5:4>) * (TMRx Prescale Value) OSC • Delay = (PWMxCON<6:0>) OSC Note 1: Dead-band delay is programmed using the PWMxCON register (Section 14.4.5 “Programmable Dead-Band Delay Mode”). DS41412A-page 192 Pulse 0 Width Period (1) (1) Delay Delay Preliminary  2010 Microchip Technology Inc. PRx+1 ...

Page 193

... Standard Half-Bridge Circuit (“Push-Pull”) Half-Bridge Output Driving a Full-Bridge Circuit PxA PxB  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 Since the PxA and PxB outputs are multiplexed with the PORT data latches, the associated TRIS bits must be cleared to configure PxA and PxB as outputs. ...

Page 194

... PORT data latches. The associated TRIS bits must be cleared to configure the PxA, PxB, PxC and PxD pins as outputs. FIGURE 14-10: EXAMPLE OF FULL-BRIDGE APPLICATION PxA PxB PxC PxD DS41412A-page 194 V+ QA FET Driver Load FET Driver QB V- Preliminary QC FET Driver FET Driver QD  2010 Microchip Technology Inc. ...

Page 195

... Forward Mode (2) PxA Pulse Width (2) PxB (2) PxC (2) PxD (1) Reverse Mode Pulse Width (2) PxA (2) PxB (2) PxC (2) PxD (1) Note 1: At this time, the TMRx register is equal to the PRx register. 2: Output signal is shown as active-high.  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 Period (1) Period (1) Preliminary DS41412A-page 195 ...

Page 196

... Reduce PWM duty cycle for one PWM period before changing directions. 2. Use switch drivers that can drive the switches off faster than they can drive them on. Other options to prevent shoot-through current may exist. (1) Period Pulse Width (2) Preliminary Period , OSC  2010 Microchip Technology Inc. ...

Page 197

... Section 14.4.4 “Auto-Restart Mode”). The enabled PWM pins are asynchronously placed in their shutdown states. The PWM output pins are grouped into pairs [PxA/PxC] and [PxB/PxD]. The state  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 Forward Period Reverse Period t1 ...

Page 198

... Missing Pulse Missing Pulse (Auto-Shutdown) (CCPxASE not clear) Timer Timer Overflow Overflow Overflow Shutdown Event Occurs Shutdown CCPxASE Event Clears Cleared by Preliminary Timer Timer Overflow PWM Resumes CCPxASE Cleared by Firmware Timer Timer Overflow PWM Resumes Hardware  2010 Microchip Technology Inc. ...

Page 199

... The lower seven bits of the associated PWMxCON register (Register 14-6) sets the delay period in terms of microcontroller instruction cycles (T CY FIGURE 14-17: EXAMPLE OF HALF-BRIDGE APPLICATIONS Standard Half-Bridge Circuit (“Push-Pull”)  2010 Microchip Technology Inc. PIC18(L)F2X/4XK22 FIGURE 14-16: Pulse Width (2) PxA td (2) ...

Page 200

... Figures 14-19 and 14-20 illustrate the timing diagrams of the PWM steering depending on the STRxSYNC setting. Preliminary SIMPLIFIED STEERING BLOCK DIAGRAM PxA pin 1 0 TRIS PxB pin 1 0 TRIS PxC pin 1 0 TRIS PxD pin 1 0 TRIS  2010 Microchip Technology Inc. ...

Related keywords