⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cc6.c

📁 XC8888是XC800家族的新成员
💻 C
📖 第 1 页 / 共 2 页
字号:
//****************************************************************************
// @Module        Capture / Compare Unit 6 (CCU6)
// @Filename      CC6.C
// @Project       CCU01.dav
//----------------------------------------------------------------------------
// @Controller    Infineon XC886CLM
//
// @Compiler      Keil
//
// @Codegenerator 1.0
//
// @Description   This file contains functions that use the CCU6 module.
//
//----------------------------------------------------------------------------
// @Date          8/4/2006 3:20:46 PM
//
//****************************************************************************

// USER CODE BEGIN (CCU6_General,1)

// USER CODE END



//****************************************************************************
// @Project Includes
//****************************************************************************

#include "MAIN.H"

// USER CODE BEGIN (CCU6_General,2)

// USER CODE END


//****************************************************************************
// @Macros
//****************************************************************************

// USER CODE BEGIN (CCU6_General,3)

// USER CODE END


//****************************************************************************
// @Defines
//****************************************************************************

// USER CODE BEGIN (CCU6_General,4)

// USER CODE END


//****************************************************************************
// @Typedefs
//****************************************************************************

// USER CODE BEGIN (CCU6_General,5)

// USER CODE END


//****************************************************************************
// @Imported Global Variables
//****************************************************************************

// USER CODE BEGIN (CCU6_General,6)

// USER CODE END


//****************************************************************************
// @Global Variables
//****************************************************************************

// USER CODE BEGIN (CCU6_General,7)

// USER CODE END


//****************************************************************************
// @External Prototypes
//****************************************************************************

// USER CODE BEGIN (CCU6_General,8)

// USER CODE END


//****************************************************************************
// @Prototypes Of Local Functions
//****************************************************************************

// USER CODE BEGIN (CCU6_General,9)

// USER CODE END


//****************************************************************************
// @Function      void CC6_vInit(void) 
//
//----------------------------------------------------------------------------
// @Description   This is the initialization function of the CCU6 function 
//                library. It is assumed that the SFRs used by this library 
//                are in their reset state. 
//
//----------------------------------------------------------------------------
// @Returnvalue   None
//
//----------------------------------------------------------------------------
// @Parameters    None
//
//----------------------------------------------------------------------------
// @Date          8/4/2006
//
//****************************************************************************

// USER CODE BEGIN (Init,1)

// USER CODE END

void CC6_vInit(void)
{
  // USER CODE BEGIN (Init,2)

  // USER CODE END

  SFR_PAGE(_cc1, noSST);         // switch to page 1

  ///  -----------------------------------------------------------------------
  ///  Configuration of Timer Control Register
  ///  -----------------------------------------------------------------------

  CCU6_TCTR0L    =  0x80;        // load CCU6 timer control register 0 low
  CCU6_TCTR0H    =  0x00;        // load CCU6 timer control register 0 high

  ///  -----------------------------------------------------------------------
  ///  Configuration of CCU6 Timer 12:
  ///  -----------------------------------------------------------------------
  ///  - prescaler factor is 1
  ///  - timer 12 run bit is set
  ///  - single shot mode is disabled
  ///  - timer 12 works in center aligned mode
  ///  - interrupt on period match is disabled
  ///  - interrupt on one match is disabled

  CCU6_T12PRL    =  0xFF;        // load CCU6 T12 period register low
  CCU6_T12PRH    =  0xFF;        // load CCU6 T12 period register lhigh

  ///  -----------------------------------------------------------------------
  ///  Configuration of CCU6 Timer 13:
  ///  -----------------------------------------------------------------------
  ///  - prescaler factor is 1
  ///  - timer 13 run bit is reset
  ///  - trigger control is disabled
  ///  - single shot mode is disabled
  ///  - interrupt on period match is disabled
  ///  - interrupt on compare match is disabled

  CCU6_T13PRL    =  0x01;        // load CCU6 T13 period register low
  CCU6_T13PRH    =  0x00;        // load CCU6 T13 period register high

  ///  -----------------------------------------------------------------------
  ///  Configuration of Dead-Time Control Register for Timer T12
  ///  -----------------------------------------------------------------------

  CCU6_T12DTCL   =  0x38;        // load CCU6 dead time control register low 
                                 // for timer T12

  CCU6_T12DTCH   =  0x07;        // load CCU6 dead time control register high 
                                 // for timer T12

  SFR_PAGE(_cc0, noSST);         // switch to page 0

  ///  -----------------------------------------------------------------------
  ///  Configuration of CCU6 Channel 0:
  ///  -----------------------------------------------------------------------
  ///  - compare mode 3 is selected
  ///  - T12 modulation for output CC60 is enabled
  ///  - T13 modulation for output CC60 is disabled
  ///  - the trap functionality of the pin CC60 is disabled
  ///  - the compare output CC60 drives passive level while CC60ST is '0'
  ///  - the passive level of the output CC60 is '1'
  ///  - T12 modulation for output COUT60 is enabled
  ///  - T13 modulation for output COUT60 is disabled
  ///  - the trap functionality of the pin COUT60 is disabled
  ///  - the compare output COUT60 drives passive level while CC60ST is '1'
  ///  - the passive level of the output COUT60 is '1'
  ///  - dead time generation is enabled

  ///  - generation interrupt on flag ICC60R is disabled
  ///  - generation interrupt on flag ICC60F is disabled

  CCU6_CC60SRL   =  0x00;        // load CCU6 capture/compare shadow register 
                                 // low for channel 0
  CCU6_CC60SRH   =  0xC0;        // load CCU6 capture/compare shadow register 
                                 // high for channel 0


  ///  -----------------------------------------------------------------------
  ///  Configuration of CCU6 Channel 1:
  ///  -----------------------------------------------------------------------
  ///  - compare mode 3 is selected
  ///  - T12 modulation for output CC61 is enabled
  ///  - T13 modulation for output CC61 is disabled
  ///  - the trap functionality of the pin CC61 is disabled
  ///  - the compare output CC61 drives passive level while CC61ST is '0'
  ///  - the passive level of the output CC61 is '1'
  ///  - T12 modulation for output COUT61 is enabled
  ///  - T13 modulation for output COUT61 is disabled
  ///  - the trap functionality of the pin COUT61 is disabled
  ///  - the compare output COUT61 drives passive level while CC61ST is '1'
  ///  - the passive level of the output COUT61 is '1'

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -