//****************************************************************************
// @Module Capture / Compare Unit 6 (CCU6)
// @Filename CCU6.C
// @Project CCU6.dav
//----------------------------------------------------------------------------
// @Controller Infineon XC164CS-16F20
//
// @Compiler Keil
//
// @Codegenerator 2.8
//
// @Description This file contains functions that use the CCU6 module.
//
//----------------------------------------------------------------------------
// @Date 2007-5-25 16:24:15
//
//****************************************************************************
// 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 CCU6_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 its reset state.
//
//----------------------------------------------------------------------------
// @Returnvalue None
//
//----------------------------------------------------------------------------
// @Parameters None
//
//----------------------------------------------------------------------------
// @Date 2007-5-25
//
//****************************************************************************
// USER CODE BEGIN (Init,1)
// USER CODE END
void CCU6_vInit(void)
{
// USER CODE BEGIN (Init,2)
// USER CODE END
/// -----------------------------------------------------------------------
/// 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 enabled
/// - interrupt on one match is enabled
CCU6_T12PR = 0x07CF; // load CCU6 T12 period register
/// -----------------------------------------------------------------------
/// Configuration of CCU6 Timer 13:
/// -----------------------------------------------------------------------
/// - prescaler factor is 1
/// - timer 13 run bit is set
/// - single shot mode is disabled
/// - interrupt on period match is disabled
/// - interrupt on compare match is disabled
CCU6_T13PR = 0x0F9F; // load CCU6 T13 period register
CCU6_TCTR0 = 0x0080; // load CCU6 timer control register 0
CCU6_TCTR2 = 0x0020; // load CCU6 timer control register 2
/// -----------------------------------------------------------------------
/// Configuration of Multi Channel Mode:
/// -----------------------------------------------------------------------
/// - multi channel mode is disabled
/// -----------------------------------------------------------------------
/// 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 '0'
/// - 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 '0'
/// - dead time generation is enabled
/// - generation interrupt on flag ICC60R is disabled
/// - generation interrupt on flag ICC60F is disabled
CCU6_CC60SR = 0x03E8; // load CCU6 capture/compare shadow register
// 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 '0'
/// - 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 '0'
/// - dead time generation is enabled
/// - generation interrupt on flag ICC61R is disabled
/// - generation interrupt on flag ICC61F is disabled
CCU6_CC61SR = 0x03E8; // load CCU6 capture/compare shadow register
// for channel 1
/// -----------------------------------------------------------------------
/// Configuration of CCU6 Channel 2:
/// -----------------------------------------------------------------------
/// - compare mode 3 is selected
/// - T12 modulation for output CC62 is enabled
/// - T13 modulation for output CC62 is disabled
/// - the trap functionality of the pin CC62 is disabled
/// - the compare output CC62 drives passive level while CC62ST is '0'
/// - the passive level of the output CC62 is '0'
/// - T12 modulation for output COUT62 is enabled
/// - T13 modulation for output COUT62 is disabled
/// - the trap functionality of the pin COUT62 is disabled
//