📄 ad_cnf.h
字号:
/*******************************************************************
* ADC *
* *
* by J.Schwedes 2009 *
********************************************************************/
#ifndef AD_CNF_H
#define AD_CNF_H
/* AD converter options */
/* NOTE: not all features are supported by different Atmel devices */
/* Atoscan mode */
#define AD_USE_AUTOSCAN
/* AD injection */
// #define AD_USE_INJECTION coming soon
/* ADC clock presacaler */
/* define prescaler < 200kHz for 10-bit resolution */
#define AD_PRE_2 1
#define AD_PRE_4 2
#define AD_PRE_8 3
#define AD_PRE_16 4
/* only for some Megas */
#define AD_PRE_32 5
#define AD_PRE_64 6
#define AD_PRE_128 7
#define AD_CLOCK_PRESCALER AD_PRE_64 /* at CPU clock 8Mhz, AD clock is 125kHz */
/* define AD resolution */
#define AD_10BIT 0
#define AD_8BIT 1
#define AD_RESOLUTION AD_10BIT
#define AD_AREF_EXTERN_MEGA 0 /* only for Mega8/16/48/88/168 */
#define AD_AREF_VCC 0 /* only for Tiny25/45/85 */
#define AD_AREF_AVCC 1 /* only for Mega8/16/48/88/168 */
#define AD_AREF_EXTERN_TINY 1 /* only for Tiny25/45/85 */
#define AD_AREF_INTERNAL_1V1_TINY 2 /* only for Tiny25/45/85 */
#define AD_AREF_INTERNAL_1V1_MEGA 3 /* only for Mega48/88/168 */
#define AD_AREF_INTERNAL_2V56 3 /* only for Mega8/16 Tiny25/45/85 */
#define AD_VOLTAGE_REF AD_AREF_INTERNAL_2V56
/* define AD buffer size and indexes */
#define AD_BUFF_SIZE 8
#define AD_BUFF_IDX_0 0
#define AD_BUFF_IDX_1 1
#define AD_BUFF_IDX_2 2
#define AD_BUFF_IDX_3 3
#define AD_BUFF_IDX_4 4
#define AD_BUFF_IDX_5 5
#define AD_BUFF_IDX_6 6
#define AD_BUFF_IDX_7 7
/* IO definitions */
#define ADC_RESULT_8BIT (u8)(ADC>>8)
#define ADC_RESULT_10BIT ADC
#ifdef __ATmega8__
#define ADCSRA ADCSR /* make IAR defintion compatible to ATmega8 */
#endif
/* compiler options */
#define __AD_ROM __flash /* constants are accessed in flash memory */
/* interface function called from OS preemptive task service */
extern void AD_AutoScan_OS_1ms(void);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -