AD采样问题
原来的程序是STM8S105里的AD是用ADC1的,现换成STM8S207,资料上显示207的AD是采用ADC2转换器,在项目的StdPeriph_Driver里增加stm8s_adc2.c文件后,进行编译时显示“ADC2”is undefined,很多ADC2的 register都显示没定义,是什么原因呢?如截图所示。
搞定了。是头文件stm8s.h要作更改。如下:
/* #define STM8S208 */ /*!< STM8S High density devices with CAN */
#define STM8S207 /*!< STM8S High density devices without CAN */
/* #define STM8S007 */ /*!< STM8S Value Line High density devices */
/* #define STM8AF52Ax */ /*!< STM8A High density devices with CAN */
/* #define STM8AF62Ax */ /*!< STM8A High density devices without CAN */
/* #define STM8S105 /*!< STM8S Medium density devices */
/* #define STM8S005 */ /*!< STM8S Value Line Medium density devices */
/* #define STM8AF626x */ /*!< STM8A Medium density devices */
/* #define STM8S103*/ /*!< STM8S Low density devices */
/* #define STM8S003 */ /*!< STM8S Value Line Low density devices */
/* #define STM8S903 */ /*!< STM8S Low density devices */
原来是采用用STM8S105,现更改为207 STM8S207的头文件引用没?楼主看一下。 STM8S207的宏定义有了吗?
如果没有,stm8s_adc2.h 就不会被包含进来。
#if defined(STM8S208) || defined(STM8S207) || defined(STM8S007) || defined (STM8AF52Ax) ||\
defined (STM8AF62Ax)
#include "stm8s_adc2.h"
或者手动包含进来也行。
页:
[1]