You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
1.5 KiB
79 lines
1.5 KiB
#ifndef _msp_adc_H_
|
|
#define _msp_adc_H_
|
|
|
|
#include "bsp_config.h"
|
|
#include "msp_uart1.h"
|
|
|
|
#include "debug_drv.h"
|
|
|
|
|
|
#define ADC_POWER BITN7
|
|
#define ADC_START BITN6
|
|
#define ADC_FLAG BITN5
|
|
#define ADC_EPWMT BITN4
|
|
|
|
#define D_ADC_CHS_mask 0xF0
|
|
|
|
#define ADC_CHS3 BITN3
|
|
#define ADC_CHS2 BITN2
|
|
#define ADC_CHS1 BITN1
|
|
#define ADC_CHS0 BITN0
|
|
|
|
#define ADC_RESFMT BITN5
|
|
|
|
#define ADC_SPEED3 BITN3
|
|
#define ADC_SPEED2 BITN2
|
|
#define ADC_SPEED1 BITN1
|
|
#define ADC_SPEED0 BITN0
|
|
|
|
|
|
|
|
#define D_CVTIMESEL_mask 0xF8
|
|
|
|
#define D_CVTIMESEL_1 0
|
|
#define D_CVTIMESEL_2 4
|
|
#define D_CVTIMESEL_4 5
|
|
#define D_CVTIMESEL_8 6
|
|
#define D_CVTIMESEL_16 7
|
|
|
|
|
|
|
|
/****
|
|
CVTIMESEL [2:0] ADC 自动转换次数 0xx 转换 1 次 100 转换 2 次并取平均值 101 转换 4 次并取平均值 110 转换 8 次并取平均值 111 转换 16 次并取平均值
|
|
|
|
|
|
****/
|
|
|
|
|
|
#define D_ADC_average() D_EN_EREG(); BITN_S(ADCEXCFG,D_CVTIMESEL_16,D_CVTIMESEL_mask)////4 22M 1ms---
|
|
|
|
|
|
#define D_ADC_POWER_ON() BITN_1(ADC_CONTR, ADC_POWER)
|
|
#define D_ADC_POWER_OFF() BITN_0(ADC_CONTR, ADC_POWER)
|
|
|
|
#define D_ADC_START() BITN_1(ADC_CONTR, ADC_START)
|
|
#define D_ADC_STOP() BITN_0(ADC_CONTR, ADC_START)
|
|
|
|
#define D_ADC_OVER() BITN_G(ADC_CONTR, ADC_FLAG)
|
|
#define D_ADC_CLEARFLAG() BITN_0(ADC_CONTR, ADC_FLAG)
|
|
|
|
#define D_ADC_CH(X) BITN_S(ADC_CONTR,X,D_ADC_CHS_mask)
|
|
|
|
#define D_ADC_CH_1_19 15
|
|
///#define D_ADC_POWER_OFF()
|
|
|
|
#define D_cmd_filter_adc 0xfa
|
|
U16 L1_ADC_Read(u8 CHA);
|
|
|
|
|
|
void L0_ADC_init (unsigned char onf);
|
|
|
|
|
|
U16 L1_ADC_Readx(u8 CHA);
|
|
|
|
|
|
|
|
#endif //#ifndef _msp_adc_H_
|
|
|
|
|
|
|
|
|