求求大佬,真不知道为啥功能实现不了

2301_81141171 2025-04-11 19:31:05

#include<reg52.h>
#include<intrins.h>
typedef unsigned int u16;
typedef unsigned char u8;
#define LED_PORT P2
void delay_10us(u16 ten_us)
{
while(ten_us--);
}
void main()
{
u8 i=0;
P1=0xFF;
LED_PORT=~0x01; 
delay_10us(50000);
while(1)
{
bit K=P1^0;
if(K==1)
{
LED_PORT=_cror_(LED_PORT,1);
delay_10us(50000);
}
else
{
LED_PORT=_crol_(LED_PORT,1);
delay_10us(50000);
}
}
}

...全文
1588 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
forever74 04-14
  • 打赏
  • 举报
回复

编译出错么?出啥错?
代码和板子是一致的么?我是说引脚号码。
频率和延时函数是一致的么?要是差十倍,肉眼根本看不出来闪。

  • 打赏
  • 举报
回复

P1^0 这个没用吧~

70,017

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧