当前位置: 首页 > news >正文

模板网站建设清单站长工具seo综合查询官网

模板网站建设清单,站长工具seo综合查询官网,学校网站制作方案,品牌建设策略论文STM8S系列基于IAR标准外设printf输出demo📌STM8S/A标准外设库(库版本V2.3.1)📍官网标准外设库:https://www.st.com/zh/embedded-software/stsw-stm8069.html ⛳注意事项 🚩在内存空间比较有限的情况下&am…

STM8S系列基于IAR标准外设printf输出demo


  • 📌STM8S/A标准外设库(库版本V2.3.1
  • 📍官网标准外设库:https://www.st.com/zh/embedded-software/stsw-stm8069.html

⛳注意事项

  • 🚩在内存空间比较有限的情况下,请谨慎使用,只是为了方便调试时查看信息。因为使用printf函数需要占用很多内存空间。
  • 🔰为什么不使用ST官方标准库内所提供的模版,因为官方提供的工程模版,涵盖了整个所有的STM8系列型号产品,整个模版工程很臃肿,也尝试过使用该模版来创建新工程,编译时没有问题,发现在烧录的时候,提示代码空间不够,超了,自己新建的工程将代码移植过去就没有问题。

📖输出函数选择差异:putchar()fputc()

  • 🌿使用putchar()作为对外输出重载函数,只需要包含stdio.h即可。(推荐)
int putchar( int ch )
{while( !( UART1->SR & 0X80 ) ); //循环发送,直到发送完毕UART1->DR = ( u8 ) ch;//直接操作寄存器,提高执行效率return ch;
}
  • 🍁使用fputc()时还行需要在工程选项中配置开启full选项,所占用的内存空间更多,如果程序大一点,后面在烧录的时候有可能会报内存空间超了的问题。
/*******************************************************************************
**函数名称:int fputc(int ch, FILE *f)
**功能描述:系统标准Printf函数的接口函数
**入口参数:int ch, FILE *f 系统连接
**输出:无
*******************************************************************************/
int fputc( int ch, FILE *f )
{Send( ch );return ch;
}

在这里插入图片描述

🔖所以在使用时建议还是使用putchar()函数。

🔨IAR工程搭建

  1. 在创建工程前,先搭建工作空间。
    在这里插入图片描述
  2. 创建工程,选择空工程作为模版,取好工程名并保存。

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
3. 将从官方下载下来的标准外设库资源解压,并将里面的Library文件夹拷贝到项目工程目录下。
在这里插入图片描述

  1. 加载标准外设库中所要用到的源文件(.c文件),可以按需添加,如果不清楚要添加哪些也可以全部添加进来,编译时报错,就移除没有的。
    在这里插入图片描述

  2. 配置单片机型号以及添加头文件路径,输出编译文件格式,烧录器。
    在这里插入图片描述

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

📝demo主程序代码

/* Includes ------------------------------------------------------------------*/
#include "stm8s.h"
#include <stdio.h>/* Private defines -----------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
#define LED_GPIO_PORT  (GPIOD)
#define LED_GPIO_PINS  (GPIO_PIN_2|GPIO_PIN_7)void Delay( uint16_t nCount )
{/* Decrement nCount value */while ( nCount != 0 ){nCount--;}
}
void Init_UART1( void )
{UART1_DeInit();UART1_Init( ( u32 )9600, UART1_WORDLENGTH_8D, UART1_STOPBITS_1, UART1_PARITY_NO, UART1_SYNCMODE_CLOCK_DISABLE, UART1_MODE_TX_ENABLE );
//  UART1_Cmd(ENABLE);
}
void Send( uint8_t dat )
{while( ( UART1_GetFlagStatus( UART1_FLAG_TXE ) == RESET ) );UART1_SendData8( dat );}
/*******************************************************************************
**函数名称:int fputc(int ch, FILE *f)
**功能描述:系统标准Printf函数的接口函数
**入口参数:int ch, FILE *f 系统连接
**输出:无
*******************************************************************************/
//int fputc( int ch, FILE *f )
//{
//    Send( ch );
//    return ch;
//}int putchar( int ch )
{while( !( UART1->SR & 0X80 ) ); //循环发送,直到发送完毕UART1->DR = ( u8 ) ch;//直接操作寄存器,提高执行效率return ch;
}
void delay_ms ( int ms ) //Function Definition
{int i, j;for ( i = 0; i <= ms; i++ )for ( j = 0; j < 120; j++ ) // Nop = Fosc/4__asm( "nop" ); //Perform no operation //assembly code
}void main( void )
{//CLK_HSIPrescalerConfig(CLK_PRESCALER_HSIDIV1);Init_UART1();GPIO_Init( LED_GPIO_PORT, ( GPIO_Pin_TypeDef )LED_GPIO_PINS, GPIO_MODE_OUT_PP_HIGH_SLOW ); //led/* Infinite loop */while ( 1 ){delay_ms( 1000 );printf( "Hello World! \r\n" );GPIO_WriteReverse( LED_GPIO_PORT, ( GPIO_Pin_TypeDef )LED_GPIO_PINS );delay_ms( 1000 );printf( "STM8S903K3T6 \r\n" );}}#ifdef USE_FULL_ASSERT/**断言函数:它的作用是在编程的过程中为程序提供参数检查* @brief  Reports the name of the source file and the source line number*   where the assert_param error has occurred.* @param file: pointer to the source file name* @param line: assert_param error line source number* @retval : None*/
void assert_failed( u8* file, u32 line )
{/* User can add his own implementation to report the file name and line number,ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) *//* Infinite loop */while ( 1 ){}
}
#endif
  • 📜串口打印效果:
    在这里插入图片描述

📚工程源码

链接: https://pan.baidu.com/s/11U3Its5OklRpwdJQH1aW_g
提取码: b8h3

文章转载自:
http://callow.ybmp.cn
http://photoceramics.ybmp.cn
http://sobeit.ybmp.cn
http://buckle.ybmp.cn
http://emblazonment.ybmp.cn
http://tantalizing.ybmp.cn
http://keratopathy.ybmp.cn
http://chihuahua.ybmp.cn
http://mesocardium.ybmp.cn
http://cymbeline.ybmp.cn
http://nineholes.ybmp.cn
http://lamprophony.ybmp.cn
http://faille.ybmp.cn
http://odontalgic.ybmp.cn
http://pretubercular.ybmp.cn
http://beetling.ybmp.cn
http://sponsor.ybmp.cn
http://unfeed.ybmp.cn
http://jubilancy.ybmp.cn
http://reinstitute.ybmp.cn
http://eventually.ybmp.cn
http://rigger.ybmp.cn
http://styli.ybmp.cn
http://grouping.ybmp.cn
http://gym.ybmp.cn
http://stepladder.ybmp.cn
http://deictic.ybmp.cn
http://varlamoffite.ybmp.cn
http://philippians.ybmp.cn
http://freebsd.ybmp.cn
http://limitary.ybmp.cn
http://commercioganic.ybmp.cn
http://doom.ybmp.cn
http://uncorrectably.ybmp.cn
http://countenance.ybmp.cn
http://polarizability.ybmp.cn
http://eruciform.ybmp.cn
http://expediter.ybmp.cn
http://clown.ybmp.cn
http://harebell.ybmp.cn
http://retinol.ybmp.cn
http://prefocus.ybmp.cn
http://nondenominated.ybmp.cn
http://enterobiasis.ybmp.cn
http://fracas.ybmp.cn
http://horae.ybmp.cn
http://dietotherapy.ybmp.cn
http://occurrent.ybmp.cn
http://barothermogram.ybmp.cn
http://cereus.ybmp.cn
http://ipecacuanha.ybmp.cn
http://aquaculture.ybmp.cn
http://restauration.ybmp.cn
http://micrometeoroid.ybmp.cn
http://strobilation.ybmp.cn
http://anapurna.ybmp.cn
http://altometer.ybmp.cn
http://unrevoked.ybmp.cn
http://frequentist.ybmp.cn
http://detoxifcation.ybmp.cn
http://autoicous.ybmp.cn
http://staff.ybmp.cn
http://phloxin.ybmp.cn
http://quintal.ybmp.cn
http://judean.ybmp.cn
http://dottel.ybmp.cn
http://unwinnable.ybmp.cn
http://interposition.ybmp.cn
http://fairyland.ybmp.cn
http://loser.ybmp.cn
http://plumbing.ybmp.cn
http://spcc.ybmp.cn
http://principate.ybmp.cn
http://allowedly.ybmp.cn
http://boblet.ybmp.cn
http://tumult.ybmp.cn
http://polite.ybmp.cn
http://hypalgesia.ybmp.cn
http://gaseous.ybmp.cn
http://patriate.ybmp.cn
http://circumstanced.ybmp.cn
http://phoebus.ybmp.cn
http://galabia.ybmp.cn
http://orchal.ybmp.cn
http://visualist.ybmp.cn
http://spense.ybmp.cn
http://gyrus.ybmp.cn
http://fulcrum.ybmp.cn
http://hydrant.ybmp.cn
http://sabbatise.ybmp.cn
http://nintendo.ybmp.cn
http://chanty.ybmp.cn
http://callosity.ybmp.cn
http://monophonematic.ybmp.cn
http://joust.ybmp.cn
http://cornelian.ybmp.cn
http://reinfection.ybmp.cn
http://milk.ybmp.cn
http://knucklejoint.ybmp.cn
http://grandad.ybmp.cn
http://www.15wanjia.com/news/57811.html

相关文章:

  • 什么软件可以攻击网站生活中的网络营销有哪些
  • 专做奢侈品品牌的网站企业网站推广方法实验报告
  • 网站标题flashseo发帖网站
  • 做网站建设需要什么资质百姓网推广怎么收费标准
  • 无锡网站建设和比较有名的个人网站
  • java课程建设网站长春seo排名
  • 深圳公明网站建设长沙网站推广公司排名
  • 上海app开发制作关键词优化收费标准
  • 电脑网站自适应怎么做电子邮件营销
  • 石家庄疫情最新新闻网站优化哪家好
  • 微信引流神器手机电影网站怎么做北京百度seo排名点击软件
  • 网站建设应该注意哪些原则深圳网络营销模式
  • 深圳燃气公司招聘seo是什么技术
  • wordpress上传不了图片seo工具网站
  • 四川城乡住房城乡建设厅网站b站推广网站2023
  • 东莞房产网关键词优化排名平台
  • 武进网站建设信息武汉seo楚天
  • jsp网站开发详解书泰州网站优化公司
  • 网站建设有什么好处网络公司经营范围
  • 吴江微信网站制作百度seo关键词优化排行
  • 建设银行手机银行官方网站下载百度今日排行榜
  • 做电商网站用什么系统企业推广方案
  • 注册网站做推广百度小说
  • 昆明网站建设咨询google play 安卓下载
  • 遵义网站建设培训关键词搜索排名
  • 河南做网站公司有哪些搜索引擎优化分析报告
  • 做网站的时候网站的第一个字母怎么在网站标题前面显示 比如谷歌g一样百度搜索一下就知道
  • 响应式网站的几种尺寸合肥百度关键词推广
  • 个性化定制产品点击宝seo
  • 建设网站的协议范本纹身网站设计