📄 adc_v1.1.7.h
字号:
/*=============================================================================
// File : ADC_V1.1.h //
// //
// Abstract: This header file containing the required basic datatypes and //
// user defined macros for ADC Operation. //
// Compiler : IAR Embedded Work Bench //
// //
// Author : Kuberappa.M.Sajjan //
// E-mail : kuber@unifiest.com //
// //
// //
=============================================================================*/
/*---------------------------- Preprocessor Directives ----------------------*/
#include "datatypes_V1.1.h"
#include "io430.h"
/*--------------------------- Macros and Constants --------------------------*/
#ifndef _ADC_H_ // If Datatypes header file is not defined then
#define _ADC_H_ // Define the Datatypes header file
typedef struct ADC_DATA
{
ULONG buffer;
UCHAR start_conv;
UCHAR ch_name;
UCHAR ch_enable;
UCHAR cnt;
}ADC_DATA;
typedef struct FLAGS
{
UCHAR flag0:1;
UCHAR flag1:1;
UCHAR flag2:1;
UCHAR flag3:1;
UCHAR flag4:1;
UCHAR flag5:1;
UCHAR flag6:1;
UCHAR flag7:1;
}FLAGS;
/*------------------- User Mcros for ADC ------------------------------------*/
/*------------------- Bits related to ADC Control Register ------------------*/
#define xDIV 0x0000
#define LP 0x0000
#define DIVx 0x0000
#define SSELx 0x0020
#define VMIDON 0x0000
#define REFON 0x0004
#define OVIE 0x0000
/*------------------- Bits related to ADC Control Register 0 ----------------*/
#define UNI 0x1000
#define xOSR 0x0000
#define SNGL 0x0400
#define OSRx 0x0000
#define LSBTOG 0x0000
#define LSBACC 0x0000
#define DF 0x0000
#define IE 0x0008
#define IFG 0x0000
#define SC 0x0002
/*------------------- Bits related to ADC Input Control Register -----------*/
#define DLYx 0x00
#define GAINx 0x38
#define INCH 0x00
/*------------------- Bits Related to Channel Selection Register ------------*/
#define CHANNEL5 0x05
#define CHANNEL0 0x00
#define CH0_ENABLE 0x01
#define CH_ENABLE 0x05
#define COUNT 10
#define CHANNEL2 0x04
#define CH2_ENABLE 0x04
#define CLEAR 0x00
/*--------------------------- Global Variable Declarations ------------------*/
/*-------------------------- Function Prototypes ----------------------------*/
void system_initialisation(void); // The Function prototype of s/m init
void adc_initialisation(void); // Intialisation of ADC
UINT adc_conversion_channel0(UCHAR channel_name,const UCHAR count); // Conv fun
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -