STM8学习笔记1

一、ADC1、ADC2、CAN、等变量提示

Error[Pe020]: identifier "ADC1" is undefined C:\Users\Administrator\Desktop\1-STM8S_Demo\1-STM8S_Demo\FWlib\src\stm8s_adc1.c 50 

问题出现在stm8s.h文件中,下面这处根据实际情况改。 
/* Uncomment the line below according to the target STM8S or STM8A device used in your 
   application. */ 

 /* #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 */ 

二、使用库文件中的CAN,ADC1(2),等功能是注意哪些型号的STM8是不带此功能的,如STM8S103系列不带CAN,调用CAN的时候回提示以上错误信息。详情参照一下两文件库:

STM8S.h

STM8S.conf.h

/**
  ******************************************************************************
  * @file     stm8s_conf.h
  * @author   MCD Application Team
  * @version  V2.0.0
  * @date     25-February-2011
  * @brief    This file is used to configure the Library.
  ******************************************************************************
  * @attention
  *
  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  *
  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
  ******************************************************************************
  */ 


/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM8S_CONF_H
#define __STM8S_CONF_H


/* Includes ------------------------------------------------------------------*/
#include "stm8s.h"


/* Uncomment the line below to enable peripheral header file inclusion */
#if defined(STM8S105) || defined(STM8S103) || defined(STM8S903) || defined (STM8AF626x)
#include "stm8s_adc1.h" 
#endif /* (STM8S105) ||(STM8S103) || (STM8S903) || STM8AF626x*/
#if defined(STM8S208) || defined(STM8S207) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
 /*#include "stm8s_adc2.h"*/
#endif /* (STM8S208) || (STM8S207) || (STM8AF62Ax) || (STM8AF52Ax) */
/*#include "stm8s_awu.h"*/
/*#include "stm8s_beep.h"*/
#if defined (STM8S208) || defined (STM8AF52Ax)
#include "stm8s_can.h"
#endif /* STM8S208 || STM8AF52Ax */
#include "stm8s_clk.h"
/*#include "stm8s_exti.h"*/
/*#include "stm8s_flash.h"*/
#include "stm8s_gpio.h"
/*#include "stm8s_i2c.h"*/
/*#include "stm8s_itc.h"*/
/*#include "stm8s_iwdg.h"*/
/*#include "stm8s_rst.h"*/
/*#include "stm8s_spi.h"*/
/*#include "stm8s_tim1.h"*/
#ifndef STM8S903
 /*#include "stm8s_tim2.h"*/
#endif /* STM8S903 */
#if defined(STM8S208) || defined(STM8S207) ||defined(STM8S105) || defined (STM8AF52Ax) ||\
    defined (STM8AF62Ax) || defined (STM8AF626x)
 /*#include "stm8s_tim3.h"*/
#endif /* (STM8S208) ||defined(STM8S207) ||defined(STM8S105) */ 
#ifndef STM8S903
 /*#include "stm8s_tim4.h"*/
#endif /* STM8S903 */
#ifdef STM8S903
 #include "stm8s_tim5.h"
 #include "stm8s_tim6.h"
#endif /* STM8S903 */
#if defined(STM8S208) ||defined(STM8S207) ||defined(STM8S103) ||defined(STM8S903) ||\
    defined (STM8AF52Ax) || defined (STM8AF62Ax)
 /*#include "stm8s_uart1.h"*/
#endif /* STM8S208 || STM8S207 || STM8S103 ||STM8S903 || STM8AF52Ax || STM8AF62Ax */
#if defined (STM8S105) || defined (STM8AF626x)
 #include "stm8s_uart2.h"
#endif /* STM8S105 || STM8AF626x */
#if defined(STM8S208) ||defined(STM8S207) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
/* #include "stm8s_uart3.h"*/
#endif /* STM8S208 || STM8S207 || STM8AF52Ax || STM8AF62Ax */ 
/*#include "stm8s_wwdg.h"*/


/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Uncomment the line below to expanse the "assert_param" macro in the
   Standard Peripheral Library drivers code */
#define xUSE_FULL_ASSERT    (1) 


/* Exported macro ------------------------------------------------------------*/
#ifdef  USE_FULL_ASSERT


/**
  * @brief  The assert_param macro is used for function's parameters check.
  * @param expr: If expr is false, it calls assert_failed function
  *   which reports the name of the source file and the source
  *   line number of the call that failed.
  *   If expr is true, it returns no value.
  * @retval : None
  */
#define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__))
/* Exported functions ------------------------------------------------------- */
void assert_failed(uint8_t* file, uint32_t line);
#else
#define assert_param(expr) ((void)0)
#endif /* USE_FULL_ASSERT */


#endif /* __STM8S_CONF_H */


/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值