Parameters:
mode is a constant. Valid constants are in the devices .h file and are as follows:
Disable the CCP:
CCP_OFF
Set CCP to capture mode:
CCP_CAPTURE_FE
Capture on falling edge
CCP_CAPTURE_RE
Capture on rising edge
CCP_CAPTURE_DIV_4
Capture after 4 pulses
CCP_CAPTURE_DIV_16
Capture after 16 pulses
Set CCP to compare mode:
CCP_COMPARE_SET_ON_MATCH
Output high on compare
CCP_COMPARE_CLR_ON_MATCH
Output low on compare
CCP_COMPARE_INT
interrupt on compare
CCP_COMPARE_RESET_TIMER
Reset timer on compare
Set CCP to PWM mode:
CCP_PWM
Enable Pulse Width Modulator
Returns:
undefined
Function:
Initialize the CCP. The CCP counters may be accessed using the long variables CCP_1 and CCP_2. The CCP operates in 3 modes. In capture mode it will copy the timer 1 count value to CCP_x when the input pin event occurs. In compare mode it will trigger an action when timer 1 and CCP_x are equal. In PWM mode it will generate a square wave. The PCW wizard will help to set the correct mode and timer settings for a particular application.
Availability:
This function is only available on devices with CCP hardware.
Requires
Constants are defined in the devices .h file.