📄 ccp.txt
字号:
Title: timer1
Target: PIC18Cxx8
Description:
A sample project file to be used with HI-TIDE, to demonstrate the functionality of the microcontroller's
CAPTURE/COMPARE/PWM (CCP) MODULES. This project tests CAPTURE and COMPARE operations.
PWM is tested in a separate project.
Each CCP (Capture/Compare/PWM) module contains a 16-bit register that can operate as a 16-bit
capture register, as a 16-bit compare register, or as a PWM Duty Cycle register. Table 14-1 shows
the timer resources of the CCP module modes.
CCP1 Module
Capture/Compare/PWM Register1 (CCPR1) is comprised of two 8-bit registers: CCPR1L (low byte) and
CCPR1H (high byte). The CCP1CON register controls the operation of CCP1. All are readable and writable.
CCP2 Module
Capture/Compare/PWM Register2 (CCPR2) is comprised of two 8-bit registers: CCPR2L (low byte) and
CCPR2H (high byte). The CCP2CON register controls the operation of CCP2. All are readable and writable.
Controls:
Both CCP1 and CCP2 are identical in their operation, except that the CCP2 Special Event Trigger will start
an A/D conversion if the A/D module is enabled. The CCPx module can operate in one of 12 modes
(including PWM and OFF modes). The CCPx mode is defined via CCPxCON register. The register's contens
are changed when corresponding PUSH button is pressed. Current value of CCP1CON and CCP2CON are
displayed using 4-bit RED and BLUE LED pannels respectively.
Each CCP module is assigned an IO pin (RC1 for CCP2, and RC2 for CCP1). Each pin is automatically
configured as Input or Output by the project code depending on current modes of corresponding CCP modules.
Each CCP IO pin is connected to an LED and a PUSH button. PUSH button is used to generate events when CCP
is in CAPTURE mode. LED is used to indicate even when CCP is in COMPARE mode.
Two 8-bit DIP switches are used to set values of CCPR1L and CCPR2L registers when CCPs are used in
COMPARE mode. Note:CCPR1H and CCPR2H are always set to 0.
USART is used to provide additional information about the current status of the CCPs module.
Note: To understand available modes of operation, please refer to the datasheet for the PIC18Cxx8 device.
Connections to the PIC18Cxx8:
Pushbutton 1 -> PORTB4
LED RED [0..3] 1 -> PORTF[0..3]
DIP RED [0..7] 1 -> PORTD[0..7]
Pushbutton 2 -> PORTC2
LED RED 2 -> PORTC2
Pushbutton 3 -> PORTB5
LED BLUE [0..3] 3 -> PORTF[4..7]
DIP BLUE [0..7] 2 -> PORTH[0..7]
Pushbutton 4 -> PORTE7
LED RED 4 -> PORTE7
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -