The Output Compare Peripheral Library is used to simplify low-level access to the Output Compare module without having the need to directly interact with the module's registers. The function names are generic and lead to easier access to the Output Compare module on different devices. The figure below shows the output compare module Software Abstraction Block Diagram.
The library interface routines are divided into various sub-sections, which address one of the blocks or the overall operation of the Output Compare module.
Library Interface Section |
Description |
General Setup Functions |
Provides setup, configuration and status control interface routines |
Compare Mode Functions |
Provides Compare mode interface routines |
Timer Functions |
Provides Timer interface routines |
Power-Saving Modes Functions |
Provides Power-Saving modes interface routines |
Faults Functions |
Provides Faults interface routines |
Feature Existence Functions |
Provides interface routines that determine whether or not certain features are available |
Function Name |
Description |
PLIB_OC_Disable |
Disable the OC module |
PLIB_OC_Enable |
Enables the OC module |
PLIB_OC_ModeSelect |
Selects the compare mode for the OC module |
PLIB_OC_PolarityInvertedDisable |
Disables OC module output inversion polarity |
PLIB_OC_PolarityInvertedEnable |
Output compare polarity is inverted |
Function Name |
Description |
PLIB_OC_Buffer16BitSet |
Sets a 16-bit primary compare value for compare operations |
PLIB_OC_Buffer32BitSet |
Sets a 32-bit primary compare value for compare operations |
PLIB_OC_BufferSizeSelect |
Sets the buffer size and pulse width to 16-bits or 32-bits |
PLIB_OC_PulseWidth16BitSet |
Sets a 16-bit pulse width for OC module output |
PLIB_OC_PulseWidth32BitSet |
Sets a 32-bit pulse width for OC module output |
PLIB_OC_PWMDutyCycleResolutionSet |
Sets the PWM duty cycle resolution and delays the falling edge of OC output in compare modes |
Function Name |
Description |
PLIB_OC_IsTriggered |
Checks whether or not a timer source has been triggered |
PLIB_OC_SyncModeSelect |
Selects the synchronization mode for the OC module |
PLIB_OC_SyncSourceSelect |
Selects the input source for synchronous or asynchronous (triggered) operation of the OC module |
PLIB_OC_TimerSelect |
Selects a clock source for the OC module |
PLIB_OC_TriggerClear |
Clears the trigger status for the OC module |
PLIB_OC_TimerSelect |
Selects a clock source for the OC module |
PLIB_OC_TriggerClear |
Clears the trigger status for the OC module |
PLIB_OC_TriggerSet |
Sets the trigger status for the OC module |
PLIB_OC_TriggerStatusModeSelect |
Selects the trigger status reset mode |
PLIB_OC_AlternateClockDisable |
Selects Timer 2/3 instead of the alternate clock source |
PLIB_OC_AlternateClockEnable |
Selects the alternate clock source |
Function Name |
Description |
PLIB_OC_StopInIdleDisable |
OC module continues operating when the device enters Idle mode |
PLIB_OC_StopInIdleEnable |
Discontinues OC module operation when the device enters Idle mode |
Function Name |
Description |
PLIB_OC_FaultHasOccurred |
Checks if a PWM fault has occurred |
PLIB_OC_FaultInputSelect |
Selects a Fault input for the OC module |
PLIB_OC_FaultModeSelect |
Selects an automatic or software-based mode to clear the Fault |
PLIB_OC_FaultOutSelect OC |
output pin is driven to a known state on a Fault |
PLIB_OC_FaultTristateSelect |
The OC module output can be tri-stated or driven to a known state when a Fault occurs |
Function Name |
Description |
PLIB_OC_ExistsAlternateClock |
Identifies whether the AlternateClock feature exists on the OC module |
PLIB_OC_ExistsBufferSize |
Identifies whether the BufferSize feature exists on the OC module |
PLIB_OC_ExistsBufferValue |
Identifies whether the BufferValue feature exists on the OC module |
PLIB_OC_ExistsCompareModeSelect |
Identifies whether the CompareModeSelect feature exists on the OC module |
PLIB_OC_ExistsEnableControl |
Identifies whether the EnableControl feature exists on the OC module |
PLIB_OC_ExistsFaultInput |
Identifies whether the FaultInput feature exists on the OC module |
PLIB_OC_ExistsFaultModeSelect |
Identifies whether the FaultModeSelect feature exists on the OC module |
PLIB_OC_ExistsFaultOutSelect |
Identifies whether the FaultOut feature exists on the OC module |
PLIB_OC_ExistsFaultStatus |
Identifies whether the FaultStatus feature exists on the OC module |
PLIB_OC_ExistsFaultTristateSelect |
Identifies whether the FaultTristateSelect feature exists on the OC module |
PLIB_OC_ExistsPolarityInvert |
Identifies whether the PolarityInvert feature exists on the OC module |
PLIB_OC_ExistsPulseWidth |
Identifies whether the PulseWidth feature exists on the OC module |
PLIB_OC_ExistsPWMDutyCycleResolutionControl |
Identifies whether the PWMDutyCycleResolution feature exists on the OC module |
PLIB_OC_ExistsStopInIdle |
Identifies whether the StopInIdle feature exists on the OC module |
PLIB_OC_ExistsSyncModeSelect |
Identifies whether the SyncModeSelect feature exists on the OC module |
PLIB_OC_ExistsSyncSourceSelect |
Identifies whether the SyncSourceSelect feature exists on the OC module |
PLIB_OC_ExistsTimerSelect |
Identifies whether the TimerSelect feature exists on the OC module |
PLIB_OC_ExistsTimerTriggered |
Identifies whether the TimerTriggered feature exists on the OC module |
PLIB_OC_ExistsTriggerControl |
Identifies whether the TriggerControl feature exists on the OC module |
PLIB_OC_ExistsTriggerStatusModeSelect |
Identifies whether the TriggerStatusModeSelect feature exists on the OC module |
Function Name |
Description |
OC_16BIT_TIMERS |
Lists different 16-bit time bases for OC module |
OC_BUFFER_SIZE |
Lists different buffer sizes for compare value |
OC_CLOCK_RESOLUTION |
Lists different PWM resolutions for PWM mode and OC output falling edge delay for compare modes |
OC_COMPARE_MODES |
Lists different compare modes for OC module |
OC_FAULT_MODES |
Lists modes to clear fault mode |
OC_FAULT_OUT |
Provides state of OC output pin when a fault occurs |
OC_FAULT_TRISTATE |
Lists modes to clear fault mode |
OC_FAULTS |
Lists different fault sources for OC module |
OC_MODULE_ID |
This enumeration defines number of modules which are available on the microcontroller. This is the super set of all the possible instances that might be available on Microchip microcontrollers. Refer to the specific device data sheet to get the correct number of modules defined for the desired microcontroller |
OC_SYNC_MODES |
Lists different synchronization modes for OC module |
OC_SYNC_SOURCES |
Lists different synchronization sources for OC module |