查找开发板资料
由资料可知LED由P1寄存器控制
代码
#include <REGX51.H>
void delay(unsigned int z){
unsigned int x, y;
for (x = z; x > 0; x--){
for (y = 114; y > 0; y--){
}
}
}
void main()
{
while(1)
{
P1_0 = 0;
delay(200);
P1_0 = 1;
P1_1 = 0;
delay(200);
P1_1 = 1;
P1_2 = 0;
delay(200);
P1_2 = 1;
P1_3 = 0;
delay(200);
P1_3 = 1;
P1_4 = 0;
delay(200);
P1_4 = 1;
P1_5 = 0;
delay(200);
P1_5 = 1;
P1_6 = 0;
delay(200);
P1_6 = 1;
P1_7 = 0;
delay(200);
P1_7 = 1;
}
}
效果
https://kdy-oss.oss01-cn-lasa-xzns-d01-a.cloud.ningsuan.com.cn/kodbox/202108/30/vHTVR7T5IPSwg?response-content-disposition=inline%3Bfilename%3D8280a693a8b251f14b1f97b969533b30.mp4&response-content-type=video%2Fmp4&OSSAccessKeyId=FfDrPsUMS4h3sKnf&Expires=1630339199&Signature=ceSPiF4SiXBXWGJxBJ9hD7d9P6k%3D
|