//****************************************************************************
// @Module Capture / Compare Unit 2 (CAPCOM2)
// @Filename CC2.C
// @Project cc23.dav
//----------------------------------------------------------------------------
// @Controller Infineon XC167CI-32F40
//
// @Compiler Keil
//
// @Codegenerator 2.5
//
// @Description This file contains functions that use the CC2 module.
//
//----------------------------------------------------------------------------
// @Date 2007-11-14 14:34:26
//
//****************************************************************************
// USER CODE BEGIN (CC2_General,1)
// USER CODE END
//****************************************************************************
// @Project Includes
//****************************************************************************
#include "MAIN.H"
// USER CODE BEGIN (CC2_General,2)
// USER CODE END
//****************************************************************************
// @Macros
//****************************************************************************
// USER CODE BEGIN (CC2_General,3)
// USER CODE END
//****************************************************************************
// @Defines
//****************************************************************************
// USER CODE BEGIN (CC2_General,4)
// USER CODE END
//****************************************************************************
// @Typedefs
//****************************************************************************
// USER CODE BEGIN (CC2_General,5)
// USER CODE END
//****************************************************************************
// @Imported Global Variables
//****************************************************************************
// USER CODE BEGIN (CC2_General,6)
// USER CODE END
//****************************************************************************
// @Global Variables
//****************************************************************************
// USER CODE BEGIN (CC2_General,7)
// USER CODE END
//****************************************************************************
// @External Prototypes
//****************************************************************************
// USER CODE BEGIN (CC2_General,8)
// USER CODE END
//****************************************************************************
// @Prototypes Of Local Functions
//****************************************************************************
// USER CODE BEGIN (CC2_General,9)
// USER CODE END
//****************************************************************************
// @Function void CC2_vInit(void)
//
//----------------------------------------------------------------------------
// @Description This is the initialization function of the CAPCOM2 function
// library. It is assumed that the SFRs used by this library
// are in its reset state.
//
//----------------------------------------------------------------------------
// @Returnvalue None
//
//----------------------------------------------------------------------------
// @Parameters None
//
//----------------------------------------------------------------------------
// @Date 2007-11-14
//
//****************************************************************************
// USER CODE BEGIN (Init,1)
// USER CODE END
void CC2_vInit(void)
{
// USER CODE BEGIN (Init,2)
// USER CODE END
/// -----------------------------------------------------------------------
/// Configuration of CAPCOM2 Control:
/// -----------------------------------------------------------------------
/// - the contents of the port register is changed by the CAPCOM2 unit
/// - staggered mode is disabled
CC2_IOC = 0x0004; // load CAPCOM2 I/O control register
/// -----------------------------------------------------------------------
/// Configuration of CAPCOM2 Timer 7:
/// -----------------------------------------------------------------------
/// - timer 7 works in timer mode
/// - prescaler factor is 1
/// - timer 7 run bit is set
/// -----------------------------------------------------------------------
/// Configuration of CAPCOM2 Timer 8:
/// -----------------------------------------------------------------------
/// - timer 8 works in timer mode
/// - prescaler factor is 8
/// - timer 8 run bit is set
CC2_T78CON = 0x0300; // load CAPCOM2 timer 7 and timer 8 control
// register
CC2_T7 = 0x0000; // load CAPCOM2 timer 7 register
CC2_T7REL = 0x0000; // load CAPCOM2 timer 7 reload register
CC2_T8 = 0x0000; // load CAPCOM2 timer 8 register
CC2_T8REL = 0x0000; // load CAPCOM2 timer 8 reload register
/// -----------------------------------------------------------------------
/// Configuration of the used CAPCOM2 Timer Port Pins:
/// -----------------------------------------------------------------------
/// -----------------------------------------------------------------------
/// Configuration of the used CAPCOM2 Timer Interrupts:
/// -----------------------------------------------------------------------
/// -----------------------------------------------------------------------
/// Configuration of the used CAPCOM2 Channel 16:
/// -----------------------------------------------------------------------
/// - channel 16 is disabled
CC2_CC16 = 0x0000; // load CAPCOM2 channel 16 register
/// -----------------------------------------------------------------------
/// Configuration of the used CAPCOM2 Channel 17:
/// -----------------------------------------------------------------------
/// - channel 17 is disabled
CC2_CC17 = 0x0000; // load CAPCOM2 channel 17 register
/// -----------------------------------------------------------------------
/// Configuration of the used CAPCOM2 Channel 18:
/// -----------------------------------------------------------------------
/// - channel 18 is disabled
CC2_CC18 = 0x0000; // load CAPCOM2 channel 18 register
/// -----------------------------------------------------------------------
/// Configuration of the used CAPCOM2 Channel 19:
/// -----------------------------------------------------------------------
/// - channel 19 is disabled
CC2_CC19 = 0x0000; // load CAPCOM2 channel 19 register
/// -----------------------------------------------------------------------
/// Configuration of the used CAPCOM2 Channel 20:
/// -----------------------------------------------------------------------
/// - compare mode 3: set bit CC4IO and pin CC20IO (P9.4) on each match
/// - CC20 allocated to CAPCOM2 timer 7
/// - single event mode is disabled
CC2_CC20 = 0xD000; // load CAPCOM2 channel 20 register
/// -----------------------------------------------------------------------
/// Configuration of the used CAPCOM2 Channel 21:
/// -----------------------------------------------------------------------
/// - channel 21 is disabled
CC2_CC21 = 0x0000; // load CAPCOM2 channel 21 register
/// -----------------------------------------------------------------------
/// Configuration of the used CAPCOM2 Channel 22:
/// -----------------------------------------------------------------------
/// - channel 22 is disabled
CC2_CC22 = 0x0000; // load CAPCOM2 channel 22 register
/// -----------------------------------------------------------------------
/// Configuration of the used CAPCO
CAPCOM.rar_Capcom单元_c166v2单片机
版权申诉
63 浏览量
2022-09-22
21:06:24
上传
评论
收藏 231KB RAR 举报
alvarocfc
- 粉丝: 105
- 资源: 1万+
评论0