当前位置:首页 > 技术心得 > 正文内容

IAR STM8嵌入汇编

xjtudll10年前 (2017-04-17)技术心得13930

IAR嵌入汇编:使用asm或者__asm,推荐使用__asm。

void delay_n_nop(uint8 N)

{

// 用C语言的话 会跟编译器的优化有关

/*

    uint8 i;

    for (i=N; i>0; i--);       

*/

    asm(

        "delay_n_nop:\n"       

        "        ADD       A, #0xff\n"             // 1个周期

        "delay_n_nop_0:\n"

        "        TNZ       A\n"                    // 1个周期

        "        JRNE      L:delay_n_nop\n"        // 2个周期

    );    

}

clip_image001

扫描二维码推送至手机访问。

版权声明:本文由鸟的天空发布,如需转载请注明出处。

本文链接:http://www.xjtudll.cn/Exp/450/

标签: IARSTM8
分享给朋友:

“IAR STM8嵌入汇编” 的相关文章

Android Studio: This version of the rendering library is more recent than your version of Android Studio

Android Studio: This version of the rendering library is more recent than your version of Android Studio

Android Studio预览xml布局时,提示: This version of the rendering library is more recent than your version of Android Studio. Please update Android Studio 如图所示...

IAR Error: Unknown or ambiguous symbol. main解决

IAR Error: Unknown or ambiguous symbol. main解决

网上下载了一个程序(含工程),打开一debug,提示:“Error (col 1): Unknown or ambiguous symbol. main”。经查:设置里没有生成debug information 解决办法: Project->C/C++Compiler-...

SQL去掉小数点有效数字后的所有0

第一种方法 select cast(2.5000000000000   as  real) select cast(2   as  real) select cast(2.00000   as  r...

Proteus电源设置

Proteus电源设置

Proteus中,默认电源为VCC=5V,GND=0,当我们要使用其它电压值时该怎么办?例如3.3V,-5V,15V等等,没关系,有专门的菜单可以设置,跟我学:菜单: 新增加: 注意Name可以随意和Voltage值才是电压值 比如系统默认VEE=-5V ...

android实现状态栏添加图标的函数

android实现状态栏添加图标的函数,具体如下: private void showNotification() { // 创建一个NotificationManager的引用 NotificationManager notificationManager = (NotificationM...

解决android studio弹出

解决android studio弹出"waiting for debugger"

方式一: 这种方法可能需要配置环境变量 win+R -> cmd -> adb kill-server,adb start-server 方式二: 当点击debug app时(卡在"waiting for debug"),则如图点击,然后点击确定即可! 本文为转载...

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。