3.9.2 CWG with Multiple Modes
Complementary Waveform Generator with Multiple Modes
3.9.2.1 Introduction
The Complementary Waveform Generator (CWG) produces half-bridge, full-bridge, and steering of Pulse Width Modulation (PWM) waveforms. The CWG generates two output waveforms from the selected input source. It is backwards compatible with previous CCP functions.
3.9.2.2 Supported Device Families
PIC12/16F161x | PIC12/16F184x | PIC16F153xx |
PIC16F171xx | PIC16F180xx | PIC16F181xx |
PIC16F183xx | PIC16F184xx | PIC16F188xx |
PIC16F191xx | PIC18F-K40 | PIC18F-K42 |
PIC18F-K83 | PIC18F-Q10 | PIC18F-Q20 |
PIC18F-Q24 | PIC18F-Q40 | PIC18F-Q41 |
PIC18F-Q43 | PIC18F-Q71 | PIC18F-Q83 |
PIC18F-Q84 |
3.9.2.3 Required Header Files:
#include "mcc_generated_files/cwg/cwg[X].h"
3.9.2.4 Module Documentation
3.9.2.4.1 CWGx
This file contains the API prototypes for the CWGx driver.
Module description
This file contains the API prototypes for the CWGx driver.
Functions
void CWGx_Initialize (void)
Initializes the CWGx module. This is called only once before calling other CWGx APIs.
void CWGx_LoadRiseDeadbandCount (uint8_t dutyValue)
Sets the duration of the dead-band interval on the rising edge of the input source signal.
void CWGx_LoadFallDeadbandCount (uint8_t dutyValue)
Sets the duration of the dead-band interval on the falling edge of the input source signal.
void CWGx_LoadBufferEnable (void)
Enables the CWGx module to load the buffers on the next rising or falling event of the input signal.
bool CWGx_IsModuleEnabled (void)
Returns the status of the CWGx module.
void CWGx_AutoShutdownEventSet (void)
Puts the CWG outputs into the Auto-Shutdown state.
void CWGx_AutoShutdownEventClear (void)
Resumes the operation of the CWG when the Auto-Shutdown state is disabled.
Function Documentation
CWGx_AutoShutdownEventClear()
void CWGx_AutoShutdownEventClear (void )
Resumes the operation of the CWG when the Auto-Shutdown state is disabled.
CWGx_Initialize() and CWGx_AutoShutdownEventSet() are already called. |
None. |
None. |
CWGx_AutoShutdownEventSet()
void CWGx_AutoShutdownEventSet (void )
Puts the CWG outputs into the Auto-Shutdown state.
CWGx_Initialize() is already called. |
None. |
None. |
CWGx_Initialize()
void CWGx_Initialize (void )
Initializes the CWGx module. This is called only once before calling other CWGx APIs.
None. |
None. |
CWGx_IsModuleEnabled()
bool CWGx_IsModuleEnabled (void )
Returns the status of the CWGx module.
None. |
True |
- CWGx is enabled. |
False |
- CWGx is disabled. |
CWGx_LoadBufferEnable()
void CWGx_LoadBufferEnable (void )
Enables the CWGx module to load the buffers on the next rising or falling event of the input signal.
CWGx_Initialize() is already called. |
None. |
None. |
CWGx_LoadFallDeadbandCount()
void CWGx_LoadFallDeadbandCount (uint8_t dutyValue)
Sets the duration of the dead-band interval on the falling edge of the input source signal.
CWGx_Initialize() is already called. |
dutyValue |
- Duty cycle value. |
None. |
CWGx_LoadRiseDeadbandCount()
void CWGx_LoadRiseDeadbandCount (uint8_t dutyValue)
Sets the duration of the dead-band interval on the rising edge of the input source signal.
CWGx_Initialize() is already called. |
dutyValue |
- Duty cycle value. |
None. |
3.9.2.5 File Documentation
3.9.2.5.1 source/cwgx.c File Reference
This file contains the API implementations for the CWGx driver.
#include <xc.h> #include "../cwg1.h" #include "../../system/interrupt.h"
Functions
void CWGx_Initialize (void)
Initializes the CWGx module. This is called only once before calling other CWGx APIs.
void CWGx_LoadRiseDeadbandCount (uint8_t dutyValue)
Sets the duration of the dead-band interval on the rising edge of the input source signal.
void CWGx_LoadFallDeadbandCount (uint8_t dutyValue)
Sets the duration of the dead-band interval on the falling edge of the input source signal.
void CWGx_LoadBufferEnable (void)
Enables the CWGx module to load the buffers on the next rising or falling event of the input signal.
bool CWGx_IsModuleEnabled (void)
Returns the status of the CWGx module.
void CWGx_AutoShutdownEventSet (void)
Puts the CWG outputs into the Auto-Shutdown state.
void CWGx_AutoShutdownEventClear (void)
Resumes the operation of the CWG when the Auto-Shutdown state is disabled.
void __interrupt (irq(CWG1), base(8))
Detailed Description
This file contains the API implementations for the CWGx driver.
CWG1 Generated Driver File.
Function Documentation
__interrupt()
void __interrupt (irq(CWG1) , base(8) )
3.9.2.5.2 source/cwgx.h File Reference
#include <xc.h> #include <stdint.h> #include <stdbool.h>
Functions
void CWGx_Initialize (void)
Initializes the CWGx module. This is called only once before calling other CWGx APIs.
void CWGx_LoadRiseDeadbandCount (uint8_t dutyValue)
Sets the duration of the dead-band interval on the rising edge of the input source signal.
void CWGx_LoadFallDeadbandCount (uint8_t dutyValue)
Sets the duration of the dead-band interval on the falling edge of the input source signal.
void CWGx_LoadBufferEnable (void)
Enables the CWGx module to load the buffers on the next rising or falling event of the input signal.
bool CWGx_IsModuleEnabled (void)
Returns the status of the CWGx module.
void CWGx_AutoShutdownEventSet (void)
Puts the CWG outputs into the Auto-Shutdown state.
void CWGx_AutoShutdownEventClear (void)
Resumes the operation of the CWG when the Auto-Shutdown state is disabled.
Detailed Description
CWG1 Generated Driver API Header File.