📄 adc.h
字号:
//****************************************************************************
// @Module Analog / Digital Converter (ADC)
// @Filename ADC.H
// @Project 164.dav
//----------------------------------------------------------------------------
// @Controller Infineon XC164CM-4F40
//
// @Compiler Keil
//
// @Codegenerator 1.1
//
// @Description This file contains all function prototypes and macros for
// the ADC module.
//
//----------------------------------------------------------------------------
// @Date 2007-5-4 22:13:47
//
//****************************************************************************
// USER CODE BEGIN (ADC_Header,1)
// USER CODE END
#ifndef _ADC_H_
#define _ADC_H_
//****************************************************************************
// @Project Includes
//****************************************************************************
// USER CODE BEGIN (ADC_Header,2)
// USER CODE END
//****************************************************************************
// @Macros
//****************************************************************************
// USER CODE BEGIN (ADC_Header,3)
// USER CODE END
//****************************************************************************
// @Defines
//****************************************************************************
// This parameter identifies ADC fixed channel single conversion mode
#define ADC_FIXED 0
// This parameter identifies ADC fixed channel continuous conversion mode
#define ADC_FIXED_CONTI 1
// This parameter identifies ADC auto scan single conversion mode
#define ADC_SCAN 2
// This parameter identifies ADC auto scan continuous conversion mode
#define ADC_SCAN_CONTI 3
// This parameter identifies ADC analog channel 0
#define ADC_ANA_0 0
// This parameter identifies ADC analog channel 1
#define ADC_ANA_1 1
// This parameter identifies ADC analog channel 2
#define ADC_ANA_2 2
// This parameter identifies ADC analog channel 3
#define ADC_ANA_3 3
// This parameter identifies ADC analog channel 4
#define ADC_ANA_4 4
// This parameter identifies ADC analog channel 5
#define ADC_ANA_5 5
// This parameter identifies ADC analog channel 6
#define ADC_ANA_6 6
// This parameter identifies ADC analog channel 7
#define ADC_ANA_7 7
// This parameter identifies ADC analog channel 10
#define ADC_ANA_10 10
// This parameter identifies ADC analog channel 11
#define ADC_ANA_11 11
// This parameter identifies ADC analog channel 12
#define ADC_ANA_12 12
// This parameter identifies ADC analog channel 13
#define ADC_ANA_13 13
// This parameter identifies ADC analog channel 14
#define ADC_ANA_14 14
// This parameter identifies ADC analog channel 15
#define ADC_ANA_15 15
// USER CODE BEGIN (ADC_Header,4)
// USER CODE END
//****************************************************************************
// @Typedefs
//****************************************************************************
// USER CODE BEGIN (ADC_Header,5)
// USER CODE END
//****************************************************************************
// @Imported Global Variables
//****************************************************************************
// USER CODE BEGIN (ADC_Header,6)
// USER CODE END
//****************************************************************************
// @Global Variables
//****************************************************************************
// USER CODE BEGIN (ADC_Header,7)
// USER CODE END
//****************************************************************************
// @Prototypes Of Global Functions
//****************************************************************************
void ADC_vInit(void);
void ADC_vConfConv(ubyte ubMode, ubyte ubChannel);
uword ADC_uwReadConv(void);
// USER CODE BEGIN (ADC_Header,8)
// USER CODE END
//****************************************************************************
// @Macro ADC_vStartConv()
//
//----------------------------------------------------------------------------
// @Description This macro starts the A/D conversion.
//
//----------------------------------------------------------------------------
// @Returnvalue None
//
//----------------------------------------------------------------------------
// @Parameters None
//
//----------------------------------------------------------------------------
// @Date 2007-5-4
//
//****************************************************************************
#define ADC_vStartConv() ADC_CTR0_ADST = 1
//****************************************************************************
// @Macro ADC_vStopConv()
//
//----------------------------------------------------------------------------
// @Description This macro stops a continuous A/D conversion. The last
// conversion or sequence is terminated correctly.
//
//----------------------------------------------------------------------------
// @Returnvalue None
//
//----------------------------------------------------------------------------
// @Parameters None
//
//----------------------------------------------------------------------------
// @Date 2007-5-4
//
//****************************************************************************
#define ADC_vStopConv() ADC_CTR0_ADST = 0
//****************************************************************************
// @Macro ADC_ubConvReady()
//
//----------------------------------------------------------------------------
// @Description This macro detects the end of a conversion (ADC_CIC_IR). If
// the conversion is completed, the ADC_DAT register can be
// read with the function ADC_uwReadConv().
//
//----------------------------------------------------------------------------
// @Returnvalue 1 if conversion is completed, else 0
//
//----------------------------------------------------------------------------
// @Parameters None
//
//----------------------------------------------------------------------------
// @Date 2007-5-4
//
//****************************************************************************
#define ADC_ubConvReady() ADC_CIC_IR
//****************************************************************************
// @Macro ADC_ubBusy()
//
//----------------------------------------------------------------------------
// @Description This macro checks if an A/D conversion is active or not.
// If a task has to wait for the result of an A/D conversion
// (result is read in the ISR), it can find with this macro,
// when the ADC is ready.
//
//----------------------------------------------------------------------------
// @Returnvalue Returns a 1 if A/D converter is active, else 0
//
//----------------------------------------------------------------------------
// @Parameters None
//
//----------------------------------------------------------------------------
// @Date 2007-5-4
//
//****************************************************************************
#define ADC_ubBusy() ADC_CTR0_ADBSY
//****************************************************************************
// @Macro ADC_vCalibration(CALOFF)
//
//----------------------------------------------------------------------------
// @Description This macro enables/disables post calibration.
//
//----------------------------------------------------------------------------
// @Returnvalue None
//
//----------------------------------------------------------------------------
// @Parameters CALOFF:
// 1 - Calibration is disabled (off). 0 - Calibration is
// executed
//
//----------------------------------------------------------------------------
// @Date 2007-5-4
//
//****************************************************************************
#define ADC_vCalibration(CALOFF) ADC_CTR0_CALOFF = CALOFF
//****************************************************************************
// @Interrupt Vectors
//****************************************************************************
// USER CODE BEGIN (ADC_Header,8)
void ADC_vConfConvSingleMode(ubyte ubChannel);
void ADC_uwReadConvtest(void);
// USER CODE END
#endif // ifndef _ADC_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -