Datasheet PIC16F1764, PIC16F1765, PIC16F1768, PIC16F1769, PIC16LF1764, PIC16LF1765, PIC16LF1768, PIC16LF1769 (Microchip)

FabricanteMicrochip
Descripción14/20-Pin, 8-Bit Flash Microcontrollers
Páginas / Página568 / 1 — PIC16(L)F1764/5/8/9. 14/20-Pin, 8-Bit Flash Microcontrollers. …
Formato / tamaño de archivoPDF / 9.6 Mb
Idioma del documentoInglés

PIC16(L)F1764/5/8/9. 14/20-Pin, 8-Bit Flash Microcontrollers. Description. Core Features. Digital Peripherals. Memory

Datasheet PIC16F1764, PIC16F1765, PIC16F1768, PIC16F1769, PIC16LF1764, PIC16LF1765, PIC16LF1768, PIC16LF1769 Microchip

Línea de modelo para esta hoja de datos

Versión de texto del documento

PIC16(L)F1764/5/8/9 14/20-Pin, 8-Bit Flash Microcontrollers Description
The PIC16(L)F1764/5/8/9 family offers intelligent analog with digital peripherals to create up to two independent closed- loop channels. These 14 and 20-pin devices enable the ability to interconnect the on-chip peripherals to create custom functions specific to each application; helping simplify the implementation of a complex control system and give designers the flexibility to innovate.
Core Features Digital Peripherals
• C Compiler Optimized RISC Architecture • Configurable Logic Cell (CLC): • Only 49 Instructions - Up to three CLCs; up to four selected inputs • Operating Speed: - Integrated combinational and state logic - DC – 32 MHz clock input • Up to Two Complementary Output Generators - 125 ns minimum instruction cycle (COG): • Interrupt Capability - Push-Pull, Full-Bridge and Steering modes • 16-Level Deep Hardware Stack • Up to Two Capture/Compare/PWM (CCP) • Up to Four 8-Bit Timers modules • Up to Three 16-Bit Timers • Pulse-Width Modulators (PWM): • Power-on Reset (POR) - Up to two 10-bit PWMs • Configurable Power-up Timer (PWRT) - Up to two 16-bit PWMs • Brown-out Reset (BOR) with Selectable Trip Point • Peripheral Pin Select (PPS): • Extended Watchdog Timer (EWDT): - Configure any digital pin to output - Low-power 31 kHz WDT • Serial Communications: - Software-selectable prescaler - Enhanced USART (EUSART) - Software-selectable enable - SPI, I2C, RS-232, RS-485, LIN compatible - Auto-Baud Detect, auto-wake-up on start
Memory
• Up to 18 I/O Pins: • Up to 14 Kbytes Flash Program Memory - Individually programmable pull-ups • Up to 1024 Bytes Data RAM Memory - Slew rate control • Direct, Indirect and Relative Addressing modes - Interrupt-On-Change (IOC) with edge select • High-Endurance Flash (HEF): • Up to Two Data Signal Modulators (DSM) - 128B of nonvolatile data storage - 100K erase/write cycles
Intelligent Analog Peripherals
• 10-Bit Analog-to-Digital Converter (ADC):
Operating Characteristics
- Up to 12 external channels • Operating Voltage Range: - Conversion available during Sleep - 1.8V to 3.6V (PIC16LF1764/5/8/9) • Up to Two Operational Amplifiers (OPA): - 2.3V to 5.5V (PIC16F1764/5/8/9) - Selectable internal and external channels • Temperature Range: • Up to Four Fast Comparators (COMP): - Industrial: -40°C to +85°C - Up to five external inverting inputs - Extended: -40°C to +125°C - Up to eight external noninverting inputs - Fixed Voltage Reference at noninverting
eXtreme Low-Power (XLP) Features
input(s) • Sleep mode: 50 nA @ 1.8V, typical - Comparator outputs externally accessible • Watchdog Timer: 500 nA @ 1.8V, typical • Digital-to-Analog Converters (DAC): • Secondary Oscillator: 500 nA @ 32 kHz - Up to two 10-bit resolution DACs • Operating Current: - Up to two 5-bit resolution DACs - 8 A @ 32 kHz, 1.8V, typical - 32 A/MHz @ 1.8V, typical • Low-Power BOR (LPBOR): - 200 nA in Sleep  2014-2019 Microchip Technology Inc. DS40001775E-page 1 Document Outline Description Core Features Memory Operating Characteristics eXtreme Low-Power (XLP) Features Digital Peripherals Intelligent Analog Peripherals Intelligent Analog Peripherals (Cont.) Clocking Structure TABLE 1: PIC16(L)F1764/5/8/9 Family Types TABLE 2: Packages Pin Diagrams FIGURE 1: 14-Pin PDIP, SOIC, TSSOP FIGURE 2: 16-Pin QFN (4x4) FIGURE 3: 20-Pin PDIP, SOIC, SSOP FIGURE 4: 20-Pin QFN (4x4) Pin Allocation Tables TABLE 3: 14-Pin and 16-Pin Allocation Table (PIC16(L)F1764/5) TABLE 4: 20-Pin Allocation Table (PIC16(L)F1768/9) Table of Contents Most Current Data Sheet Errata Customer Notification System 1.0 Device Overview TABLE 1-1: Device Peripheral Summary 1.1 Register and Bit Naming Conventions 1.1.1 Register Names 1.1.2 Bit Names 1.1.2.1 Short Bit Names 1.1.2.2 Long Bit Names 1.1.2.3 Bit Fields 1.1.3 Register and Bit Naming Exceptions 1.1.3.1 Status, Interrupt and Mirror Bits 1.1.3.2 Legacy Peripherals FIGURE 1-1: PIC16(L)F1764/5 Block Diagram FIGURE 1-2: PIC16(L)F1768/9 Block Diagram TABLE 1-2: PIC16(L)F1764/5 Pinout Description TABLE 1-3: PIC16(L)F1768/9 Pinout Description 1.2 Peripheral Connection Matrix TABLE 1-4: Peripheral Connection Matrix 2.0 Enhanced Mid-Range CPU FIGURE 2-1: Core Block Diagram 2.1 Automatic Interrupt Context Saving 2.2 16-Level Stack with Overflow and Underflow 2.3 File Select Registers 2.4 Instruction Set 3.0 Memory Organization 3.1 Program Memory Organization 3.2 High-Endurance Flash TABLE 3-1: Device Sizes and Addresses FIGURE 3-1: Program Memory Map and Stack for PIC16(L)F1764/5/8/9 3.2.1 Reading Program Memory as Data 3.2.1.1 RETLW Instruction EXAMPLE 3-1: RETLW Instruction 3.2.1.2 Indirect Read with FSRn EXAMPLE 3-2: Accessing Program Memory via FSRn 3.3 Data Memory Organization 3.3.1 Core Registers TABLE 3-2: Core Registers 3.3.1.1 STATUS Register Register 3-1: STATUS: STATUS Register 3.3.2 Special Function Register 3.3.3 General Purpose RAM 3.3.3.1 Linear Access to GPR 3.3.4 Common RAM FIGURE 3-2: Banked Memory Partitioning 3.3.5 Device Memory Maps TABLE 3-3: PIC16(L)F1764 Memory Map (Banks 0-7) TABLE 3-4: PIC16LF1765 Memory Map (Banks 0-7) TABLE 3-5: PIC16(L)F1768 Memory Map (Banks 0-7) TABLE 3-6: PIC16(L)F1769 Memory Map (Banks 0-7) TABLE 3-7: PIC16(L)F1764 Memory Map (Banks 8-23) TABLE 3-8: PIC16(L)F1765 Memory Map (Banks 8-23) TABLE 3-9: PIC16(L)F1768 Memory Map (Banks 8-23) TABLE 3-10: PIC16(L)F1769 Memory Map (Banks 8-23) TABLE 3-11: PIC16(L)F1764/5/8/9 Memory Map (Banks 24-31) TABLE 3-12: PIC16(L)F1764/5 Memory Map (Banks 27-30) TABLE 3-13: PIC16(L)F1768/9 Memory Map (Banks 27-30) TABLE 3-14: PIC16(L)F1764/5/8/9 Memory Map (Bank 31) 3.3.6 Core Function Registers Summary TABLE 3-15: Core Function Registers Summary(1) TABLE 3-16: Special Function Register Summary 3.4 PCL and PCLATH FIGURE 3-3: Loading of PC in Different Situations 3.4.1 Modifying PCL 3.4.2 Computed GOTO 3.4.3 Computed Function Calls 3.4.4 Branching 3.5 Stack 3.5.1 Accessing the Stack FIGURE 3-4: Accessing the Stack Example 1 FIGURE 3-5: Accessing the Stack Example 2 FIGURE 3-6: Accessing the Stack Example 3 FIGURE 3-7: Accessing the Stack Example 4 3.5.2 Overflow/Underflow Reset 3.6 Indirect Addressing FIGURE 3-8: Indirect Addressing 3.6.1 Traditional Data Memory FIGURE 3-9: Traditional Data Memory Map 3.6.2 Linear Data Memory FIGURE 3-10: Linear Data Memory Map 3.6.3 Program Flash Memory FIGURE 3-11: Program Flash Memory Map 4.0 Device Configuration 4.1 Configuration Words 4.2 Register Definitions: Configuration Words Register 4-1: CONFIG1: Configuration Word 1 Register 4-2: CONFIG2: Configuration Word 2 4.3 Code Protection 4.3.1 Program Memory Protection 4.4 Write Protection 4.5 User ID 4.6 Device ID and Revision ID 4.7 Register Definitions: Device and Revision Register 4-3: DEVID: Device ID Register Register 4-4: REVID: Revision ID Register 5.0 Oscillator Module (with Fail-Safe Clock Monitor) 5.1 Overview FIGURE 5-1: Simplified PIC® MCU Clock Source Block Diagram 5.2 Clock Source Types 5.2.1 External Clock Sources 5.2.1.1 EC Mode FIGURE 5-2: External Clock (EC) Mode Operation 5.2.1.2 LP, XT, HS Modes FIGURE 5-3: Quartz Crystal Operation (LP, XT or HS Mode) FIGURE 5-4: Ceramic Resonator Operation (XT or HS Mode) 5.2.1.3 Oscillator Start-up Timer (OST) 5.2.1.4 4x PLL 5.2.1.5 Secondary Oscillator FIGURE 5-5: Quartz Crystal Operation (Secondary Oscillator) 5.2.1.6 External RC Mode FIGURE 5-6: External RC Modes 5.2.2 Internal Clock Sources 5.2.2.1 HFINTOSC 5.2.2.2 MFINTOSC 5.2.2.3 Internal Oscillator Frequency Adjustment 5.2.2.4 LFINTOSC 5.2.2.5 Internal Oscillator Frequency Selection 5.2.2.6 32 MHz Internal Oscillator Frequency Selection 5.2.2.7 Internal Oscillator Clock Switch Timing FIGURE 5-7: Internal Oscillator Switch Timing 5.3 Clock Switching 5.3.1 System Clock Select (SCS) Bits 5.3.2 Oscillator Start-up Timer Status (OSTS) Bit 5.3.3 Secondary Oscillator 5.3.4 Secondary Oscillator Ready (SOSCR) Bit 5.3.5 Clock Switch Before Sleep 5.4 Two-Speed Clock Start-up Mode 5.4.1 Two-Speed Start-up Mode Configuration TABLE 5-1: Oscillator Switching Delays 5.4.2 Two-Speed Start-up Sequence 5.4.3 Checking Two-Speed Clock Status FIGURE 5-8: Two-Speed Start-up 5.5 Fail-Safe Clock Monitor FIGURE 5-9: FSCM Block Diagram 5.5.1 Fail-Safe Detection 5.5.2 Fail-Safe Operation 5.5.3 Fail-Safe Condition Clearing 5.5.4 Reset or Wake-up from Sleep FIGURE 5-10: FSCM Timing Diagram 5.6 Register Definitions: Oscillator Control Register 5-1: OSCCON: Oscillator Control Register Register 5-2: OSCSTAT: Oscillator Status Register Register 5-3: OSCTUNE: Oscillator Tuning Register TABLE 5-2: Summary of Registers Associated with Clock Sources TABLE 5-3: Summary of Configuration Word with Clock Sources 6.0 Resets FIGURE 6-1: Simplified Block Diagram of On-Chip Reset Circuit 6.1 Power-on Reset (POR) 6.1.1 Power-up Timer (PWRT) 6.2 Brown-out Reset (BOR) TABLE 6-1: BOR Operating Modes 6.2.1 BOR is Always On 6.2.2 BOR is Off in Sleep 6.2.3 BOR Controlled by Software FIGURE 6-2: Brown-out Situations 6.3 Register Definitions: BOR Control Register 6-1: BORCON: Brown-out Reset Control Register 6.4 Low-Power Brown-out Reset (LPBOR) 6.4.1 Enabling LPBOR 6.4.1.1 LPBOR Module Output 6.5 MCLR TABLE 6-2: MCLR Configuration 6.5.1 MCLR Enabled 6.5.2 MCLR Disabled 6.6 Watchdog Timer (WDT) Reset 6.7 RESET Instruction 6.8 Stack Overflow/Underflow Reset 6.9 Programming Mode Exit 6.10 Power-up Timer 6.11 Start-up Sequence FIGURE 6-3: Reset Start-up Sequence 6.12 Determining the Cause of a Reset TABLE 6-3: Reset Status Bits and Their Significance TABLE 6-4: Reset Condition for Special Registers 6.13 Power Control (PCON) Register 6.14 Register Definitions: Power Control Register 6-2: PCON: Power Control Register TABLE 6-5: Summary of Registers Associated with Resets 7.0 Interrupts FIGURE 7-1: Interrupt Logic 7.1 Operation 7.2 Interrupt Latency FIGURE 7-2: Interrupt Latency FIGURE 7-3: INT Pin Interrupt Timing 7.3 Interrupts During Sleep 7.4 INT Pin 7.5 Automatic Context Saving 7.6 Register Definitions: Interrupt Control Register 7-1: INTCON: Interrupt Control Register Register 7-2: PIE1: Peripheral Interrupt Enable Register 1 Register 7-3: PIE2: Peripheral Interrupt Enable Register 2 Register 7-4: PIE3: Peripheral Interrupt Enable Register 3 Register 7-5: PIE4: Peripheral Interrupt Enable Register 4 Register 7-6: PIR1: Peripheral Interrupt Request Register 1 Register 7-7: PIR2: Peripheral Interrupt Request Register 2 Register 7-8: PIR3: Peripheral Interrupt Request Register 3 Register 7-9: PIR4: Peripheral Interrupt Request Register 4 TABLE 7-1: Summary of Registers Associated with Interrupts 8.0 Power-Down Mode (Sleep) 8.1 Wake-up from Sleep 8.1.1 Wake-up Using Interrupts FIGURE 8-1: Wake-up from Sleep Through Interrupt 8.2 Low-Power Sleep Mode 8.2.1 Sleep Current vs. Wake-up Time 8.2.2 Peripheral Usage in Sleep 8.3 Register Definitions: Voltage Regulator Control Register 8-1: VREGCON: Voltage Regulator Control Register(1) TABLE 8-1: Summary of Registers Associated with Power-Down Mode 9.0 Watchdog Timer (WDT) FIGURE 9-1: Watchdog Timer Block Diagram 9.1 Independent Clock Source 9.2 WDT Operating Modes 9.2.1 WDT is Always On 9.2.2 WDT is Off in Sleep 9.2.3 WDT Controlled by Software TABLE 9-1: WDT Operating Modes 9.3 Time-out Period 9.4 Clearing the WDT 9.5 Operation During Sleep TABLE 9-2: WDT Clearing Conditions 9.6 Register Definitions: Watchdog Control Register 9-1: WDTCON: Watchdog Timer Control Register TABLE 9-3: Summary of Registers Associated with Watchdog Timer TABLE 9-4: Summary of Configuration Word with Watchdog Timer 10.0 Flash Program Memory Control 10.1 PMADRL and PMADRH Registers 10.1.1 PMCON1 and PMCON2 Registers 10.2 Flash Program Memory Overview TABLE 10-1: Flash Memory Organization by Device 10.2.1 Reading the Flash Program Memory FIGURE 10-1: Flash Program Memory Read Flowchart FIGURE 10-2: Flash Program Memory Read Cycle Execution EXAMPLE 10-1: Flash Program Memory Read 10.2.2 Flash Memory Unlock Sequence FIGURE 10-3: Flash Program Memory Unlock Sequence Flowchart 10.2.3 Erasing Flash Program Memory FIGURE 10-4: Flash Program Memory Erase Flowchart EXAMPLE 10-2: Erasing One Row of Program Memory 10.2.4 Writing to Flash Program Memory FIGURE 10-5: Block Writes to Flash Program Memory with 32 Write Latches FIGURE 10-6: Flash Program Memory Write Flowchart EXAMPLE 10-3: Writing to Flash Program Memory 10.3 Modifying Flash Program Memory FIGURE 10-7: Flash Program Memory Modify Flowchart 10.4 User ID, Device ID and Configuration Word Access TABLE 10-2: User ID, Device ID and Configuration Word Access (CFGS = 1) EXAMPLE 10-4: Configuration Word and Device ID Access 10.5 Write/Verify FIGURE 10-8: Flash Program Memory Verify Flowchart 10.6 Register Definitions: Flash Program Memory Control Register 10-1: PMDATL: Program Memory Data Low Byte Register Register 10-2: PMDATH: Program Memory Data High Byte Register Register 10-3: PMADRL: Program Memory Address Low Byte Register Register 10-4: PMADRH: Program Memory Address High Byte Register Register 10-5: PMCON1: Program Memory Control 1 Register Register 10-6: PMCON2: Program Memory Control 2 Register TABLE 10-3: Summary of Registers Associated with Flash Program Memory TABLE 10-4: Summary of Configuration Word with Flash Program Memory 11.0 I/O Ports TABLE 11-1: Port Availability per Device FIGURE 11-1: Generic I/O Port Operation 11.1 PORTA Registers 11.1.1 Data Register 11.1.2 Direction Control 11.1.3 Open-Drain Control 11.1.4 Slew Rate Control 11.1.5 Input Threshold Control 11.1.6 Analog Control EXAMPLE 11-1: Initializing PORTA 11.1.7 PORTA Functions and Output Priorities 11.2 Register Definitions: PORTA Register 11-1: PORTA: PORTA Register Register 11-2: TRISA: PORTA Tri-State Register Register 11-3: LATA: PORTA Data Latch Register Register 11-4: ANSELA: PORTA Analog Select Register Register 11-5: WPUA: Weak Pull-up PORTA Register Register 11-6: ODCONA: PORTA Open-Drain Control Register Register 11-7: SLRCONA: PORTA Slew Rate Control Register Register 11-8: INLVLA: PORTA Input Level Control Register TABLE 11-2: Summary of Registers Associated with PORTA TABLE 11-3: Summary of Configuration Word with PORTA 11.3 PORTB Registers (PIC16(L)F1768/9 only) 11.3.1 Data Register 11.3.2 Direction Control 11.3.3 Open-Drain Control 11.3.4 Slew Rate Control 11.3.5 Input Threshold Control 11.3.6 Analog Control 11.3.7 PORTB Functions and Output Priorities 11.4 Register Definitions: PORTB Register 11-9: PORTB: PORTB Register Register 11-10: TRISB: PORTB Tri-State Register Register 11-11: LATB: PORTB Data Latch Register Register 11-12: ANSELB: PORTB Analog Select Register Register 11-13: WPUB: Weak Pull-up PORTB Register Register 11-14: ODCONB: PORTB Open-Drain Control Register Register 11-15: SLRCONB: PORTB Slew Rate Control Register Register 11-16: INLVLB: PORTB Input Level Control Register TABLE 11-4: Summary of Registers Associated with PORTB 11.5 PORTC Registers 11.5.1 Data Register 11.5.2 Direction Control 11.5.3 Input Threshold Control 11.5.4 Open-Drain Control 11.5.5 Slew Rate Control 11.5.6 Analog Control 11.5.7 PORTC Functions and Output Priorities 11.5.8 High-Current Drive Control 11.6 Register Definitions: PORTC Register 11-17: PORTC: PORTC Register Register 11-18: TRISC: PORTC Tri-State Register Register 11-19: LATC: PORTC Data Latch Register Register 11-20: ANSELC: PORTC Analog Select Register Register 11-21: WPUC: Weak Pull-up PORTC Register Register 11-22: ODCONC: PORTC Open-Drain Control Register Register 11-23: SLRCONC: PORTC Slew Rate Control Register Register 11-24: INLVLC: PORTC Input Level Control Register Register 11-25: HIDRVC: PORTC High Drive Control Register TABLE 11-5: Summary of Registers Associated with PORTC 12.0 Peripheral Pin Select (PPS) Module 12.1 PPS Inputs 12.2 PPS Outputs FIGURE 12-1: Simplified PPS Block Diagram 12.3 Bidirectional Pins 12.4 PPS Lock EXAMPLE 12-1: PPS Lock/Unlock Sequence 12.5 PPS Permanent Lock 12.6 Operation During Sleep 12.7 Effects of a Reset 12.8 Register Definitions: PPS Input and Output Selections Register 12-1: xxxPPS: Peripheral xxx Input Selection Register 12-2: RxyPPS: Pin Rxy Output Source Selection Register Register 12-3: PPSLOCK: PPS Lock Register TABLE 12-1: PPS Input Register Reset Values TABLE 12-2: Available Ports for Output by Peripheral(2) TABLE 12-3: Summary of Registers Associated with the PPS Module 13.0 Interrupt-On-Change 13.1 Enabling the Module 13.2 Individual Pin Configuration 13.3 Interrupt Flags 13.4 Clearing Interrupt Flags EXAMPLE 13-1: Clearing Interrupt Flags (PORTA Example) 13.5 Operation in Sleep FIGURE 13-1: Interrupt-On-Change Block Diagram (PORTA Example) 13.6 Register Definitions: Interrupt-On-Change Control Register 13-1: IOCAP: Interrupt-On-Change PORTA Positive Edge Register Register 13-2: IOCAN: Interrupt-On-Change PORTA Negative Edge Register Register 13-3: IOCAF: Interrupt-On-Change PORTA Flag Register Register 13-4: IOCBP: Interrupt-On-Change PORTB Positive Edge Register(1) Register 13-5: IOCBN: Interrupt-On-Change PORTB Negative Edge Register(1) Register 13-6: IOCBF: Interrupt-On-Change PORTB Flag Register(1) Register 13-7: IOCCP: Interrupt-On-Change PORTC Positive Edge Register Register 13-8: IOCCN: Interrupt-On-Change PORTC Negative Edge Register Register 13-9: IOCCF: Interrupt-On-Change PORTC Flag Register TABLE 13-1: Summary of Registers Associated with Interrupt-On-Change 14.0 Fixed Voltage Reference (FVR) 14.1 Independent Gain Amplifiers 14.2 FVR Stabilization Period 14.3 FVR Buffer Stabilization Period FIGURE 14-1: Voltage Reference Block Diagram TABLE 14-1: Peripherals Requiring the Fixed Voltage Reference (FVR) 14.4 Register Definitions: FVR Control Register 14-1: FVRCON: Fixed Voltage Reference Control Register TABLE 14-2: Summary of Registers Associated with Fixed Voltage Reference 15.0 Temperature Indicator Module 15.1 Circuit Operation EQUATION 15-1: Vout Ranges FIGURE 15-1: Temperature Circuit Diagram 15.2 Minimum Operating Vdd TABLE 15-1: Recommended Vdd vs. Range 15.3 Temperature Output 15.4 ADC Acquisition Time TABLE 15-2: Summary of Registers Associated with the Temperature Indicator 16.0 Analog-to-Digital Converter (ADC) Module FIGURE 16-1: ADC Block Diagram 16.1 ADC Configuration 16.1.1 Port Configuration 16.1.2 Channel Selection 16.1.3 ADC Positive Voltage Reference 16.1.4 ADC Negative Voltage Reference 16.1.5 Conversion Clock TABLE 16-1: ADC Clock Period (Tad) vs. Device Operating Frequencies FIGURE 16-2: Analog-to-Digital Conversion Tad Cycles 16.1.6 Interrupts 16.1.7 Result Formatting FIGURE 16-3: 10-Bit ADC Conversion Result Format 16.2 ADC Operation 16.2.1 Starting a Conversion 16.2.2 Completion of a Conversion 16.2.3 Terminating a Conversion 16.2.4 ADC Operation During Sleep 16.2.5 Auto-Conversion Trigger TABLE 16-2: Auto-Conversion Sources 16.2.6 ADC Conversion Procedure EXAMPLE 16-1: ADC Conversion 16.3 Register Definitions: ADC Control Register 16-1: ADCON0: ADC Control Register 0 Register 16-2: ADCON1: ADC Control Register 1 Register 16-3: ADCON2: ADC Control Register 2 Register 16-4: ADRESH: ADC Result Register High (ADFM = 0) Register 16-5: ADRESL: ADC Result Register Low (ADFM = 0) Register 16-6: ADRESH: ADC Result Register High (ADFM = 1) Register 16-7: ADRESL: ADC Result Register Low (ADFM = 1) 16.4 ADC Acquisition Requirements EQUATION 16-1: Acquisition Time Example FIGURE 16-4: Analog Input Model FIGURE 16-5: ADC Transfer Function TABLE 16-3: Summary of Registers Associated with ADC 17.0 5-Bit Digital-to-Analog Converter (DAC) Module TABLE 17-1: Available 5-Bit DACs 17.1 Output Voltage Selection EQUATION 17-1: DAC Output Voltage 17.2 Ratiometric Output Level 17.3 DAC Voltage Reference Output FIGURE 17-1: Digital-to-Analog Converter Block Diagram FIGURE 17-2: Voltage Reference Output Buffer Example 17.4 Operation During Sleep 17.5 Effects of a Reset 17.6 Register Definitions: DAC Control TABLE 17-2: Bit Name Prefixes Register 17-1: DACxCON0: DACx Control Register 0 Register 17-2: DACxREF: DACx Reference Voltage Output Select Register TABLE 17-3: Summary of Registers Associated with the DACx Module 18.0 10-Bit Digital-to-Analog Converter (DAC) Module TABLE 18-1: Available 10-Bit DACs 18.1 Output Voltage Level Selection EQUATION 18-1: DAC Output Voltage 18.2 Ratiometric Output Voltage 18.3 DAC Output 18.4 DAC Reference Selection Justification FIGURE 18-1: DAC Justification FIGURE 18-2: Digital-to-Analog Converter Block Diagram FIGURE 18-3: Voltage Reference Output Buffer Example 18.5 Operation During Sleep 18.6 Effects of a Reset 18.7 Register Definitions: DAC Control TABLE 18-2: Bit Name Prefixes Register 18-1: DACxCON0: DACx Control Register 0 Register 18-2: DACxREFH: DACx Reference Voltage Select High Register Register 18-3: DACxREFL: DACx Reference Voltage Select Low Register Register 18-4: DACLD: DAC Buffer Load Register TABLE 18-3: Summary of Registers Associated with the DACx Module 19.0 Comparator Module 19.1 Comparator Overview TABLE 19-1: Available Comparators FIGURE 19-1: Single Comparator FIGURE 19-2: Comparator Module Simplified Block Diagram 19.2 Comparator Control 19.2.1 Comparator Enable 19.2.2 Comparator Output Selection 19.2.3 Comparator Output Polarity TABLE 19-2: Comparator Output State vs. Input Conditions 19.3 Comparator Hysteresis 19.4 Timer1 Gate Operation 19.4.1 Comparator Output Synchronization 19.5 Comparator Interrupt 19.6 Comparator Positive Input Selection 19.7 Comparator Negative Input Selection 19.8 Comparator Response Time 19.9 Zero Latency Filter FIGURE 19-3: Comparator Zero Latency Filter Operation 19.10 Analog Input Connection Considerations FIGURE 19-4: Analog Input Model 19.11 Register Definitions: Comparator Control TABLE 19-3: Bit Name Prefixes Register 19-1: CMxCON0: Comparator Cx Control Register 0 Register 19-2: CMxCON1: Comparator Cx Control Register 1 Register 19-3: CMxNSEL: Comparator Cx Negative Channel Select Register Register 19-4: CMxPSEL: Comparator Cx Positive Channel Select Register 1 Register 19-5: CMOUT: Comparator Output Register TABLE 19-4: Summary of Registers Associated with Comparator Module 20.0 Zero-Cross Detection (ZCD) Module 20.1 External Resistor Selection EQUATION 20-1: External Resistor FIGURE 20-1: External Voltage FIGURE 20-2: Simplified ZCD Block Diagram 20.2 ZCD Logic Output 20.3 ZCD Logic Polarity 20.4 ZCD Interrupts 20.5 Correcting for Zcpinv Offset 20.5.1 Correction by AC Coupling EQUATION 20-2: R-C Calculations EQUATION 20-3: R-C Calculations Example 20.5.2 Correction by offset current EQUATION 20-4: ZCD Event Offset EQUATION 20-5: ZCD Pull-up/down 20.6 Handling Vpeak variations EQUATION 20-6: Series R for V Range 20.7 Operation During Sleep 20.8 Effects of a Reset 20.9 Register Definitions: ZCD Control TABLE 20-1: Bit Name Prefixes Register 20-1: ZCDxCON: Zero-Cross Detection x Control Register TABLE 20-2: Summary of Registers Associated with the ZCD Module TABLE 20-3: Summary of Configuration Word with the ZCD Module 21.0 Timer0 Module 21.1 Timer0 Operation 21.1.1 8-Bit Timer Mode 21.1.2 8-Bit Counter Mode FIGURE 21-1: Block Diagram of Timer0 21.1.3 Software Programmable Prescaler 21.1.4 Timer0 Interrupt 21.1.5 8-Bit Counter Mode Synchronization 21.1.6 Operation During Sleep 21.2 Register Definitions: Option Register Register 21-1: OPTION_REG: OPTION Register TABLE 21-1: Summary of Registers Associated with Timer0 22.0 Timer1/3/5 Module with Gate Control FIGURE 22-1: Timer1 Block Diagram 22.1 Timer1 Operation TABLE 22-1: Timer1 Enable Selections 22.2 Clock Source Selection 22.2.1 Internal Clock Source 22.2.2 External Clock Source TABLE 22-2: Clock Source Selections 22.3 Timer1 Prescaler 22.4 Timer1 (Secondary) Oscillator 22.5 Timer1 Operation in Asynchronous Counter Mode 22.5.1 Reading and Writing Timer1 in Asynchronous Counter Mode 22.6 Timer1 Gate 22.6.1 Timer1 Gate Enable TABLE 22-3: Timer1 Gate Enable Selections 22.6.2 Timer1 Gate Source Selection TABLE 22-4: Timer1 Gate Sources 22.6.2.1 T1G Pin Gate Operation 22.6.2.2 Timer0 Overflow Gate Operation 22.6.2.3 Comparator C1 Gate Operation 22.6.2.4 Comparator C2 Gate Operation 22.6.3 Timer1 Gate Toggle Mode 22.6.4 Timer1 Gate Single-Pulse Mode 22.6.5 Timer1 Gate Value Status 22.6.6 Timer1 Gate Event Interrupt 22.7 Timer1 Interrupt 22.8 Timer1 Operation During Sleep 22.9 CCP Capture/Compare Time Base 22.10 CCP Auto-Conversion Trigger FIGURE 22-2: Timer1 Incrementing Edge FIGURE 22-3: Timer1 Gate Enable Mode FIGURE 22-4: Timer1 Gate Toggle Mode FIGURE 22-5: Timer1 Gate Single-Pulse Mode FIGURE 22-6: Timer1 Gate Single-Pulse and Toggle Combined Mode 22.11 Register Definitions: Timer1 Control TABLE 22-5: Bit Name Prefixes Register 22-1: T1CON: Timer1 Control Register Register 22-2: T1GCON: Timer1 Gate Control Register TABLE 22-6: Summary of Registers Associated with Timer1 23.0 Timer2/4/6 Module FIGURE 23-1: Timer2 Block Diagram FIGURE 23-2: Timer2 Clock Source Block Diagram 23.1 Timer2 Operation 23.1.1 Free-Running Period Mode 23.1.2 One-Shot Mode 23.1.3 Monostable Mode 23.2 Timer2 Output 23.3 External Reset Sources 23.4 Operating Modes TABLE 23-1: Timer2 Operating Modes 23.5 Timer2 Interrupt FIGURE 23-3: Timer2 Prescaler, Postscaler and Interrupt Timing Diagram 23.6 Operation Examples 23.6.1 Software Gate Mode FIGURE 23-4: Software Gate Mode Timing Diagram (MODE<4:0> = 00000) 23.6.2 Hardware Gate Mode FIGURE 23-5: Hardware Gate Mode Timing Diagram (MODE<4:0> = 00001) 23.6.3 Edge-Triggered Hardware Limit Mode FIGURE 23-6: Edge-Triggered Hardware Limit Mode Timing Diagram (MODE<4:0> = 00100) 23.6.4 Level-Triggered Hardware Limit Mode FIGURE 23-7: Level-Triggered Hardware Limit Mode Timing Diagram (MODE<4:0> = 00111) 23.6.5 Software Start One-Shot Mode FIGURE 23-8: Software Start One-Shot Mode Timing Diagram (MODE<4:0> = 01000) 23.6.6 Edge-Triggered One-Shot Mode FIGURE 23-9: Edge-Triggered One-Shot Mode Timing Diagram (MODE<4:0> = 01001) 23.6.7 Edge-Triggered Hardware Limit One-Shot Mode FIGURE 23-10: Edge-Triggered Hardware Limit One-Shot Mode Timing Diagram (MODE<4:0> = 01100) 23.6.8 Level Reset, Edge-Triggered Hardware Limit One-Shot Modes FIGURE 23-11: Low-Level Reset, Edge-Triggered Hardware Limit One-Shot Mode Timing Diagram (MODE<4:0> = 01110) 23.6.9 Edge-Triggered Monostable Modes FIGURE 23-12: Rising Edge-Triggered Monostable Mode Timing Diagram (MODE<4:0> = 10001) 23.6.10 Level-Triggered Hardware Limit One-Shot Modes FIGURE 23-13: Level-Triggered Hardware Limit One-Shot Mode Timing Diagram (MODE<4:0> = 10110) 23.7 PR2 Period Register 23.8 Timer2 Operation During Sleep 23.9 Register Definitions: Timer2/4/6 Control TABLE 23-2: Bit Name Prefixes Register 23-1: TxCLKCON: Timerx Clock Selection Register TABLE 23-3: Timerx Clock Sources Register 23-2: TxCON: Timerx Control Register Register 23-3: TxHLT: Timerx Hardware Limit Control Register Register 23-4: TxRST: Timerx External Reset Signal Selection Register TABLE 23-4: External Reset Sources TABLE 23-5: Summary of Registers Associated with Timer2 24.0 Capture/Compare/PWM Modules TABLE 24-1: Available CCP Modules 24.1 Capture Mode 24.1.1 CCP Pin Configuration FIGURE 24-1: Capture Mode Operation Block Diagram 24.1.2 Timer1 Mode Resource 24.1.3 Software Interrupt Mode 24.1.4 CCP Prescaler 24.1.5 Capture During Sleep 24.1.6 Alternate Pin Locations 24.1.7 Capture Output 24.2 Compare Mode 24.2.1 Auto-Conversion Trigger 24.2.2 CCPx Pin Configuration FIGURE 24-2: Compare Mode Operation Block Diagram 24.2.3 Timer1 Mode Resource 24.2.4 Software Interrupt Mode 24.2.5 Compare During Sleep 24.2.6 Alternate Pin Locations 24.2.7 Capture Output 24.3 PWM Overview FIGURE 24-3: Simplified PWM Block Diagram 24.3.1 Standard PWM Operation 24.3.2 Setup for PWM Operation 24.4 CCP/PWM Clock Selection 24.4.1 Using the TMR2/4/6 with the CCP Module 24.4.2 PWM Period EQUATION 24-1: PWM Period 24.4.3 PWM Duty Cycle EQUATION 24-2: Pulse Width EQUATION 24-3: Duty Cycle Ratio FIGURE 24-4: CCPx Duty Cycle Alignment 24.4.4 PWM Resolution EQUATION 24-4: PWM Resolution TABLE 24-2: Example PWM Frequencies and Resolutions (Fosc = 20 MHz) TABLE 24-3: Example PWM Frequencies and Resolutions (Fosc = 8 MHz) 24.4.5 Changes in System Clock Frequency 24.4.6 Effects of Reset 24.4.7 PWM Output 24.5 Register Definitions: CCP Control Register 24-1: CCPxCON: CCPx Control Register Register 24-2: CCPTMRS: PWM Timer Selection Control Register Register 24-3: CCPRxL: CCPx Low Byte Register Register 24-4: CCPRxH: CCPx High Byte Register Register 24-5: CCPxCAP: CCPx Capture Input Selection Register TABLE 24-4: Summary of Registers Associated with Standard PWM 25.0 10-Bit Pulse-Width Modulation (PWM) Module FIGURE 25-1: Simplified PWM Block Diagram FIGURE 25-2: PWM Output 25.1 PWMx Pin Configuration 25.2 Fundamental Operation 25.3 PWM Output Polarity 25.4 PWM Period EQUATION 25-1: PWM Period 25.5 PWM Duty Cycle EQUATION 25-2: Pulse Width EQUATION 25-3: Duty Cycle Ratio 25.6 PWM Resolution EQUATION 25-4: PWM Resolution TABLE 25-1: Example PWM Frequencies and Resolutions (Fosc = 20 MHz) TABLE 25-2: Example PWM Frequencies and Resolutions (Fosc = 8 MHz) 25.7 Operation in Sleep Mode 25.8 Changes in System Clock Frequency 25.9 Effects of Reset 25.10 Set-up Procedures 25.10.1 Setup for PWM Operation Using PWMx Output Pins 25.10.2 Setup for PWM Operation to Other Device Peripherals 25.11 Register Definitions: 10-Bit PWM Control TABLE 25-3: Bit Name Prefixes Register 25-1: PWMxCON: PWMx Control Register Register 25-2: PWMXDCH: PWMx Duty Cycle Register High Bits Register 25-3: PWMxDCL: PWMx Duty Cycle Register Low Bits TABLE 25-4: Summary of Registers Associated with 10-bit PWM 26.0 16-Bit Pulse-Width Modulation (PWM) Module FIGURE 26-1: 16-Bit PWMx Block Diagram FIGURE 26-2: Load Trigger Block Diagram 26.1 Fundamental Operation FIGURE 26-3: PWMx Clock Source Block Diagram 26.1.1 PWMx Pin Configuration 26.1.2 PWMx Output Polarity 26.2 PWM Modes 26.2.1 Standard Mode EQUATION 26-1: PWM Period in Standard Mode EQUATION 26-2: PWM Duty Cycle in Standard Mode 26.2.2 Set On Match Mode 26.2.3 Toggle On Match Mode 26.2.4 Center-Aligned Mode EQUATION 26-3: PWM Period in Center-Aligned Mode EQUATION 26-4: PWM Duty Cycle in Center-Aligned Mode FIGURE 26-4: Standard PWMx Mode Timing Diagram FIGURE 26-5: Set On Match PWMx Mode Timing Diagram FIGURE 26-6: Toggle On Match PWMx Mode Timing Diagram FIGURE 26-7: Center-Aligned PWMx Mode Timing Diagram 26.3 Offset Modes 26.3.1 Independent Run Mode 26.3.2 Slave Run Mode with Sync Start 26.3.3 One-Shot Slave Mode with Sync Start 26.3.4 Continuous Run Slave Mode with Sync Start and Timer Reset 26.3.5 Offset Match in Center-Aligned Mode FIGURE 26-8: Independent Run Mode Timing Diagram FIGURE 26-9: Slave Run Mode with Sync Start Timing Diagram FIGURE 26-10: One-Shot Slave Run Mode with Sync Start Timing Diagram FIGURE 26-11: Continuous Slave Run Mode with Immediate Reset and Sync Start Timing Diagram FIGURE 26-12: Offset Match on Incrementing Timer Timing Diagram FIGURE 26-13: Offset Match on Decrementing Timer Timing Diagram 26.4 Reload Operation 26.4.1 Immediate Reload 26.4.2 Triggered Reload 26.5 Operation in Sleep Mode 26.6 Interrupts 26.7 Register Definitions: PWM Control TABLE 26-1: Bit Name Prefixes Register 26-1: PWMxCON: PWMx Control Register Register 26-2: PWMxINTE: PWMx Interrupt Enable Register Register 26-3: PWMxINTF: PWMx Interrupt Request Register Register 26-4: PWMxCLKCON: PWMx Clock Control Register Register 26-5: PWMxLDCON: PWMx Reload Trigger Source Select Register Register 26-6: PWMxOFCON: PWMx Offset Trigger Source Select Register Register 26-7: PWMxPHH: PWMx Phase Count High Register Register 26-8: PWMxPHL: PWMx Phase Count Low Register Register 26-9: PWMxDCH: PWMx Duty Cycle Count High Register Register 26-10: PWMxDCL: PWMx Duty Cycle Count Low Register Register 26-11: PWMxPRH: PWMx Period Count High Register Register 26-12: PWMxPRL: PWMx Period Count Low Register Register 26-13: PWMxOFH: PWMx Offset Count High Register Register 26-14: PWMxOFL: PWMx Offset Count Low Register Register 26-15: PWMxTMRH: PWMx Timer High Register Register 26-16: PWMxTMRL: PWMx Timer Low Register Register 26-17: PWMEN: PWMEN Bit Mirror Register Register 26-18: PWMLD: LDA Bit Mirror Register Register 26-19: PWMOUT: PWMOUT Bit Mirror Register TABLE 26-2: Summary of Registers Associated with PWMx TABLE 26-3: Summary of Configuration Words with Clock Sources 27.0 Complementary Output Generator (COG) Module 27.1 Output to Pins (all modes) 27.2 Event-Driven PWM (All Modes) 27.3 Modes of Operation 27.3.1 Steered PWM Modes 27.3.2 Full-Bridge Modes FIGURE 27-1: Example of Full-Bridge Application 27.3.3 Half-Bridge Mode 27.3.4 Push-Pull Mode FIGURE 27-2: Simplified COG Block Diagram (Steered PWM Mode, MD<2:0> = 0) FIGURE 27-3: Simplified COG Block Diagram (Synchronous Steered PWM Mode, MD<2:0> = 1) FIGURE 27-4: Simplified COG Block Diagram (Full-Bridge Modes, Forward: MD<2:0> = 2, Reverse: MD<2:0> = 3) FIGURE 27-5: Simplified COG Block Diagram (Half-Bridge Mode, MD<2:0> = 4) FIGURE 27-6: Simplified COG Block Diagram (Push-Pull Mode, MD<2:0> = 5) FIGURE 27-7: COG (Rising/Falling) Input Block FIGURE 27-8: COG (Rising/Falling) Dead-Band Block FIGURE 27-9: Typical Half-Bridge Mode COG Operation with CCP1 FIGURE 27-10: Half-Bridge Mode COG Operation with CCP1 and Phase Delay FIGURE 27-11: Push-Pull Mode COG Operation with CCP1 FIGURE 27-12: Full-Bridge Forward Mode COG Operation with CCP1 FIGURE 27-13: Full-Bridge Mode COG Operation with CCP1 and Direction Change 27.4 Clock Sources 27.5 Selectable Event Sources 27.5.1 Edge vs. Level Sensing FIGURE 27-14: Edge vs. Level Sense 27.5.2 Rising Event 27.5.3 Falling Event 27.6 Output Control 27.6.1 Output Enables TABLE 27-1: Pin Output States MD<2:0> = 00x TABLE 27-2: Pin Output States MD<2:0> > 001 27.6.2 Polarity Control 27.7 Dead-Band Control 27.7.1 Asynchronous Delay Chain Dead-Band Delay 27.7.2 Synchronous Counter Dead-Band Delay 27.7.3 Synchronous Counter Dead-Band Time Uncertainty 27.7.4 Rising Event Dead-Band 27.7.5 Falling Event Dead-Band 27.7.6 Dead-Band Overlap 27.7.6.1 Rising-to-Falling Overlap 27.7.6.2 Falling-to-Rising Overlap 27.8 Blanking Control 27.8.1 Falling Event Blanking of Rising Event Inputs 27.8.2 Rising Event Blanking of Falling Event Inputs 27.8.3 Blanking Time Uncertainty 27.9 Phase Delay 27.9.1 Cumulative Uncertainty EQUATION 27-1: Phase, Dead-Band and Blanking Time Calculation EXAMPLE 27-1: Timer Uncertainty 27.10 Auto-Shutdown Control 27.10.1 Shutdown 27.10.1.1 Software Generated Shutdown 27.10.1.2 External Shutdown Source 27.10.2 Pin Override Levels 27.10.3 Auto-Shutdown Restart 27.10.3.1 Software Controlled Restart 27.10.3.2 Auto-Restart FIGURE 27-15: Auto-Shutdown Waveform – CCP1 as Rising and Falling Event Input Source 27.11 Buffer Updates 27.12 Input and Output Pin Selection 27.13 Operation During Sleep 27.14 Configuring the COG 27.15 Register Definitions: COG Control TABLE 27-3: Bit Name Prefixes Register 27-1: COGxCON0: COGx Control Register 0 Register 27-2: COGxCON1: COGx Control Register 1 Register 27-3: COGxRIS0: COGx Rising Event Input Selection Register 0 Register 27-4: COGxRIS1: COGx Rising Event Input Selection Register 1 Register 27-5: COGxRSIM0: COGx Rising Event Source Input Mode Register 0 Register 27-6: COGxRSIM1: COGx Rising Event Source Input Mode Register 1 Register 27-7: COGxFIS0: COGx Falling Event Input Selection Register 0 Register 27-8: COGxFIS1: COGx Falling Event Input Selection Register 1 Register 27-9: COGxFSIM0: COGx Falling Event Source Input Mode Register 0 Register 27-10: COGxFSIM1: COGx Falling Event Source Input Mode Register 1 Register 27-11: COGxASD0: COGx Auto-Shutdown Control Register 0 Register 27-12: COGxASD1: COGx Auto-Shutdown Control Register 1 Register 27-13: COGxSTR: COGx Steering Control Register 1(1) Register 27-14: COGxDBR: COGx Rising Event Dead-Band Count Register Register 27-15: COGxDBF: COGx Falling Event Dead-Band Count Register Register 27-16: COGxBLKR: COGx Rising Event Blanking Count Register Register 27-17: COGxBLKF: COGx Falling Event Blanking Count Register Register 27-18: COGxPHR: COGx Rising Event Phase Delay Count Register Register 27-19: COGxPHF: COGx Falling Event Phase Delay Count Register TABLE 27-4: Summary of Registers Associated with COGx 28.0 Configurable Logic Cell (CLC) FIGURE 28-1: CLCx Simplified Block Diagram 28.1 CLCx Setup 28.1.1 Data Selection TABLE 28-1: CLCx Data Input Selection 28.1.2 Data Gating TABLE 28-2: Data Gating Logic 28.1.3 Logic Function 28.1.4 Output Polarity 28.1.5 CLCx Setup Steps 28.2 CLCx Interrupts 28.3 Output Mirror Copies 28.4 Effects of a Reset 28.5 Operation During Sleep FIGURE 28-2: Input Data Selection and Gating FIGURE 28-3: Programmable Logic Functions 28.6 Register Definitions: CLC Control TABLE 28-3: Bit Name Prefixes Register 28-1: CLCxCON: CLCx Control Register Register 28-2: CLCxPOL: CLCx Signal Polarity Control Register Register 28-3: CLCxSEL0: Generic CLCx Data 1 Select Register Register 28-4: CLCxSEL1: Generic CLCx Data 2 Select Register Register 28-5: CLCxSEL2: Generic CLCx Data 3 Select Register Register 28-6: CLCxSEL3: Generic CLCx Data 4 Select Register Register 28-7: CLCxGLS0: CLCx Gate 1 Logic Select Register Register 28-8: CLCxGLS1: CLCx Gate 2 Logic Select Register Register 28-9: CLCxGLS2: CLCx Gate 3 Logic Select Register Register 28-10: CLCxGLS3: CLCx Gate 4 Logic Select Register Register 28-11: CLCxDATA: CLCx Data Output TABLE 28-4: Summary of Registers Associated with CLCx 29.0 Operational Amplifier (OPA) Modules FIGURE 29-1: OPAx Module Block Diagram 29.1 OPA Module Performance 29.2 OPA Module Control 29.2.1 Unity Gain Mode 29.2.2 Programmable Source Selections 29.3 Override Control 29.3.1 Override Mode 29.3.2 Override Sources 29.3.3 Override Source Polarity 29.4 Effects of Reset 29.5 Effects of Sleep 29.6 Register Definitions: Op Amp Control TABLE 29-1: Bit Name Prefixes Register 29-1: OPAxCON: Operational Amplifier x (OPAx) Control Register Register 29-2: OPAxORS: Op Amp x Override Source Selection Register Register 29-3: OPAxNCHS: Op Amp x Negative Channel Source Select Register Register 29-4: OPAxPCHS: Op Amp x Positive Channel Source Select Register TABLE 29-2: Summary of Registers Associated with Op Amps 30.0 Programmable Ramp Generator (PRG) Module 30.1 Fundamental Operation 30.1.1 Slope Compensation 30.1.2 Ramp Generation 30.1.2.1 Alternating Rising/Falling Ramps 30.1.2.2 Rising Ramp 30.2 Enable, Ready, Go 30.3 Independent Set_rising and Set_falling Timing Inputs 30.4 Level and Edge Timing Sensitivity 30.5 One-Shot Minimum Timing 30.6 DAC Voltage Sources 30.7 Operation During Sleep 30.8 Effects of a Reset FIGURE 30-1: Simplified PRG Module Block Diagram FIGURE 30-2: Slope Compensation (Falling Ramp) Timing Diagram (MODE<1:0> = 00) FIGURE 30-3: Alternating Rising/Falling Ramp Generation Timing Diagram (OS = 0, MODE<1:0> = 01) FIGURE 30-4: Alternating Rising/Falling Ramp Generation Timing Diagram (OS = 1, MODE<1:0> = 01) FIGURE 30-5: Rising Ramp Generation Timing Diagram (MODE<1:0> = 10) 30.9 Slope Compensation Application EQUATION 30-1: Compensator Slope EQUATION 30-2: Calculation Example FIGURE 30-6: Example Slope Compensation Circuit 30.10 Register Definitions: Programmable Ramp Generator TABLE 30-1: Bit Name Prefixes Register 30-1: PRGxCON0: Programmable Ramp Generator x Control 0 Register Register 30-2: PRGxCON1: Programmable Ramp Generator x Control 1 Register Register 30-3: PRGxINS: PRGx Voltage Input Select Register TABLE 30-2: Voltage Input Sources Register 30-4: PRGxCON2: Programmable Ramp Generator x Control 2 Register TABLE 30-3: Programmable Ramp Generator Current Settings Register 30-5: PRGxRTSS: PRGx set_rising Timing Source Select Register Register 30-6: PRGxFTSS: PRGx set_falling Timing Source Select Register TABLE 30-4: Programmable Ramp Generator Timing Sources TABLE 30-5: Summary of Registers Associated with the PRG Module 31.0 Data Signal Modulator (DSM) FIGURE 31-1: Simplified Block Diagram of the Data Signal Modulator 31.1 DSM Operation 31.2 Modulator Signal Sources 31.3 Carrier Signal Sources 31.4 Carrier Synchronization FIGURE 31-2: On-Off Keying (OOK) Synchronization FIGURE 31-3: No Synchronization (MDCHSYNC = 0, MDCLSYNC = 0) FIGURE 31-4: Carrier High Synchronization (MDCHSYNC = 1, MDCLSYNC = 0) FIGURE 31-5: Carrier Low Synchronization (MDCHSYNC = 0, MDCLSYNC = 1) FIGURE 31-6: Full Synchronization (MDCHSYNC = 1, MDCLSYNC = 1) 31.5 Input and Output Through Pins TABLE 31-1: Pin Selections 31.6 Carrier Source Polarity Select 31.7 Programmable Modulator Data 31.8 Modulated Output Polarity 31.9 Operation in Sleep Mode 31.10 Effects of a Reset 31.11 Register Definitions: Data Signal Modulator TABLE 31-2: Bit Name Prefixes Register 31-1: MDxCON0: Modulation x Control Register 0 Register 31-2: MDxCON1: Modulation x Control Register 1 Register 31-3: MDxSRC: Modulation x Source Control Register TABLE 31-3: Modulation Source Register 31-4: MDxCARH: Modulation x Carrier High Control Register TABLE 31-4: High Carrier Sources Register 31-5: MDxCARL: Modulation x Carrier Low Control Register TABLE 31-5: Low Carrier Sources TABLE 31-6: Summary of Registers Associated with Data Signal Modulator Mode 32.0 Master Synchronous Serial Port (MSSP) Module 32.1 MSSP Module Overview FIGURE 32-1: MSSP Block Diagram (SPI Mode) FIGURE 32-2: MSSP Block Diagram (I2C Master Mode) FIGURE 32-3: MSSP Block Diagram (I2C Slave Mode) 32.2 SPI Mode Overview FIGURE 32-4: SPI Master and Multiple Slave Connection 32.2.1 SPI Mode Registers 32.2.2 SPI Mode Operation FIGURE 32-5: SPI Master/Slave Connection 32.2.3 SPI Master Mode FIGURE 32-6: SPI Mode Waveform (Master Mode) 32.2.4 SPI Slave Mode 32.2.4.1 Daisy-Chain Configuration 32.2.5 Slave Select Synchronization FIGURE 32-7: SPI Daisy-Chain Connection FIGURE 32-8: Slave Select Synchronous Waveform FIGURE 32-9: SPI Mode Waveform (Slave Mode with CKE = 0) FIGURE 32-10: SPI Mode Waveform (Slave Mode with CKE = 1) 32.2.6 SPI Operation in Sleep Mode TABLE 32-1: Summary of Registers Associated with SPI Operation 32.3 I2C Mode Overview FIGURE 32-11: I2C Master/ Slave Connection 32.3.1 Clock Stretching 32.3.2 Arbitration 32.4 I2C Mode Operation 32.4.1 Byte Format 32.4.2 Definition of I2C Terminology 32.4.3 SDA and SCL Pins 32.4.4 SDA Hold Time TABLE 32-2: I2C Bus Terms 32.4.5 Start Condition 32.4.6 Stop Condition 32.4.7 Restart Condition 32.4.8 Start/Stop Condition Interrupt Masking FIGURE 32-12: I2C Start and Stop Conditions FIGURE 32-13: I2C Restart Condition 32.4.9 Acknowledge Sequence 32.5 I2C Slave Mode Operation 32.5.1 Slave Mode Addresses 32.5.1.1 I2C Slave 7-Bit Addressing Mode 32.5.1.2 I2C Slave 10-Bit Addressing Mode 32.5.2 Slave Reception 32.5.2.1 7-Bit Addressing Reception 32.5.2.2 7-Bit Reception with AHEN and DHEN FIGURE 32-14: I2C Slave, 7-Bit Address, Reception (SEN = 0, AHEN = 0, DHEN = 0) FIGURE 32-15: I2C Slave, 7-Bit Address, Reception (SEN = 1, AHEN = 0, DHEN = 0) FIGURE 32-16: I2C Slave, 7-Bit Address, Reception (SEN = 0, AHEN = 1, DHEN = 1) FIGURE 32-17: I2C Slave, 7-Bit Address, Reception (SEN = 1, AHEN = 1, DHEN = 1) 32.5.3 Slave Transmission 32.5.3.1 Slave Mode Bus Collision 32.5.3.2 7-Bit Transmission FIGURE 32-18: I2C Slave, 7-Bit Address, Transmission (AHEN = 0) 32.5.3.3 7-Bit Transmission with Address Hold Enabled FIGURE 32-19: I2C Slave, 7-Bit Address, Transmission (AHEN = 1) 32.5.4 Slave Mode 10-Bit Address Reception 32.5.5 10-Bit Addressing with Address or Data Hold FIGURE 32-20: I2C Slave, 10-Bit Address, Reception (SEN = 1, AHEN = 0, DHEN = 0) FIGURE 32-21: I2C Slave, 10-Bit Address, Reception (SEN = 0, AHEN = 1, DHEN = 0) FIGURE 32-22: I2C Slave, 10-Bit Address, Transmission (SEN = 0, AHEN = 0, DHEN = 0) 32.5.6 Clock Stretching 32.5.6.1 Normal Clock Stretching 32.5.6.2 10-Bit Addressing Mode 32.5.6.3 Byte NACKing 32.5.6.4 Clock Synchronization and the CKP Bit FIGURE 32-23: Clock Synchronization Timing 32.5.7 General Call Address Support FIGURE 32-24: Slave Mode General Call Address Sequence 32.5.8 SSP Mask Register 32.6 I2C Master Mode 32.6.1 I2C Master Mode Operation 32.6.2 Clock Arbitration FIGURE 32-25: Baud Rate Generator Timing with Clock Arbitration 32.6.3 WCOL Status Flag 32.6.4 I2C Master Mode Start Condition Timing FIGURE 32-26: First Start Bit Timing 32.6.5 I2C Master Mode Repeated Start Condition Timing FIGURE 32-27: Repeated Start Condition Waveform 32.6.6 I2C Master Mode Transmission 32.6.6.1 BF Status Flag 32.6.6.2 WCOL Status Flag 32.6.6.3 ACKSTAT Status Flag 32.6.6.4 Typical Transmit Sequence: FIGURE 32-28: I2C Master Mode Waveform (Transmission, 7 or 10-Bit Address) 32.6.7 I2C Master Mode Reception 32.6.7.1 BF Status Flag 32.6.7.2 SSPOV Status Flag 32.6.7.3 WCOL Status Flag 32.6.7.4 Typical Receive Sequence: FIGURE 32-29: I2C Master Mode Waveform (Reception, 7-Bit Address) 32.6.8 Acknowledge Sequence Timing 32.6.8.1 WCOL Status Flag 32.6.9 Stop Condition Timing 32.6.9.1 WCOL Status Flag FIGURE 32-30: Acknowledge Sequence Waveform FIGURE 32-31: Stop Condition Receive or Transmit Mode 32.6.10 Sleep Operation 32.6.11 Effects of a Reset 32.6.12 Multi-Master Mode 32.6.13 Multi -Master Communication, Bus Collision and Bus Arbitration FIGURE 32-32: Bus Collision Timing for Transmit and Acknowledge 32.6.13.1 Bus Collision During a Start Condition FIGURE 32-33: Bus Collision During Start Condition (SDA Only) FIGURE 32-34: Bus Collision During Start Condition (SCL = 0) FIGURE 32-35: BRG Reset Due to SDA Arbitration During Start Condition 32.6.13.2 Bus Collision During a Repeated Start Condition FIGURE 32-36: Bus Collision During a Repeated Start Condition (Case 1) FIGURE 32-37: Bus Collision During Repeated Start Condition (Case 2) 32.6.13.3 Bus Collision During a Stop Condition FIGURE 32-38: Bus Collision During a Stop Condition (Case 1) FIGURE 32-39: Bus Collision During a Stop Condition (Case 2) TABLE 32-3: Summary of Registers Associated with I2C Operation 32.7 Baud Rate Generator FIGURE 32-40: Baud Rate Generator Block Diagram TABLE 32-4: MSSP Clock Rate w/BRG 32.8 Register Definitions: MSSP Control Register 32-1: SSP1STAT: MSSP Status Register Register 32-2: SSP1CON1: MSSP Control Register 1 Register 32-3: SSP1CON2: MSSP Control Register 2(1) Register 32-4: SSP1CON3: MSSP Control Register 3 Register 32-5: SSP1MSK: MSSP Mask Register Register 32-6: SSP1ADD: MSSP Address and Baud Rate Register (I2C Mode) 33.0 Enhanced Universal Synchronous Asynchronous Receiver Transmitter (EUSART) FIGURE 33-1: EUSART Transmit Block Diagram FIGURE 33-2: EUSART Receive Block Diagram 33.1 EUSART Asynchronous Mode 33.1.1 EUSART Asynchronous Transmitter 33.1.1.1 Enabling the Transmitter 33.1.1.2 Transmitting Data 33.1.1.3 Transmit Data Polarity 33.1.1.4 Transmit Interrupt Flag 33.1.1.5 TSR Status 33.1.1.6 Transmitting 9-Bit Characters 33.1.1.7 Asynchronous Transmission Setup FIGURE 33-3: Asynchronous Transmission FIGURE 33-4: Asynchronous Transmission (Back-to-Back) TABLE 33-1: Summary of Registers Associated with Asynchronous Transmission 33.1.2 EUSART Asynchronous Receiver 33.1.2.1 Enabling the Receiver 33.1.2.2 Receiving Data 33.1.2.3 Receive Interrupts 33.1.2.4 Receive Framing Error 33.1.2.5 Receive Overrun Error 33.1.2.6 Receiving 9-Bit Characters 33.1.2.7 Address Detection 33.1.2.8 Asynchronous Reception Setup 33.1.2.9 9-bit Address Detection Mode Setup FIGURE 33-5: Asynchronous Reception TABLE 33-2: Summary of Registers Associated with Asynchronous Reception 33.2 Clock Accuracy with Asynchronous Operation 33.3 Register Definitions: EUSART Control Register 33-1: TX1STA: Transmit Status and Control Register Register 33-2: RC1STA: Receive Status and Control Register Register 33-3: BAUD1CON: Baud Rate Control Register 33.4 EUSART Baud Rate Generator (BRG) EXAMPLE 33-1: Calculating Baud Rate Error TABLE 33-3: Baud Rate Formulas TABLE 33-4: Summary of Registers Associated with the Baud Rate Generator TABLE 33-5: Baud Rates for Asynchronous Modes 33.4.1 Auto-Baud Detect TABLE 33-6: BRG Counter Clock Rates FIGURE 33-6: Automatic Baud Rate Calibration 33.4.2 Auto-Baud Overflow 33.4.3 Auto-Wake-up on Break 33.4.3.1 Special Considerations FIGURE 33-7: Auto-Wake-up Bit (WUE) Timing During Normal Operation FIGURE 33-8: Auto-Wake-up Bit (WUE) Timings During Sleep 33.4.4 Break Character Sequence 33.4.4.1 Break and Sync Transmit Sequence 33.4.5 Receiving a Break Character FIGURE 33-9: Send Break Character Sequence 33.5 EUSART Synchronous Mode 33.5.1 Synchronous Master Mode 33.5.1.1 Master Clock 33.5.1.2 Clock Polarity 33.5.1.3 Synchronous Master Transmission 33.5.1.4 Synchronous Master Transmission Setup FIGURE 33-10: Synchronous Transmission FIGURE 33-11: Synchronous Transmission (Through TXEN) TABLE 33-7: Summary of Registers Associated with Synchronous Master Transmission 33.5.1.5 Synchronous Master Reception 33.5.1.6 Slave Clock 33.5.1.7 Receive Overrun Error 33.5.1.8 Receiving 9-Bit Characters 33.5.1.9 Synchronous Master Reception Setup FIGURE 33-12: Synchronous Reception (Master Mode, SREN) TABLE 33-8: Summary of Registers Associated with Synchronous Master Reception 33.5.2 Synchronous Slave Mode 33.5.2.1 EUSART Synchronous Slave Transmit 33.5.2.2 Synchronous Slave Transmission Setup TABLE 33-9: Summary of Registers Associated with Synchronous Slave Transmission 33.5.2.3 EUSART Synchronous Slave Reception 33.5.2.4 Synchronous Slave Reception Setup TABLE 33-10: Summary of Registers Associated with Synchronous Slave Reception 33.6 EUSART Operation During Sleep 33.6.1 Synchronous Receive During Sleep 33.6.2 Synchronous Transmit During Sleep 34.0 In-Circuit Serial Programming™ (ICSP™) 34.1 High-Voltage Programming Entry Mode 34.2 Low-Voltage Programming Entry Mode 34.3 Common Programming Interfaces FIGURE 34-1: ICD RJ-11 Style Connector Interface FIGURE 34-2: PICkit™ Programmer Style Connector Interface FIGURE 34-3: Typical Connection for ICSP™ Programming 35.0 Instruction Set Summary 35.1 Read-Modify-Write Operations TABLE 35-1: Opcode Field Descriptions TABLE 35-2: Abbreviation Descriptions FIGURE 35-1: General Format for Instructions TABLE 35-3: PIC16(L)F1764/5/8/9 Instruction Set TABLE 35-3: PIC16(L)F1764/5/8/9 Instruction Set (Continued) 35.2 Instruction Descriptions 36.0 Electrical Specifications 36.1 Absolute Maximum Ratings(†) 36.2 Standard Operating Conditions FIGURE 36-1: Voltage Frequency Graph, -40°C £ Ta £ +125°C, PIC16F1764/5/8/9 Only FIGURE 36-2: Voltage Frequency Graph, -40°C £ Ta £ +125°C, PIC16LF1764/5/8/9 Only 36.3 DC Characteristics TABLE 36-1: Supply Voltage FIGURE 36-3: POR and POR Rearm with Slow Rising Vdd TABLE 36-2: Supply Current (Idd)(1,2) TABLE 36-3: Power-Down Currents (Ipd)(1,2) TABLE 36-4: I/O Ports TABLE 36-5: Memory Programming Specifications TABLE 36-6: Thermal Characteristics 36.4 AC Characteristics FIGURE 36-4: Load Conditions FIGURE 36-5: Clock Timing TABLE 36-7: Clock Oscillator Timing Requirements TABLE 36-8: Oscillator Parameters FIGURE 36-6: HFINTOSC Frequency Accuracy Over Device Vdd and Temperature TABLE 36-9: PLL Clock Timing Specifications FIGURE 36-7: CLKOUT and I/O Timing TABLE 36-10: CLKOUT and I/O Timing Parameters FIGURE 36-8: Reset, Watchdog Timer, Oscillator Start-up Timer and Power-up Timer Timing TABLE 36-11: Reset, Watchdog Timer, Oscillator Start-up Timer, Power-up Timer and Brown-out Reset Parameters FIGURE 36-9: Timer0 and Timer1 External Clock Timings FIGURE 36-10: Brown-out Reset Timing and Characteristics TABLE 36-12: Timer0 and Timer1 External Clock Requirements FIGURE 36-11: Capture/Compare/PWM Timings (CCP) TABLE 36-13: Capture/Compare/PWM Requirements (CCP) FIGURE 36-12: CLC Propagation Timing TABLE 36-14: Configuration Logic Cell (CLC) Characteristics TABLE 36-15: Analog-to-Digital Converter (ADC) Characteristics(1,2,3,4) TABLE 36-16: ADC Conversion Requirements FIGURE 36-13: ADC Conversion Timing (ADC Clock Fosc-Based) FIGURE 36-14: ADC Conversion Timing (ADC Clock from FRC) TABLE 36-17: Operational Amplifier (OPA) TABLE 36-18: Programmable Ramp Generator (PRG) Specifications TABLE 36-19: Comparator Specifications TABLE 36-20: 10-Bit Digital-to-Analog Converter (DAC) Specifications TABLE 36-21: 5-Bit Digital-to-Analog Converter (DAC) Specifications TABLE 36-22: Zero-Cross Pin Specifications FIGURE 36-15: EUSART Synchronous Transmission (Master/Slave) Timing TABLE 36-23: EUSART Synchronous Transmission Requirements FIGURE 36-16: EUSART Synchronous Receive (Master/Slave) Timing TABLE 36-24: EUSART Synchronous Receive Requirements FIGURE 36-17: SPI Master Mode Timing (CKE = 0, SMP = 0) FIGURE 36-18: SPI Master Mode Timing (CKE = 1, SMP = 1) FIGURE 36-19: SPI Slave Mode Timing (CKE = 0) FIGURE 36-20: SPI Slave Mode Timing (CKE = 1) TABLE 36-25: SPI Mode Requirements FIGURE 36-21: I2C Bus Start/Stop Bits Timing TABLE 36-26: I2C Bus Start/Stop Bits Requirements FIGURE 36-22: I2C Bus Data Timing TABLE 36-27: I2C Bus Data Requirements 37.0 DC and AC Characteristics Graphs and Charts 38.0 Development Support 38.1 MPLAB X Integrated Development Environment Software 38.2 MPLAB XC Compilers 38.3 MPASM Assembler 38.4 MPLINK Object Linker/ MPLIB Object Librarian 38.5 MPLAB Assembler, Linker and Librarian for Various Device Families 38.6 MPLAB X SIM Software Simulator 38.7 MPLAB REAL ICE In-Circuit Emulator System 38.8 MPLAB ICD 3 In-Circuit Debugger System 38.9 PICkit 3 In-Circuit Debugger/ Programmer 38.10 MPLAB PM3 Device Programmer 38.11 Demonstration/Development Boards, Evaluation Kits, and Starter Kits 38.12 Third-Party Development Tools 39.0 Packaging Information 39.1 Package Marking Information Package Marking Information (Continued) Package Marking Information (Continued) 39.2 Package Details Appendix A: Data Sheet Revision History Revision E (6/2019) Revision D (3/2018) Revision C (3/2017) Revision B (09/2015) Revision A (12/2014) The Microchip Website Customer Change Notification Service Customer Support Product Identification System Trademarks Worldwide Sales