找回密码
 立即注册
查看: 161|回复: 0

Ai8051U创新风格库函数学习打卡

[复制链接]
  • 打卡等级:偶尔看看I
  • 打卡总天数:17
  • 最近打卡:2025-06-16 17:24:53

14

主题

159

回帖

1665

积分

版主

积分
1665
发表于 2025-2-12 16:47:17 | 显示全部楼层 |阅读模式
原贴链接https://www.stcaimcu.com/forum.p ... mp;extra=#pid138723
打卡第一集:第一集 I/O口模式和传统的外部中断
(1)编译图片:
e90161c3df3bc4a65afc804e52453af.png
(2)代码如下:

#include <AI8051U.H>
#include "set_int.h"
#include "set_io.h"
#include "intrins.h"

void Delay1us(void)        //@24.000MHz
{
        unsigned long edata i;

        _nop_();
        _nop_();
        _nop_();
        i = 4UL;
        while (i) i--;
}

void  main(void)
{
        EAXFR = 1;
        CKCON = 0;
        WTST = 0;
        set_io_mode(pu_mode, Pin40, Pin00, Pin01, Pin02, Pin03,Pin_End);
        P40=0;
        set_io_mode(hz_mode, Pin32, Pin33,Pin34,Pin35, Pin_End);              
        set_io_mode(en_pur, Pin32,Pin33,Pin34,Pin35, Pin_End);
        Delay1ms( );
        set_int_mode(falling_edge_mode,Int0,Int1,Int_End);
        
        
        EA = 1;
        while(1)
        {
               
                if(get_int_state(INT0))
                {
                 
                        P00 = ~P00;
                }
                if(get_int_state(INT1))
                {
                 
                        P01 = ~P01;
                }
                P02 = P34;
                P03 = P35;
        }
}
回复

使用道具 举报 送花

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|深圳国芯人工智能有限公司 ( 粤ICP备2022108929号-2 )

GMT+8, 2025-6-19 02:16 , Processed in 0.253397 second(s), 49 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表