3.4.2 ECCP - Enhanced CCP
Enhanced Capture/Compare/PWM
3.4.2.1 Introduction
The Enhanced Capture/Compare/PWM module is similar to the standard CCP peripheral but with enhanced PWM capabilities such as provision for two or four output channels, output steering, programmable polarity, programmable dead-band control, and automatic shutdown and restart. Capture, Compare, and single-output PWM functions of the ECCP module are the same as described for the standard CCP module.
3.4.2.2 Supported Device Families
PIC16(L)F193x | PIC16(L)F194x | PIC12(L)F182x |
PIC12(L)F184x | PIC16(L)F182x | PIC16(L)F184x |
PIC18F-K20 | PIC18(L)F-K22 | PIC18(L)F-K50 |
PIC18(L)F-K80 | PIC18(L)F-K90 |
3.4.2.3 Required Header Files:
#include "mcc_generated_files/capture/eccp[x].h" or
#include "mcc_generated_files/compare/eccp[x].h" or
#include "mcc_generated_files/pwm/eccp[x].h"
3.4.2.4 Module Documentation
3.4.2.4.1 CAPTURE1
This file contains the API prototypes and other data types for the ECCP1 module.
Module description
This file contains the API prototypes and other data types for the ECCP1 module.
Data structures
union CCPR1_PERIOD_REG_T
Custom data type to hold the low byte, high byte and 16-bit values of the Period register.
Functions
static void ECCP1_DefaultCallBack (uint16_t capturedValue)
Default callback function for the capture interrupt events.
void ECCP1_Initialize (void)
Initializes the ECCP1 module. This is called only once before calling other ECCP1 APIs.
void ECCP1_CaptureISR (void)
Implements the Interrupt Service Routine (ISR) for the capture interrupt.
void ECCP1_SetCallBack (void(*customCallBack)(uint16_t))
Assigns a callback function that will be called from the Capture ISR when a capture interrupt event occurs.
Variables
static void(* ECCP1_CallBack )(uint16_t)
Declares the function pointer for the callback API.
Function Documentation
ECCP1_CaptureISR()
void ECCP1_CaptureISR (void )
Implements the Interrupt Service Routine (ISR) for the capture interrupt.
None. |
None. |
ECCP1_DefaultCallBack()
static void ECCP1_DefaultCallBack (uint16_t capturedValue)[static]
Default callback function for the capture interrupt events.
capturedValue |
- 16-bit captured value |
None. |
ECCP1_Initialize()
void ECCP1_Initialize (void )
Initializes the ECCP1 module. This is called only once before calling other ECCP1 APIs.
None. |
None. |
ECCP1_SetCallBack()
void ECCP1_SetCallBack (void(*)(uint16_t) customCallBack)
Assigns a callback function that will be called from the Capture ISR when a capture interrupt event occurs.
(*customCallBack)(uint16_t) |
- Function pointer to the new callback |
None. |
Variable Documentation
ECCP1_CallBack
void(* ECCP1_CallBack) (uint16_t)[static]
Declares the function pointer for the callback API.
3.4.2.4.2 COMPARE1
This file contains the API prototypes and other data types for the ECCP1 module.
Module description
This file contains the API prototypes and other data types for the ECCP1 module.
Data structures
union CCPR1_PERIOD_REG_T
Custom data type to hold the low byte, high byte and 16-bit values of the Period register.
Functions
void ECCP1_Initialize (void)
Initializes the ECCP1 module. This is called only once before calling other ECCP1 APIs.
void ECCP1_SetCompareCount (uint16_t compareCount)
Sets the 16-bit compare value.
void ECCP1_CompareISR (void)
Implements the Interrupt Service Routine (ISR) for the compare interrupt.
Function Documentation
ECCP1_CompareISR()
void ECCP1_CompareISR (void )
Implements the Interrupt Service Routine (ISR) for the compare interrupt.
None. |
None. |
ECCP1_Initialize()
void ECCP1_Initialize (void )
Initializes the ECCP1 module. This is called only once before calling other ECCP1 APIs.
None. |
None. |
ECCP1_SetCompareCount()
void ECCP1_SetCompareCount (uint16_t compareCount)
Sets the 16-bit compare value.
ECCP1_Initialize() is already called. |
compareCount |
- 16-bit unsigned value |
None. |
3.4.2.4.3 PWM1
This file contains the API prototypes for the PWM1 module.
Module description
This file contains the API prototypes for the PWM1 module.
Definitions
#define EPWM1_Initialize ECCP1_Initialize
Defines the Custom Name for the ECCP1_Initialize API.
#define EPWM1_LoadDutyValue ECCP1_LoadDutyValue
Defines the Custom Name for the ECCP1_LoadDutyValue API.
Functions
void ECCP1_Initialize (void)
Initializes the ECCP1 module. This is called only once before calling other ECCP1 APIs.
void ECCP1_LoadDutyValue (uint16_t dutyValue)
Loads the 16-bit duty cycle value.
Definition Documentation
EPWM1_Initialize
#define EPWM1_Initialize ECCP1_Initialize
Defines the Custom Name for the ECCP1_Initialize API.
EPWM1_LoadDutyValue
#define EPWM1_LoadDutyValue ECCP1_LoadDutyValue
Defines the Custom Name for the ECCP1_LoadDutyValue API.
Function Documentation
ECCP1_Initialize()
void ECCP1_Initialize (void )
Initializes the ECCP1 module. This is called only once before calling other ECCP1 APIs.
None. |
None. |
ECCP1_LoadDutyValue()
void ECCP1_LoadDutyValue (uint16_t dutyValue)
Loads the 16-bit duty cycle value.
ECCP1_Initialize() is already called. |
dutyValue |
- 16-bit duty cycle value |
None. |
3.4.2.5 Class Documentation
3.4.2.5.1 CCPR1_PERIOD_REG_T Union Reference
Custom data type to hold the low byte, high byte and 16-bit values of the Period register.
Detailed Description
Custom data type to hold the low byte, high byte and 16-bit values of the Period register.
#include <eccpcapture.h>
The documentation for this union was generated from the following file:
source/
3.4.2.5.2 CCPR1Reg_tag Union Reference
#include <eccpcapture.h>
Public Attributes
struct {
};
struct {
uint16_t ccpr1_16Bit
};
struct {
};
struct {
uint16_t ccpr1_16Bit
};
Member Data Documentation
The documentation for this union was generated from the following files:
source/
source/
@1
struct { ... }
@3
struct { ... }
@5
struct { ... }
@7
struct { ... }
ccpr1_16Bit
uint16_t ccpr1_16Bit
CCPR1 16-bit.
ccpr1h
uint8_t ccpr1h
CCPR1H high byte.
ccpr1l
uint8_t ccpr1l
CCPR1L low byte.
3.4.2.6 File Documentation
3.4.2.6.1 source/eccpcapture.c File Reference
#include <xc.h> #include "../eccp1.h"
Functions
static void ECCP1_DefaultCallBack (uint16_t capturedValue)
Default callback function for the capture interrupt events.
void ECCP1_Initialize (void)
Initializes the ECCP1 module. This is called only once before calling other ECCP1 APIs.
void ECCP1_CaptureISR (void)
Implements the Interrupt Service Routine (ISR) for the capture interrupt.
void ECCP1_SetCallBack (void(*customCallBack)(uint16_t))
Assigns a callback function that will be called from the Capture ISR when a capture interrupt event occurs.
Variables
static void(* ECCP1_CallBack )(uint16_t)
Declares the function pointer for the callback API.
3.4.2.6.2 source/eccpcapture.h File Reference
#include <xc.h> #include <stdint.h> #include <stdbool.h>
Data structures
union CCPR1Reg_tag
Functions
void ECCP1_Initialize (void)
Initializes the ECCP1 module. This is called only once before calling other ECCP1 APIs.
void ECCP1_CaptureISR (void)
Implements the Interrupt Service Routine (ISR) for the capture interrupt.
void ECCP1_SetCallBack (void(*customCallBack)(uint16_t))
Assigns a callback function that will be called from the Capture ISR when a capture interrupt event occurs.
Typedefs
typedef union CCPR1Reg_tag CCPR1_PERIOD_REG_T
Typedef Documentation
CCPR1_PERIOD_REG_T
typedef union CCPR1Reg_tag CCPR1_PERIOD_REG_T
3.4.2.6.3 source/eccpcompare.c File Reference
#include <xc.h> #include "../eccp1.h"
Functions
void ECCP1_Initialize (void)
Initializes the ECCP1 module. This is called only once before calling other ECCP1 APIs.
void ECCP1_SetCompareCount (uint16_t compareCount)
Sets the 16-bit compare value.
void ECCP1_CompareISR (void)
Implements the Interrupt Service Routine (ISR) for the compare interrupt.
3.4.2.6.4 source/eccpcompare.h File Reference
#include <xc.h> #include <stdint.h> #include <stdbool.h>
Data structures
union CCPR1Reg_tag
Functions
void ECCP1_Initialize (void)
Initializes the ECCP1 module. This is called only once before calling other ECCP1 APIs.
void ECCP1_SetCompareCount (uint16_t compareCount)
Sets the 16-bit compare value.
void ECCP1_CompareISR (void)
Implements the Interrupt Service Routine (ISR) for the compare interrupt.
Typedefs
typedef union CCPR1Reg_tag CCPR1_PERIOD_REG_T
Typedef Documentation
CCPR1_PERIOD_REG_T
typedef union CCPR1Reg_tag CCPR1_PERIOD_REG_T
3.4.2.6.5 source/eccppwm.c File Reference
#include <xc.h> #include "../eccp1.h"
Functions
void ECCP1_Initialize (void)
Initializes the ECCP1 module. This is called only once before calling other ECCP1 APIs.
void ECCP1_LoadDutyValue (uint16_t dutyValue)
Loads the 16-bit duty cycle value.
Macros
#define PWM1_INITIALIZE_DUTY_VALUE 0
Macro Definition Documentation
PWM1_INITIALIZE_DUTY_VALUE
#define PWM1_INITIALIZE_DUTY_VALUE 0
3.4.2.6.6 source/eccppwm.h File Reference
#include <xc.h> #include <stdint.h> #include <stdbool.h>
Functions
void ECCP1_Initialize (void)
Initializes the ECCP1 module. This is called only once before calling other ECCP1 APIs.
void ECCP1_LoadDutyValue (uint16_t dutyValue)
Loads the 16-bit duty cycle value.
Macros
#define EPWM1_Initialize ECCP1_Initialize
Defines the Custom Name for the ECCP1_Initialize API.
#define EPWM1_LoadDutyValue ECCP1_LoadDutyValue
Defines the Custom Name for the ECCP1_LoadDutyValue API.