欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

 找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開始

搜索
查看: 5731|回復(fù): 0
打印 上一主題 下一主題
收起左側(cè)

stm8s stm8s.h stm8s_conf.h頭文件的使用

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:610433 發(fā)表于 2019-9-30 13:49 | 只看該作者 回帖獎(jiǎng)勵(lì) |倒序?yàn)g覽 |閱讀模式
在使用IAR for stm8編程的時(shí)候,會(huì)使用到stm8s.h的頭文件。

官網(wǎng)下載的庫函數(shù)直接用需要在main.c最后加上這么一段代碼,才可以編譯通過

#ifdef USE_FULL_ASSERT
void assert_failed(u8* file, u32 line)
{
  while (1)
  {
  }
}
#endif


stm8.h頭文件中最開始會(huì)有這么一段


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


你可以針對(duì)自己的型號(hào)將前面的/*去除,另一種方法是不需要自己去除,options->c/c++ compiler->Preprocessor中的defined symbols中加入對(duì)應(yīng)的型號(hào),如STM8AF62Ax
如若不然,會(huì)跳出錯(cuò)誤,因?yàn)閔文件中有這一段,未預(yù)定義則會(huì)報(bào)錯(cuò)

#if !defined (STM8S208) && !defined (STM8S207) && !defined (STM8S105) && \
    !defined (STM8S103) && !defined (STM8S903) && !defined (STM8AF52Ax) && \
    !defined (STM8AF62Ax) && !defined (STM8AF626x) && !defined (STM8S007) && \
    !defined (STM8S003)&& !defined (STM8S005)
#error "Please select first the target STM8S/A device used in your application (in stm8s.h file)"
#endif


stm8s_conf.h文件是包含了各個(gè)型號(hào)可用的外設(shè),如

#if defined(STM8S208) ||defined(STM8S207) || defined(STM8S007) ||defined(STM8S103) ||\
    defined(STM8S003) || defined(STM8S903) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
#include "stm8s_uart1.h"
#endif /* STM8S208 || STM8S207 || STM8S103 ||STM8S903 || STM8AF52Ax || STM8AF62Ax */


可見62ax有uart1 但是62a6并沒有uart1只有uart3 沒有看到哪里有具體說明小型號(hào)對(duì)應(yīng)的編號(hào) 可以自己嘗試調(diào)試

評(píng)分

參與人數(shù) 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎(jiǎng)勵(lì)!

查看全部評(píng)分

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表