点亮小灯之代码
//点亮单个小灯
#include <reg52.h>
sbit P0_0 = P0 ^ 0;
sbit P1_0 = P1 ^ 0;
sbit P1_1 = P1 ^ 1;
sbit P1_2 = P1 ^ 2;
sbit P1_3 = P1 ^ 3;
sbit P1_4 = P1 ^ 4;
int main(void)
{
P0_0 = 0;
P1_0 = 0;
P1_1 = 1;
P1_2 = 1;
P1_3 = 1;
P1_4 = 0;
while(1)
;
}
//点亮单个小灯
#include <reg52.h>
sbit ADDR0 = P1 ^ 0;
sbit ADDR1 = P1 ^ 1;
sbit ADDR2 = P1 ^ 2;
sbit ADDR3 = P1 ^ 3;
sbit ENLED = P1 ^ 4;
int main(void)
{
ENLED = 0;
ADDR3 = 1;
ADDR2 = 1;
ADDR1 = 1;
ADDR0 = 0;
P0 = 0xFE;
while (1)
;
}
本文来自博客园,作者:EricsT,转载请注明原文链接:https://www.cnblogs.com/EricsT/p/18442783