PIC16(L)F15356/75/76/85/86 (Microchip)

FabricanteMicrochip
DescripciónFull-Featured 28/40/44/48-Pin Microcontrollers
Páginas / Página605 / 1 — PIC16(L)F15356/75/76/85/86. Full-Featured 28/40/44/48-Pin …
Formato / tamaño de archivoPDF / 9.3 Mb
Idioma del documentoInglés

PIC16(L)F15356/75/76/85/86. Full-Featured 28/40/44/48-Pin Microcontrollers. Description. Core Features

PIC16(L)F15356/75/76/85/86 Microchip

Línea de modelo para esta hoja de datos

PIC16F15356
PIC16F15375
PIC16F15376
PIC16F15385
PIC16F15386

Versión de texto del documento

PIC16(L)F15356/75/76/85/86 Full-Featured 28/40/44/48-Pin Microcontrollers Description
PIC16(L)F15356/75/76/85/86 microcontrollers feature Analog, Core Independent Peripherals and Communication Peripherals, combined with eXtreme Low-Power (XLP) technology for a wide range of general purpose and low-power applications. The devices feature multiple PWMs, multiple communication, temperature sensor, and memory features like Memory Access Partition (MAP) to support customers in data protection and bootloader applications, and Device Information Area (DIA) which stores factory calibration values to help improve temperature sensor accuracy.
Core Features Power-Saving Functionality
• C Compiler Optimized RISC Architecture • DOZE mode: Ability to Run the CPU Core Slower • Operating Speed: than the System Clock - DC – 32 MHz clock input • IDLE mode: Ability to halt CPU Core while Internal - 125 ns minimum instruction cycle Peripherals Continue Operating • Interrupt Capability • SLEEP mode: Lowest Power Consumption • 16-Level Deep Hardware Stack • Peripheral Module Disable (PMD): • Timers: - Ability to disable hardware module to - 8-bit Timer2 with Hardware Limit Timer (HLT) minimize active power consumption of - 16-bit Timer0/1 unused peripherals • Low-Current Power-on Reset (POR) • Configurable Power-up Timer (PWRTE)
eXtreme Low-Power (XLP) Features
• Brown-out Reset (BOR) • Low-Power BOR (LPBOR) Option • Sleep mode: 50 nA @ 1.8V, typical • Windowed Watchdog Timer (WWDT): • Watchdog Timer: 500 nA @ 1.8V, typical - Variable prescaler selection • Secondary Oscillator: 500 nA @ 32 kHz - Variable window size selection • Operating Current: - All sources configurable in hardware or - 8 A @ 32 kHz, 1.8V, typical software - 32 A/MHz @ 1.8V, typical • Programmable Code Protection
Digital Peripherals Memory
• Four Configurable Logic Cells (CLC): • Up to 28 KB Flash Program Memory - Integrated combinational and sequential logic • Up to 2 Bytes Data SRAM • Complementary Waveform Generator (CWG): • Direct, Indirect and Relative Addressing modes - Rising and falling edge dead-band control • Memory Access Partition (MAP): - Full-bridge, half-bridge, 1-channel drive - Write protect - Multiple signal sources - Customizable Partition • Two Capture/Compare/PWM (CCP) module: • Device Information Area (DIA) - 16-bit resolution for Capture/Compare modes • Device Configuration Information (DCI) - 10-bit resolution for PWM mode • High-Endurance Flash (HEF) • Four 10-Bit PWMs - Last 128 words of Program Flash Memory • Numerically Controlled Oscillator (NCO): - Generates true linear frequency control and
Operating Characteristics
increased frequency resolution - Input Clock: 0 Hz < FNCO < 32 MHz • Operating Voltage Range: - Resolution: FNCO/220 - 1.8V to 3.6V (PIC16LF15356/75/76/85/86) • Two EUSART, RS-232, RS-485, LIN compatible - 2.3V to 5.5V (PIC16F15356/75/76/85/86) • Two SPI • Temperature Range: • Two I2C, SMBus, PMBus™ compatible - Industrial: -40°C to 85°C - Extended: -40°C to 125°C  2016-2018 Microchip Technology Inc. DS40001866B-page 1 Document Outline Description Core Features Memory Operating Characteristics Power-Saving Functionality eXtreme Low-Power (XLP) Features Digital Peripherals Digital Peripherals (Cont.) Analog Peripherals Flexible Oscillator Structure Pin Diagrams Pin Allocation Tables Table of Contents Most Current Data Sheet Errata Customer Notification System Full-Featured 28/40/44/48-Pin Microcontrollers 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)F15356 Block Diagram FIGURE 1-2: PIC16(L)F15375/76 Block Diagram FIGURE 1-3: PIC16(L)F15385/86 Block Diagram TABLE 1-2: PIC16(L)F15356 Pinout Description TABLE 1-3: PIC16(L)F15375/76 Pinout Description TABLE 1-4: PIC16(L)F15385/86 Pinout Description 2.0 Guidelines for Getting Started with PIC16(L)F15356/75/76/85/86 Microcontrollers 2.1 Basic Connection Requirements FIGURE 2-1: Recommended Minimum Connections 2.2 Power Supply Pins 2.2.1 Decoupling Capacitors 2.2.2 Tank Capacitors 2.3 Master Clear (MCLR) Pin FIGURE 2-2: Example of MCLR Pin Connections 2.4 ICSP™ Pins 2.5 External Oscillator Pins 2.6 Unused I/Os FIGURE 2-3: Suggested Placement of the Oscillator Circuit 3.0 Enhanced Mid-Range CPU FIGURE 3-1: Core Data Path Diagram 3.1 Automatic Interrupt Context Saving 3.2 16-Level Stack with Overflow and Underflow 3.3 File Select Registers 3.4 Instruction Set 4.0 Memory Organization 4.1 Program Memory Organization TABLE 4-1: Device Sizes and Addresses FIGURE 4-1: Program Memory Map And Stack For PIC16(L)F15375/85 FIGURE 4-2: Program Memory Map And Stack For PIC16(L)F15356/76/86 4.1.1 Reading Program Memory as Data 4.1.1.1 RETLW Instruction EXAMPLE 4-1: RETLW Instruction 4.1.1.2 Indirect Read with FSR EXAMPLE 4-2: Accessing Program Memory Via FSR 4.2 Memory Access Partition (MAP) 4.2.1 Application Block 4.2.2 Boot Block 4.2.3 Storage Area Flash 4.2.4 Memory Write Protection 4.2.5 MEMORY VIOLATION TABLE 4-2: Memory Access Partition 4.3 Data Memory Organization FIGURE 4-3: Banked Memory Partitioning 4.3.1 Bank Selection 4.3.2 Core Registers TABLE 4-3: Core Registers 4.3.2.1 STATUS Register Register 4-1: STATUS: STATUS Register 4.3.3 Special Function Register 4.3.4 General Purpose RAM 4.3.4.1 Linear Access to GPR 4.3.5 Common RAM 4.3.6 Device Memory Maps TABLE 4-4: PIC16(L)F15356/75/76/85/86 Memory Map, Banks 0-7 TABLE 4-5: PIC16(L)F15356/75/76/85/86 Memory Map, Banks 8-15 TABLE 4-6: PIC16(L)F15356/75/76/85/86 Memory Map, Banks 16-23 TABLE 4-7: PIC16(L)F15356/75/76/85/86 Memory Map, Bank 24-31 TABLE 4-8: PIC16(L)F15356/75/76/85/86 Memory Map, Banks 56-63 TABLE 4-9: PIC16(L)F15356/75/76/85/86 Memory Map, Banks 60, 61, 62, and 63 TABLE 4-10: Special Function Register Summary Banks 0-63 (All Banks) TABLE 4-11: Special Function Register Summary Banks 0-63 4.4 PCL and PCLATH FIGURE 4-4: Loading Of PC In Different Situations 4.4.1 Modifying PCL 4.4.2 computed goto 4.4.3 Computed Function Calls 4.4.4 Branching 4.5 Stack 4.5.1 Accessing the Stack FIGURE 4-5: Accessing the Stack Example 1 FIGURE 4-6: Accessing the Stack Example 2 FIGURE 4-7: Accessing the Stack Example 3 FIGURE 4-8: Accessing the Stack Example 4 4.5.2 Overflow/Underflow Reset 4.6 Indirect Addressing FIGURE 4-9: Indirect Addressing PIC16(L)F15375/85 FIGURE 4-10: Indirect Addressing PIC16(L)F15356/76/86 4.6.1 Traditional/Banked Data Memory FIGURE 4-11: Traditional/Banked Data Memory Map 4.6.2 Linear Data Memory FIGURE 4-12: Linear Data Memory Map 4.6.3 Program Flash Memory FIGURE 4-13: Program Flash Memory Map 5.0 Device Configuration 5.1 Configuration Words 5.2 Register Definitions: Configuration Words Register 5-1: Configuration Word 1: Oscillators Register 5-2: Configuration Word 2: Supervisors Register 5-3: Configuration Word 3: Windowed Watchdog Register 5-4: Configuration Word 4: Memory TABLE 5-1: Boot Block Size Bits Register 5-5: Configuration Word 5: Code Protection 5.3 Code Protection 5.3.1 Program Memory Protection 5.4 Write Protection 5.5 User ID 5.6 Device ID and Revision ID 5.7 Register Definitions: Device and Revision Register 5-6: DevID: Device ID Register Register 5-7: RevisionID: Revision ID Register 6.0 Device Information Area TABLE 6-1: Device Information Area 6.1 Microchip Unique identifier (MUI) 6.2 External Unique Identifier (EUI) 6.3 Analog-to-Digital Conversion Data of the Temperature Sensor 6.4 Fixed Voltage Reference Data 7.0 Device Configuration Information TABLE 7-1: Device Configuration Information for PIC16(L)F15356/75/76/85/86 Devices TABLE 7-2: Memory Size and Number of User Rows TABLE 7-3: Pin Count 7.1 DIA and DCI Access 8.0 Resets FIGURE 8-1: Simplified Block Diagram of On-Chip Reset Circuit 8.1 Power-on Reset (POR) 8.2 Brown-out Reset (BOR) TABLE 8-1: BOR Operating Modes 8.2.1 BOR is Always On 8.2.2 BOR is Off in Sleep 8.2.3 BOR Controlled by Software 8.2.4 BOR is always OFF FIGURE 8-2: Brown-out Situations 8.3 Register Definitions: Brown-out Reset Control Register 8-1: BORCON: Brown-out Reset Control Register 8.4 Low-Power Brown-out Reset (LPBOR) 8.4.1 Enabling LPBOR 8.4.2 LPBOR Module Output 8.5 MCLR TABLE 8-2: MCLR Configuration 8.5.1 MCLR Enabled 8.5.2 MCLR Disabled 8.6 Windowed Watchdog Timer (WWDT) Reset 8.7 RESET Instruction 8.8 Stack Overflow/Underflow Reset 8.9 Programming Mode Exit 8.10 Power-up Timer 8.11 Start-up Sequence FIGURE 8-3: Reset Start-up Sequence 8.12 Memory Execution Violation 8.13 Determining the Cause of a Reset TABLE 8-3: Reset Status Bits and Their Significance TABLE 8-4: Reset Condition for Special Registers 8.14 Power Control (PCONx) Registers 8.15 Register Definitions: Power Control Register 8-2: PCON0: Power Control Register 0 Register 8-3: PCON1: Power Control Register 0 TABLE 8-5: Summary of Registers Associated with Resets 9.0 Oscillator Module (with Fail-Safe Clock Monitor) 9.1 Overview FIGURE 9-1: Simplified PIC® MCU Clock Source Block Diagram 9.2 Clock Source Types 9.2.1 External Clock Sources 9.2.1.1 EC Mode FIGURE 9-2: External Clock (EC) Mode Operation 9.2.1.2 LP, XT, HS Modes FIGURE 9-3: Quartz Crystal Operation (LP, XT or HS Mode) FIGURE 9-4: Ceramic Resonator Operation (XT or HS Mode) 9.2.1.3 Oscillator Start-up Timer (OST) 9.2.1.4 4x PLL 9.2.1.5 Secondary Oscillator FIGURE 9-5: Quartz Crystal Operation (Secondary Oscillator) 9.2.2 Internal Clock Sources 9.2.2.1 HFINTOSC 9.2.2.2 Internal Oscillator Frequency Adjustment 9.2.2.3 LFINTOSC 9.2.2.4 Oscillator Status and Manual Enable 9.3 Clock Switching 9.3.1 New Oscillator Source (NOSC) and New Divider Selection Request (NDIV) BITS 9.3.2 PLL Input Switch 9.3.3 Clock Switch and Sleep FIGURE 9-6: Clock Switch (CSWHOLD = 0) FIGURE 9-7: Clock Switch (CSWHOLD = 1) FIGURE 9-8: Clock Switch Abandoned 9.4 Fail-Safe Clock Monitor FIGURE 9-9: FSCM Block Diagram 9.4.1 Fail-Safe Detection 9.4.2 Fail-Safe Operation 9.4.3 Fail-Safe Condition Clearing 9.4.4 Reset or Wake-up from Sleep FIGURE 9-10: FSCM Timing Diagram 9.5 Register Definitions: Oscillator Control Register 9-1: OSCCON1: Oscillator Control Register1 Register 9-2: OSCCON2: Oscillator Control Register 2 TABLE 9-1: NOSC/COSC Bit Settings TABLE 9-2: NDIV/CDIV Bit Settings Register 9-3: OSCCON3: Oscillator Control Register 3 Register 9-4: OSCSTAT: Oscillator STATUS Register 1 Register 9-5: OSCEN: Oscillator Manual Enable Register Register 9-6: OSCFRQ: HFINTOSC Frequency Selection Register Register 9-7: OSCTUNE: HFINTOSC Tuning Register TABLE 9-3: Summary of Registers Associated with Clock Sources TABLE 9-4: Summary OF Configuration Word WITH Clock Sources 10.0 Interrupts FIGURE 10-1: Interrupt Logic 10.1 Operation 10.2 Interrupt Latency FIGURE 10-2: Interrupt Latency FIGURE 10-3: INT Pin Interrupt Timing 10.3 Interrupts During Sleep 10.4 INT Pin 10.5 Automatic Context Saving 10.6 Register Definitions: Interrupt Control Register 10-1: INTCON: Interrupt Control Register Register 10-2: PIE0: Peripheral Interrupt Enable Register 0 Register 10-3: PIE1: Peripheral Interrupt Enable Register 1 Register 10-4: PIE2: Peripheral Interrupt Enable Register 2 Register 10-5: PIE3: Peripheral Interrupt Enable Register 3 Register 10-6: PIE4: Peripheral Interrupt Enable Register 4 Register 10-7: PIE5: Peripheral Interrupt Enable Register 5 Register 10-8: PIE6: Peripheral Interrupt Enable Register 6 Register 10-9: PIE7: Peripheral Interrupt Enable Register 7 Register 10-10: PIR0: Peripheral Interrupt Status Register 0 Register 10-11: PIR1: Peripheral Interrupt Request Register 1 Register 10-12: PIR2: Peripheral Interrupt Request Register 2 Register 10-13: PIR3: Peripheral Interrupt Request Register 3 Register 10-14: PIR4: Peripheral Interrupt Request Register 4 Register 10-15: PIR5: Peripheral Interrupt Request Register 5 Register 10-16: PIR6: Peripheral Interrupt Request Register 6 Register 10-17: PIR7: Peripheral Interrupt Request Register 7 TABLE 10-1: Summary of Registers Associated with Interrupts 11.0 Power-Saving Operation Modes 11.1 DOZE Mode FIGURE 11-1: DOZE Mode Operation Example 11.1.1 Doze Operation 11.1.2 Interrupts During Doze TABLE 11-1: Interrupts during DOZE 11.2 Sleep Mode 11.2.1 Wake-up from Sleep 11.2.2 Wake-up Using Interrupts FIGURE 11-2: Wake-Up From Sleep Through Interrupt 11.2.3 Low-Power Sleep Mode 11.2.3.1 Sleep Current vs. Wake-up Time 11.2.3.2 Peripheral Usage in Sleep 11.3 IDLE Mode 11.3.1 Idle and Interrupts 11.3.2 Idle and WDT 11.4 Register Definitions: Voltage Regulator and DOZE Control Register 11-1: VREGCON: Voltage Regulator Control Register(1) Register 11-2: CPUDOZE: Doze and Idle Register TABLE 11-2: Summary of Registers Associated with Power-Down Mode 12.0 Windowed Watchdog Timer (WWDT) FIGURE 12-1: Watchdog Timer Block Diagram 12.1 Independent Clock Source 12.2 WDT Operating Modes 12.2.1 WDT Is Always On 12.2.2 WDT Is Off In Sleep 12.2.3 WDT Controlled by Software 12.2.4 WDT Is OFF TABLE 12-1: WDT Operating Modes 12.3 Time-Out Period 12.4 Watchdog Window 12.5 Clearing the WDT 12.5.1 CLRWDT Considerations (Windowed Mode) 12.6 Operation During Sleep TABLE 12-2: WDT Clearing Conditions FIGURE 12-2: Window Period and Delay 12.7 Register Definitions: Windowed Watchdog Timer Control Register 12-1: WDTCON0: Watchdog Timer Control Register 0 Register 12-2: WDTCON1: Watchdog Timer Control Register 1 Register 12-3: WDTPSL: WDT Prescale Select Low Byte Register Register 12-4: WDTPSH: WDT Prescale Select High Byte Register Register 12-5: WDTTMR: WDT Timer Register TABLE 12-3: Summary of Registers Associated with Watchdog Timer TABLE 12-4: Summary OF Configuration Word WITH Watchdog Timer 13.0 Nonvolatile Memory (NVM) Control 13.1 Program Flash Memory TABLE 13-1: Flash Memory Organization by Device 13.1.1 Program Memory Voltages 13.1.1.1 Programming Externally 13.1.1.2 Self-programming 13.2 FSR and INDF Access 13.2.1 FSR Read 13.2.2 FSR Write 13.3 NVMREG Access 13.3.1 NVMREG Read Operation FIGURE 13-1: Flash Program Memory Read Flowchart EXAMPLE 13-1: Program Memory Read 13.3.2 NVM Unlock Sequence FIGURE 13-2: NVM Unlock Sequence Flowchart EXAMPLE 13-2: NVM Unlock Sequence 13.3.3 NVMREG Erase of Program Memory FIGURE 13-3: NVM Erase Flowchart EXAMPLE 13-3: Erasing One Row of Program Flash Memory (PFM) TABLE 13-2: NVM Organization and Access Information 13.3.4 NVMREG Write to Program Memory FIGURE 13-4: NVMREGS Writes to Program Flash Memory With 32 write latches FIGURE 13-5: Program Flash Memory Write Flowchart EXAMPLE 13-4: Writing to Program Flash Memory 13.3.5 Modifying Flash Program Memory FIGURE 13-6: Flash Program Memory Modify Flowchart 13.3.6 NVMREG Access to Device Information Area, Device Configuration Area, User ID, Device ID and Configuration Words TABLE 13-3: NVMREGS Access to Device Information Area, Device Configuration Area, User ID, Device ID and Configuration Words (NVMREGS = 1) EXAMPLE 13-5: Device ID Access 13.3.7 Write Verify FIGURE 13-7: Flash Program Memory Verify Flowchart 13.3.8 WRERR Bit TABLE 13-4: Actions for PFM When WR = 1 13.4 Register Definitions: Flash Program Memory Control Register 13-1: NVMDATL: Nonvolatile Memory Data Low Byte Register Register 13-2: NVMDATH: Nonvolatile Memory Data High Byte Register Register 13-3: NVMADRL: Nonvolatile Memory Address Low Byte Register Register 13-4: NVMADRH: Nonvolatile Memory Address High Byte Register Register 13-5: NVMCON1: Nonvolatile Memory Control 1 Register Register 13-6: NVMCON2: NONVOLATILE Memory Control 2 Register TABLE 13-5: Summary of Registers Associated with Nonvolatile Memory (NVM) 14.0 I/O Ports TABLE 14-1: Port Availability Per Device FIGURE 14-1: Generic I/O Port Operation 14.1 I/O Priorities 14.2 PORTA Registers 14.2.1 Data Register EXAMPLE 14-1: Initializing PORTA 14.2.2 Direction Control 14.2.3 Open-Drain Control 14.2.4 Slew Rate Control 14.2.5 Input Threshold Control 14.2.6 Analog Control 14.2.7 Weak Pull-up Control 14.2.8 PORTA Functions and Output Priorities 14.3 Register Definitions: PORTA Register 14-1: PORTA: PORTA Register Register 14-2: TRISA: PORTA Tri-State Register Register 14-3: LATA: PORTA Data Latch Register Register 14-4: ANSELA: PORTA Analog Select Register Register 14-5: WPUA: Weak Pull-Up PORTA Register Register 14-6: ODCONA: PORTA Open-Drain Control Register Register 14-7: SLRCONA: PORTA Slew Rate Control Register Register 14-8: INLVLA: PORTA Input Level Control Register TABLE 14-2: Summary of Registers Associated with PORTA 14.4 PORTB Registers 14.4.1 Data Register 14.4.2 Direction Control 14.4.3 Open-Drain Control 14.4.4 Slew Rate Control 14.4.5 Input Threshold Control 14.4.6 Analog Control 14.4.7 Weak Pull-up Control 14.4.8 PORTB Functions and Output Priorities 14.5 Register Definitions: PORTB Register 14-9: PORTB: PORTB Register Register 14-10: TRISB: PORTB Tri-State Register Register 14-11: LATB: PORTB Data Latch Register Register 14-12: ANSELB: PORTB Analog Select Register Register 14-13: WPUB: Weak Pull-Up PORTB Register Register 14-14: ODCONB: PORTB Open-Drain Control Register Register 14-15: SLRCONB: PORTB Slew Rate Control Register Register 14-16: INLVLB: PORTB Input Level Control Register TABLE 14-3: Summary of Registers Associated with PORTB 14.6 PORTC Registers 14.6.1 Data Register 14.6.2 Direction Control 14.6.3 Open-Drain Control 14.6.4 Slew Rate Control 14.6.5 Input Threshold Control 14.6.6 Analog Control 14.6.7 Weak Pull-up Control 14.6.8 PORTC Functions and Output Priorities 14.7 Register Definitions: PORTC Register 14-17: PORTC: PORTC Register Register 14-18: TRISC: PORTC Tri-State Register Register 14-19: LATC: PORTC Data Latch Register Register 14-20: ANSELC: PORTC Analog Select Register Register 14-21: WPUC: Weak Pull-Up PORTC Register Register 14-22: ODCONC: PORTC Open-Drain Control Register Register 14-23: SLRCONC: PORTC Slew Rate Control Register Register 14-24: INLVLC: PORTC Input Level Control Register TABLE 14-4: Summary of Registers Associated with PORTC 14.8 PORTD Registers 14.8.1 Data Register 14.8.2 Direction Control 14.8.3 Open-Drain Control 14.8.4 Slew Rate Control 14.8.5 Input Threshold Control 14.8.6 Analog Control 14.8.7 Weak Pull-up Control 14.8.8 PORTD Functions and Output Priorities 14.9 Register Definitions: PORTD Register 14-25: PORTD: PORTD Register Register 14-26: TRISD: PORTD Tri-State Register Register 14-27: LATD: PORTD Data Latch Register Register 14-28: ANSELD: PORTD Analog Select Register Register 14-29: WPUD: Weak Pull-Up PORTD Register Register 14-30: ODCOND: PORTD Open-Drain Control Register Register 14-31: SLRCOND: PORTD Slew Rate Control Register Register 14-32: INLVLD: PORTD Input Level Control Register TABLE 14-5: Summary of Registers Associated with PORTD 14.10 PORTE Registers 14.10.1 Data Register 14.10.2 Direction Control 14.10.3 Input Threshold Control 14.10.4 Analog Control 14.10.5 Weak Pull-up Control 14.10.6 PORTe Functions and Output Priorities 14.11 Register Definitions: PORTE Register 14-33: PORTE: PORTE Register Register 14-34: TRISE: PORTE Tri-State Register Register 14-35: LATE: PORTE Data Latch Register(1) Register 14-36: ANSELE: PORTE Analog Select Register(1) Register 14-37: WPUE: WEAK PULL-uP PORTe REGISTER Register 14-38: ODCONE: PORTE Open-Drain Control Register(1) Register 14-39: SLRCONE: PORTE Slew Rate Control Register(1) Register 14-40: INLVLE: PORTE Input Level Control Register TABLE 14-6: Summary of Registers Associated with PORTE TABLE 14-7: Summary of Configuration Word with PORTE 14.12 PORTF Registers 14.12.1 Data Register 14.12.2 Direction Control 14.12.3 Input Threshold Control 14.12.4 Open-Drain Control 14.12.5 Slew Rate Control 14.12.6 Analog Control 14.12.7 Weak Pull-up Control 14.12.8 PORTF Functions and Output Priorities 14.13 Register Definitions: PORTF Register 14-41: PORTF: PORTF Register Register 14-42: TRISF: PORTF Tri-State Register Register 14-43: LATF: PORTF Data Latch Register Register 14-44: ANSELF: PORTF Analog Select Register Register 14-45: WPUF: Weak Pull-Up PORTF Register Register 14-46: ODCONF: PORTF Open-Drain Control Register Register 14-47: SLRCONF: PORTF Slew Rate Control Register Register 14-48: INLVLF: PORTF Input Level Control Register TABLE 14-8: Summary of Registers Associated with PORTF 15.0 Peripheral Pin Select (PPS) Module FIGURE 15-1: Simplified PPS Block Diagram 15.1 PPS Inputs 15.2 PPS Outputs TABLE 15-1: PPS Input Signal Routing Options (PIC16(L)F15356) TABLE 15-2: PPS Input Signal Routing Options (PIC16(L)F15375/76) TABLE 15-3: PPS Input Signal Routing Options (PIC16(L)F15385/86) TABLE 15-4: PPS Input Register Values 15.3 Bidirectional Pins 15.4 PPS Lock EXAMPLE 15-1: PPS Lock/Unlock sequence 15.5 PPS Permanent Lock 15.6 Operation During Sleep 15.7 Effects of a Reset TABLE 15-5: PPS Output Signal Routing Options (PIC16(L)F15356) TABLE 15-6: PPS Output Signal Routing Options (PIC16(L)F15375/76) TABLE 15-7: PPS Output Signal Routing Options (PIC16(L)F15385/86) 15.8 Register Definitions: PPS Input Selection Register 15-1: xxxPPS: Peripheral xxx input Selection(1) Register 15-2: RxyPPS: Pin Rxy Output Source Selection Register Register 15-3: PPSLOCK: PPS Lock Register TABLE 15-8: Summary of Registers Associated with the PPS Module 16.0 Peripheral Module Disable 16.1 Disabling a Module 16.2 Enabling a module 16.3 Disabling a Module 16.4 System Clock Disable 16.5 Register Definitions: Peripheral Module Disable Control Register 16-1: PMD0: PMD Control Register 0 Register 16-2: PMD1: PMD Control Register 1 Register 16-3: PMD2: PMD Control Register 2 Register 16-4: PMD3: PMD Control Register 3 Register 16-5: PMD4: PMD Control Register 4 Register 16-6: PMD5 – PMD Control Register 5 TABLE 16-1: Summary of Registers Associated with the PMD Module 17.0 Interrupt-On-Change 17.1 Enabling the Module 17.2 Individual Pin Configuration 17.3 Interrupt Flags 17.3.1 Clearing Interrupt Flags EXAMPLE 17-1: Clearing Interrupt Flags (PORTA Example) 17.4 Operation in Sleep FIGURE 17-1: Interrupt-On-Change Block Diagram (PORTB Example) 17.5 Register Definitions: Interrupt-on-Change Control Register 17-1: IOCAP: Interrupt-on-Change PORTA Positive Edge Register Register 17-2: IOCAN: Interrupt-on-Change PORTA Negative Edge Register Register 17-3: IOCAF: Interrupt-on-Change PORTA Flag Register Register 17-4: IOCBP: Interrupt-on-Change PORTB Positive Edge Register Register 17-5: IOCBN: Interrupt-on-Change PORTB Negative Edge Register Register 17-6: IOCBF: Interrupt-on-Change PORTB Flag Register Register 17-7: IOCCP: Interrupt-on-Change PORTC Positive Edge Register Register 17-8: IOCCN: Interrupt-on-Change PORTC Negative Edge Register Register 17-9: IOCCF: Interrupt-on-Change PORTC Flag Register Register 17-10: IOCEP: Interrupt-on-Change PORTE Positive Edge Register Register 17-11: IOCEN: Interrupt-on-Change PORTE Negative Edge Register Register 17-12: IOCEF: Interrupt-on-Change PORTE Flag Register TABLE 17-1: Summary of Registers Associated with Interrupt-On-Change 18.0 Fixed Voltage Reference (FVR) 18.1 Independent Gain Amplifiers 18.2 FVR Stabilization Period FIGURE 18-1: Voltage Reference Block Diagram 18.3 Register Definitions: FVR Control Register 18-1: FVRCON: Fixed Voltage Reference Control Register TABLE 18-1: Summary of Registers Associated with Fixed Voltage Reference 19.0 Temperature Indicator Module 19.1 Module Operation FIGURE 19-1: Temperature Indicator Module Block Diagram 19.1.1 Temperature Indicator Range 19.1.2 Minimum Operating Vdd TABLE 19-1: Recommended Vdd vs. Range 19.2 Temperature Calculation EQUATION 19-1: Sensor Temperature 19.2.1 Calibration 19.2.1.1 Higher-Order Calibration 19.3 ADC Acquisition Time TABLE 19-2: Summary of Registers Associated with the Temperature Indicator(1) 20.0 Analog-to-Digital Converter (ADC) Module FIGURE 20-1: ADC Block Diagram 20.1 ADC Configuration 20.1.1 Port Configuration 20.1.2 Channel Selection 20.1.3 ADC Voltage Reference 20.1.4 Conversion Clock TABLE 20-1: ADC Clock Period (Tad) Vs. Device Operating Frequencies FIGURE 20-2: Analog-to-Digital Conversion Tad Cycles 20.1.5 Interrupts 20.1.6 Result Formatting FIGURE 20-3: 10-bit ADC Conversion Result Format 20.2 ADC Operation 20.2.1 Starting a Conversion 20.2.2 Completion of a Conversion 20.2.3 ADC Operation During Sleep 20.2.4 Auto-Conversion Trigger TABLE 20-2: ADC Auto-Conversion Table 20.2.5 ADC Conversion Procedure EXAMPLE 20-1: ADC Conversion 20.3 ADC Acquisition Requirements EQUATION 20-1: Acquisition Time Example FIGURE 20-4: Analog Input Model FIGURE 20-5: ADC Transfer Function 20.4 Register Definitions: ADC Control Register 20-1: ADCON0: ADC Control Register 0 Register 20-2: ADCON1: ADC Control Register 1 Register 20-3: ADACT: A/D Auto-Conversion Trigger Register 20-4: ADRESH: ADC Result Register High (ADRESH) ADFM = 0 Register 20-5: ADRESL: ADC Result Register Low (ADRESL) ADFM = 0 Register 20-6: ADRESH: ADC Result Register High (ADRESH) ADFM = 1 Register 20-7: ADRESL: ADC Result Register Low (ADRESL) ADFM = 1 TABLE 20-3: Summary of Registers Associated with ADC 21.0 5-Bit Digital-to-Analog Converter (DAC1) Module 21.1 Output Voltage Selection EQUATION 21-1: DAC Output Voltage 21.2 Ratiometric Output Level 21.3 DAC Voltage Reference Output FIGURE 21-1: Digital-to-Analog Converter Block Diagram FIGURE 21-2: Voltage Reference Output Buffer Example 21.4 Operation During Sleep 21.5 Effects of a Reset 21.6 Register Definitions: DAC Control Register 21-1: DAC1CON0: Voltage Reference Control Register 0 Register 21-2: DAC1CON1: Voltage Reference Control Register 1 TABLE 21-1: Summary of Registers Associated with the DAC1 Module 22.0 Numerically Controlled Oscillator (NCO) Module FIGURE 22-1: Numerically Controlled Oscillator Module Simplified Block Diagram 22.1 NCO OPERATION EQUATION 22-1: NCO Overflow Frequency 22.1.1 NCO CLOCK SOURCES 22.1.2 ACCUMULATOR 22.1.3 ADDER 22.1.4 INCREMENT REGISTERS 22.2 FIXED DUTY CYCLE MODE 22.3 PULSE FREQUENCY MODE 22.3.1 OUTPUT PULSE WIDTH CONTROL 22.4 OUTPUT POLARITY CONTROL 22.5 Interrupts 22.6 Effects of a Reset 22.7 Operation in Sleep FIGURE 22-2: FDC Output Mode Operation Diagram 22.8 NCO Control Registers Register 22-1: NCO1CON: NCO Control Register Register 22-2: NCO1CLK: NCO1 Input Clock Control Register Register 22-3: NCO1ACCL: NCO1 Accumulator Register – Low Byte Register 22-4: NCO1ACCH: NCO1 Accumulator Register – High Byte Register 22-5: NCO1ACCU: NCO1 Accumulator Register – Upper Byte(1) Register 22-6: NCO1INCL: NCO1 Increment Register – Low Byte(1,2) Register 22-7: NCO1INCH: NCO1 Increment Register – High Byte(1) Register 22-8: NCO1INCU: NCO1 Increment Register – Upper Byte(1) TABLE 22-1: Summary of Registers Associated with NCO 23.0 Comparator Module 23.1 Comparator Overview TABLE 23-1: Available Comparators FIGURE 23-1: Single Comparator FIGURE 23-2: Comparator Module Simplified Block Diagram 23.2 Comparator Control 23.2.1 Comparator Enable 23.2.2 Comparator Output 23.2.3 Comparator Output Polarity TABLE 23-2: Comparator Output State vs. Input Conditions 23.3 Comparator Hysteresis 23.4 Timer1 Gate Operation 23.4.1 Comparator Output Synchronization 23.5 Comparator Interrupt 23.6 Comparator Positive Input Selection 23.7 Comparator Negative Input Selection 23.8 Comparator Response Time 23.9 Analog Input Connection Considerations FIGURE 23-3: Analog Input Model 23.10 CWG1 Auto-shutdown Source 23.11 Operation in Sleep Mode 23.12 Register Definitions: Comparator Control Register 23-1: CMxCON0: Comparator Cx Control Register 0 Register 23-2: CMxCON1: Comparator Cx Control Register 1 Register 23-3: CMxNCH: Comparator Cx Negative Input Select Register Register 23-4: CMxPCH: Comparator Cx Positive Input Select Register Register 23-5: CMOUT: Comparator Output Register TABLE 23-3: Summary of Registers Associated with Comparator Module 24.0 Zero-Cross Detection (ZCD) Module 24.1 External Resistor Selection EQUATION 24-1: External Resistor FIGURE 24-1: External Voltage FIGURE 24-2: Simplified ZCD Block Diagram 24.2 ZCD Logic Output 24.3 ZCD Logic Polarity 24.4 ZCD Interrupts 24.5 Correcting for Vcpinv offset 24.5.1 Correction by AC Coupling EQUATION 24-2: R-C Calculations EXAMPLE 24-1: 24.5.2 Correction by Offset Current EQUATION 24-3: ZCD Event Offset EQUATION 24-4: ZCD Pull-up/down 24.6 Handling Vpeak variations EQUATION 24-5: Series R for V range 24.7 Operation During Sleep 24.8 Effects of a Reset 24.9 Register Definitions: ZCD Control Register 24-1: ZCDCON: Zero-Cross Detection Control Register TABLE 24-1: Summary of Registers Associated with the ZCD Module TABLE 24-2: Summary of Configuration Word with the ZCD Module 25.0 Timer0 Module 25.1 Timer0 Operation 25.1.1 16-Bit Mode 25.1.1.1 Timer0 Reads and Writes in 16-Bit Mode 25.1.2 8-BIT Mode 25.1.3 Counter Mode 25.1.4 Timer Mode 25.1.5 Asynchronous Mode 25.1.6 Synchronous Mode 25.2 Clock Source Selection 25.2.1 Internal Clock Source 25.2.2 External Clock Source 25.3 Programmable Prescaler 25.4 Programmable Postscaler 25.5 Operation during Sleep 25.6 Timer0 Interrupts 25.7 Timer0 Output FIGURE 25-1: Block Diagram of Timer0 25.8 Register Definitions: Timer0 Control Register 25-1: T0CON0: TIMER0 Control Register 0 Register 25-2: T0CON1: TIMER0 Control Register 1 TABLE 25-1: Summary of Registers Associated with Timer0 26.0 Timer1 Module with Gate Control FIGURE 26-1: Timer1 Block Diagram 26.1 Timer1 Operation TABLE 26-1: Timer1 Enable Selections 26.2 Clock Source Selection 26.2.1 Internal Clock Source 26.2.2 External Clock Source 26.3 Timer Prescaler 26.4 Secondary Oscillator 26.5 Timer Operation in Asynchronous Mode 26.5.1 Reading and Writing Timer1 in Asynchronous Mode 26.6 Timer Gate 26.6.1 Timer Gate Enable TABLE 26-2: Timer Gate Enable Selections 26.6.2 Timer Gate Source Selection 26.6.2.1 T1G Pin Gate Operation 26.6.2.2 Timer0 Overflow Gate Operation 26.6.2.3 Comparator C1 Gate Operation 26.6.2.4 Comparator C2 Gate Operation 26.6.3 Timer1 Gate Toggle Mode 26.6.4 Timer1 Gate Single-Pulse Mode 26.6.5 Timer1 Gate Value Status 26.6.6 Timer1 Gate Event Interrupt 26.7 Timer1 Interrupts 26.8 Timer1 Operation During Sleep 26.9 CCP Capture/Compare Time Base 26.10 CCP Auto-Conversion Trigger FIGURE 26-2: Timer1 Incrementing Edge FIGURE 26-3: Timer1 Gate Enable Mode FIGURE 26-4: Timer1 Gate Toggle Mode FIGURE 26-5: Timer1 Gate Single-Pulse Mode FIGURE 26-6: Timer1 Gate Single-Pulse and Toggle Combined Mode 26.11 Register Definitions: Timer1 Control Register 26-1: T1CON: Timer1 Control Register Register 26-2: T1GCON: Timer1 Gate Control Register Register 26-3: T1CLK Timer1 Clock Select Register Register 26-4: T1GATE Timer1 Gate Select Register TABLE 26-3: Summary of Registers Associated with Timer1 27.0 Timer2 Module With Hardware Limit Timer (HLT) FIGURE 27-1: Timer2 Block Diagram FIGURE 27-2: Timer2 Clock Source Block Diagram 27.1 Timer2 Operation 27.1.1 Free Running Period Mode 27.1.2 One-Shot Mode 27.1.3 Monostable Mode 27.2 Timer2 Output 27.3 External Reset Sources TABLE 27-1: Timer2 Operating Modes 27.4 Timer2 Interrupt FIGURE 27-3: Timer2 Prescaler, Postscaler, and Interrupt Timing Diagram 27.5 Operation Examples 27.5.1 Software Gate Mode FIGURE 27-4: Software Gate Mode Timing Diagram (MODE = 00000) 27.5.2 Hardware Gate Mode FIGURE 27-5: Hardware Gate Mode Timing Diagram (MODE = 00001) 27.5.3 Edge-Triggered Hardware Limit Mode FIGURE 27-6: Edge-Triggered Hardware Limit Mode Timing Diagram (MODE = 00100) 27.5.4 Level-Triggered Hardware Limit Mode FIGURE 27-7: Level-Triggered Hardware Limit Mode Timing Diagram (MODE = 00111) 27.5.5 Software Start One-Shot Mode FIGURE 27-8: Software Start One-shot Mode Timing Diagram (MODE = 01000) 27.5.6 Edge-Triggered One-Shot Mode FIGURE 27-9: Edge-Triggered One-Shot Mode Timing Diagram (MODE = 01001) 27.5.7 Edge-Triggered Hardware Limit One-Shot Mode FIGURE 27-10: Edge-Triggered Hardware Limit One-Shot Mode Timing Diagram (MODE = 01100) 27.5.8 Level Reset, Edge-Triggered Hardware Limit One-Shot Modes FIGURE 27-11: Low Level Reset, Edge-Triggered hardware Limit one-Shot Mode Timing Diagram (MODE = 01110) 27.5.9 Edge-Triggered Monostable Modes FIGURE 27-12: Rising Edge-Triggered Monostable Mode Timing Diagram (MODE = 10001) 27.5.10 Level-Triggered Hardware Limit One-Shot Modes FIGURE 27-13: Level-Triggered hardware Limit one-Shot Mode Timing Diagram (MODE = 10110) 27.6 Timer2 Operation During Sleep 27.7 Register Definitions: Timer2 Control Register 27-1: T2CLKCON: Timer2 Clock Selection Register Register 27-2: T2CON: Timer2 Control Register Register 27-3: T2HLT: Timer2 Hardware Limit Control Register Register 27-4: T2RST: Timer2 External Reset Signal Selection Register TABLE 27-2: Summary of Registers Associated with Timer2 28.0 Capture/Compare/PWM Modules TABLE 28-1: Available CCP Modules 28.1 Capture Mode 28.1.1 CAPTURE SOURCES FIGURE 28-1: Capture Mode Operation Block Diagram 28.1.2 Timer1 Mode Resource 28.1.3 Software Interrupt Mode 28.1.4 CCP Prescaler EXAMPLE 28-1: Changing Between Capture Prescalers 28.1.5 Capture During Sleep 28.2 Compare Mode FIGURE 28-2: Compare Mode Operation Block Diagram 28.2.1 CCPx Pin Configuration 28.2.2 Timer1 Mode Resource 28.2.3 Auto-Conversion Trigger 28.2.4 Compare During Sleep 28.3 PWM Overview 28.3.1 Standard PWM Operation FIGURE 28-3: CCP PWM Output Signal FIGURE 28-4: Simplified PWM Block Diagram 28.3.2 Setup for PWM Operation 28.3.3 CCP/PWM Clock Selection 28.3.4 Timer2 Timer Resource 28.3.5 PWM Period EQUATION 28-1: PWM Period 28.3.6 PWM Duty Cycle FIGURE 28-5: PWM 10-Bit Alignment EQUATION 28-2: Pulse Width EQUATION 28-3: Duty Cycle Ratio 28.3.7 PWM Resolution EQUATION 28-4: PWM Resolution TABLE 28-2: Example PWM Frequencies and Resolutions (Fosc = 20 MHz) TABLE 28-3: Example PWM Frequencies and Resolutions (Fosc = 8 MHz) 28.3.8 Operation in Sleep Mode 28.3.9 Changes in System Clock Frequency 28.3.10 Effects of Reset 28.4 Register Definitions: CCP Control TABLE 28-4: Long Bit Names Prefixes for CCP Peripherals Register 28-1: CCPxCON: CCPx Control Register Register 28-2: CCPxCAP: Capture Input Selection Register Register 28-3: CCPRxL Register: CCPx Register Low Byte Register 28-4: CCPRxH Register: CCPx Register High Byte TABLE 28-5: Summary Of Registers Associated with CCPx 29.0 Pulse-Width Modulation (PWM) FIGURE 29-1: PWM Output 29.1 Standard PWM Mode FIGURE 29-2: Simplified PWM Block Diagram 29.1.1 PWM Clock Selection 29.1.2 Using The tmr2 WITH THE pwm Module 29.1.3 PWM PERIOD EQUATION 29-1: PWM Period 29.1.4 PWM DUTY CYCLE EQUATION 29-2: Pulse Width EQUATION 29-3: Duty Cycle Ratio 29.1.5 PWM RESOLUTION EQUATION 29-4: PWM Resolution 29.1.6 OPERATION IN SLEEP MODE 29.1.7 CHANGES IN SYSTEM CLOCK FREQUENCY 29.1.8 EFFECTS OF RESET TABLE 29-1: Example PWM Frequencies and Resolutions (Fosc = 20 MHz) TABLE 29-2: Example PWM Frequencies and Resolutions (Fosc = 8 MHz) 29.1.9 Setup for PWM Operation 29.2 Register Definitions: PWM Control Register 29-1: PWMxCON: PWM Control Register Register 29-2: PWMXDCH: PWM Duty Cycle High Bits Register 29-3: PWMxDCL: PWM Duty Cycle Low Bits TABLE 29-3: Summary of Registers Associated with PWMx 30.0 Complementary Waveform Generator (CWG) Module TABLE 30-1: Available CWG Modules 30.1 Fundamental Operation 30.1.1 HALF-BRIDGE MODE FIGURE 30-1: Simplified CWG Block Diagram (Half-Bridge Mode) 30.1.2 PUSH-PULL MODE 30.1.3 FULL-BRIDGE MODES FIGURE 30-2: Simplified CWG Block Diagram (Push-Pull Mode) FIGURE 30-3: Simplified CWG Block Diagram (Forward and Reverse Full-Bridge Modes) 30.1.4 STEERING MODES FIGURE 30-4: Simplified CWG Block Diagram (Output Steering Modes) 30.2 Clock Source 30.3 Selectable Input Sources TABLE 30-2: Selectable Input Sources 30.4 Output Control 30.4.1 Polarity Control FIGURE 30-5: CWG Output Block Diagram 30.5 Dead-Band Control 30.5.1 Dead-Band functionality in Half-Bridge mode 30.5.2 Dead-Band functionality in Full-Bridge mode 30.6 Rising Edge and Reverse Dead Band 30.7 Falling Edge and Forward Dead Band FIGURE 30-6: Dead-Band Operation CWG1DBR = 01h, CWG1DBF = 02h FIGURE 30-7: Dead-Band Operation, CWG1DBR = 03h, CWG1DBF = 04h, Source Shorter Than Dead Band 30.8 Dead-Band Uncertainty EQUATION 30-1: Dead-Band Uncertainty FIGURE 30-8: Example of PWM Direction Change FIGURE 30-9: CWG Half-Bridge Mode Operation 30.9 CWG Steering Mode 30.9.1 Steering Synchronization FIGURE 30-10: Example of Asynchronous Steering Event (MODE<2:0> = 000) FIGURE 30-11: Example of Steering Event (MODE<2:0> = 001) 30.10 Auto-Shutdown 30.10.1 SHUTDOWN 30.10.1.1 Software Generated Shutdown 30.10.2 External Input Source 30.11 Operation During Sleep FIGURE 30-12: CWG Shutdown Block Diagram 30.12 Configuring the CWG 30.12.1 Pin Override Levels 30.12.2 Auto-Shutdown Restart 30.12.2.1 Software Controlled Restart 30.12.2.2 Auto-Restart FIGURE 30-13: Shutdown Functionality, Auto-Restart Disabled (REN = 0, LSAC = 01, LSBD = 01) FIGURE 30-14: Shutdown Functionality, Auto-Restart Enabled (REN = 1, LSAC = 01, LSBD = 01) 30.13 Register Definitions: CWG Control Register 30-1: CWG1CON0: CWG1 Control Register 0 Register 30-2: CWG1CON1: CWG1 Control Register 1 Register 30-3: CWG1DBR: CWG1 Rising Dead-Band Counter Register Register 30-4: CWG1DBF: CWG1 Falling Dead-Band Counter Register Register 30-5: CWG1AS0: CWG1 Auto-Shutdown Control Register 0 Register 30-6: CWG1AS1: CWG1 Auto-Shutdown Control Register 1 Register 30-7: CWG1STR: CWG1 Steering Control Register(1) Register 30-8: CWG1CLK: CWG1 Clock Selection Register Register 30-9: CWG1DAT: CWG1 Input Selection Register TABLE 30-3: Summary of Registers Associated with CWG 31.0 Configurable Logic Cell (CLC) TABLE 31-1: Available CLC Modules FIGURE 31-1: CLCx Simplified Block Diagram 31.1 CLCx Setup 31.1.1 Data Selection TABLE 31-2: CLCx Data Input Selection 31.1.2 Data Gating TABLE 31-3: Data Gating Logic 31.1.3 Logic Function 31.1.4 Output Polarity 31.2 CLCx Interrupts 31.3 Output Mirror Copies 31.4 Effects of a Reset 31.5 Operation During Sleep 31.6 CLCx Setup Steps FIGURE 31-2: Input Data Selection and Gating FIGURE 31-3: Programmable Logic Functions 31.7 Register Definitions: CLC Control Register 31-1: CLCxCON: Configurable Logic Cell Control Register Register 31-2: CLCxPOL: Signal Polarity Control Register Register 31-3: CLCxSEL0: Generic CLCx Data 0 Select Register Register 31-4: CLCxSEL1: Generic CLCx Data 1 Select Register Register 31-5: CLCxSEL2: Generic CLCx Data 2 Select Register Register 31-6: CLCxSEL3: Generic CLCx Data 3 Select Register Register 31-7: CLCxGLS0: Gate 0 Logic Select Register Register 31-8: CLCxGLS1: Gate 1 Logic Select Register Register 31-9: CLCxGLS2: Gate 2 Logic Select Register Register 31-10: CLCxGLS3: Gate 3 Logic Select Register Register 31-11: CLCDATA: CLC Data Output TABLE 31-4: Summary of Registers Associated with CLCx 32.0 Master Synchronous Serial Port (MSSPx) Modules 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 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-1: 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.7 Clock Synchronization and the CKP bit FIGURE 32-23: Clock Synchronization Timing 32.5.8 General Call Address Support FIGURE 32-24: Slave Mode General Call Address Sequence 32.5.9 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) 32.7 Baud Rate Generator FIGURE 32-40: Baud Rate Generator Block Diagram TABLE 32-2: MSSP Clock Rate w/BRG 32.8 Register Definitions: MSSPx Control Register 32-1: SSPxSTAT: SSPx STATUS Register Register 32-2: SSPxCON1: SSPx Control Register 1 Register 32-3: SSPxCON2: SSPx Control Register 2 (I2C Mode Only)(1) Register 32-4: SSPxCON3: SSPx Control Register 3 Register 32-5: SSPxMSK: SSPx Mask Register Register 32-6: SSPxADD: MSSPx Address and Baud Rate Register (I2C Mode) Register 32-7: SSPxBUF: MSSPx Buffer Register TABLE 32-3: Summary of Registers Associated with MSSPx 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 Set-up: FIGURE 33-3: Asynchronous Transmission FIGURE 33-4: Asynchronous Transmission (Back-to-Back) 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 33.2 Clock Accuracy with Asynchronous Operation 33.3 EUSART Baud Rate Generator (BRG) EXAMPLE 33-1: Calculating Baud Rate Error 33.3.1 Auto-Baud Detect TABLE 33-1: BRG Counter Clock Rates FIGURE 33-6: Automatic Baud Rate Calibration 33.3.2 Auto-Baud Overflow 33.3.3 Auto-Wake-up on Break 33.3.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.3.4 Break Character Sequence 33.3.4.1 Break and Sync Transmit Sequence 33.3.5 Receiving a Break Character FIGURE 33-9: Send Break Character Sequence 33.4 EUSART Synchronous Mode 33.4.1 Synchronous Master Mode 33.4.1.1 Master Clock 33.4.1.2 Clock Polarity 33.4.1.3 Synchronous Master Transmission 33.4.1.4 Synchronous Master Transmission Set-up: FIGURE 33-10: Synchronous Transmission FIGURE 33-11: Synchronous Transmission (Through TXEN) 33.4.1.5 Synchronous Master Reception 33.4.1.6 Slave Clock 33.4.1.7 Receive Overrun Error 33.4.1.8 Receiving 9-bit Characters 33.4.1.9 Synchronous Master Reception Set- up: FIGURE 33-12: Synchronous Reception (Master Mode, SREN) 33.4.2 Synchronous slave Mode 33.4.2.1 EUSART Synchronous Slave Transmit 33.4.2.2 Synchronous Slave Transmission Set-up: 33.4.2.3 EUSART Synchronous Slave Reception 33.4.2.4 Synchronous Slave Reception Set- up: 33.5 EUSART Operation During Sleep 33.5.1 Synchronous Receive During Sleep 33.5.2 Synchronous Transmit During Sleep 33.6 Register Definitions: EUSART Control Register 33-1: TXxSTA: Transmit Status and Control Register Register 33-2: RCxSTA: Receive Status and Control Register Register 33-3: BAUDxCON: Baud Rate Control Register Register 33-4: RCxREG(1): Receive Data Register Register 33-5: TXxREG(1): Transmit Data Register Register 33-6: SPxBRGL(1): Baud Rate Generator Register Register 33-7: SPxBRGH(1, 2): Baud Rate Generator High Register TABLE 33-2: Summary of Registers Associated with EUSART TABLE 33-3: Baud Rate Formulas TABLE 33-4: Baud Rate For Asynchronous Modes 34.0 Reference Clock Output Module 34.1 CLOCK SOURCE 34.1.1 Clock Synchronization 34.2 PROGRAMMABLE CLOCK DIVIDER 34.3 SELECTABLE DUTY CYCLE 34.4 OPERATION IN SLEEP MODE FIGURE 34-1: Clock Reference Block Diagram FIGURE 34-2: Clock Reference Timing 34.5 Register Definition: Reference Clock Output Control Register 34-1: CLKRCON: Reference Clock Control Register Register 34-2: CLKRCLK: Clock Reference Clock Selection Register TABLE 34-1: Summary of Registers Associated with Clock Reference Output 35.0 In-Circuit Serial Programming™ (ICSP™) 35.1 High-Voltage Programming Entry Mode 35.2 Low-Voltage Programming Entry Mode 35.3 Common Programming Interfaces FIGURE 35-1: ICD RJ-11 Style Connector Interface FIGURE 35-2: PICkit™ Programmer Style Connector Interface FIGURE 35-3: Typical Connection for ICSP™ Programming 36.0 Instruction Set Summary 36.1 Read-Modify-Write Operations TABLE 36-1: Opcode Field Descriptions TABLE 36-2: Abbreviation Descriptions 36.2 General Format for Instructions TABLE 36-3: Instruction Set TABLE 36-3: Instruction Set (Continued) 36.3 Instruction Descriptions 37.0 Electrical Specifications 37.1 Absolute Maximum Ratings(†) 37.2 Standard Operating Conditions FIGURE 37-1: Voltage Frequency Graph, -40°C £ Ta £ +125°C, PIC16F15356/75/76/85/86 Only FIGURE 37-2: Voltage Frequency Graph, -40°C £ Ta £ +125°C, PIC16LF15356/75/76/85/86 Only 37.3 DC Characteristics TABLE 37-1: Supply Voltage FIGURE 37-3: POR and POR Rearm with Slow Rising Vdd TABLE 37-2: Supply Current (Idd)(1,2,4) TABLE 37-3: Power-Down Current (Ipd)(1,2,3) TABLE 37-4: I/O Ports TABLE 37-5: Memory Programming Specifications TABLE 37-6: Thermal Characteristics 37.4 AC Characteristics FIGURE 37-4: Load Conditions FIGURE 37-5: Clock Timing TABLE 37-7: External Clock/Oscillator Timing Requirements TABLE 37-8: iNTERNAL Oscillator Parameters(1) FIGURE 37-6: Precision Calibrated HFINTOSC Frequency Accuracy Over Device Vdd and Temperature TABLE 37-9: PLL Specifications FIGURE 37-7: CLKOUT and I/O Timing TABLE 37-10: I/O and CLKOUT Timing Specifications FIGURE 37-8: Reset, Watchdog Timer, Oscillator Start-up Timer and Power-up Timer Timing FIGURE 37-9: Brown-out Reset Timing and Characteristics TABLE 37-11: Reset, WDT, Oscillator Start-up Timer, Power-up Timer, Brown-out Reset and Low-Power Brown-out Reset Specifications TABLE 37-12: Analog-to-Digital Converter (ADC) Accuracy Specifications(1,2): TABLE 37-13: Analog-to-Digital Converter (ADC) Conversion Timing Specifications FIGURE 37-10: ADC Conversion Timing (ADC Clock Fosc-based) FIGURE 37-11: ADC Conversion Timing (ADC Clock from ADCRC) TABLE 37-14: Comparator Specifications TABLE 37-15: 5-Bit DAC Specifications TABLE 37-16: Fixed Voltage Reference (FVR) Specifications TABLE 37-17: Zero Cross Detect (ZCD) Specifications FIGURE 37-12: Timer0 and Timer1 External Clock Timings TABLE 37-18: Timer0 and Timer1 External Clock Requirements FIGURE 37-13: Capture/Compare/PWM Timings (CCP) TABLE 37-19: Capture/Compare/PWM Requirements (CCP) FIGURE 37-14: CLC Propagation Timing TABLE 37-20: Configurable Logic Cell (CLC) Characteristics FIGURE 37-15: EUSART Synchronous Transmission (Master/Slave) Timing TABLE 37-21: EUSART Synchronous Transmission Characteristics FIGURE 37-16: EUSART Synchronous Receive (Master/Slave) Timing TABLE 37-22: EUSART Synchronous Receive Requirements FIGURE 37-17: SPI Master Mode Timing (CKE = 0, SMP = 0) FIGURE 37-18: SPI Master Mode Timing (CKE = 1, SMP = 1) FIGURE 37-19: SPI Slave Mode Timing (CKE = 0) FIGURE 37-20: SPI Slave Mode Timing (CKE = 1) TABLE 37-23: SPI Mode requirements FIGURE 37-21: I2C Bus Start/Stop Bits Timing TABLE 37-24: I2C Bus Start/Stop Bits Requirements FIGURE 37-22: I2C Bus Data Timing TABLE 37-25: I2C Bus Data Requirements TABLE 37-26: Temperature Indicator Requirements 38.0 DC and AC Characteristics Graphs and Charts 39.0 Development Support 39.1 MPLAB X Integrated Development Environment Software 39.2 MPLAB XC Compilers 39.3 MPASM Assembler 39.4 MPLINK Object Linker/ MPLIB Object Librarian 39.5 MPLAB Assembler, Linker and Librarian for Various Device Families 39.6 MPLAB X SIM Software Simulator 39.7 MPLAB REAL ICE In-Circuit Emulator System 39.8 MPLAB ICD 3 In-Circuit Debugger System 39.9 PICkit 3 In-Circuit Debugger/ Programmer 39.10 MPLAB PM3 Device Programmer 39.11 Demonstration/Development Boards, Evaluation Kits, and Starter Kits 39.12 Third-Party Development Tools 40.0 Packaging Information 40.1 Package Marking Information 40.1 Package Marking Information (Continued) 40.1 Package Marking Information (Continued) 40.1 Package Marking Information (Continued) 40.1 Package Marking Information (Continued) Appendix A: Data Sheet Revision History The Microchip Website Customer Change Notification Service Customer Support Product Identification System Trademarks Worldwide Sales and Service