程序#include<reg52.h>#define uchar unsigned char
sbit x1=P0^0;
sbit x2=P0^1;
sbit x3=P0^2;
sbit x4=P0^3;
sbit y1=P2^4;
sbit y2=P2^5;
sbit y3=P2^6;
sbit y4=P2^7;
void delay2ms()
{
uchar i;
TMOD=0x10;
for(i=0;i<8;i++)
{ TH1=256-250;
TL1=256-250;
TR1=1;
while(!TF1)
TF1=0;
}
}
void main()
{
x1=0x04;
y1=0xaf;
delay2ms();
x2=0x0f;
y2=0x1f;
delay2ms();
x3=0x04;
y3=0xaf;
delay2ms();
x4=0x0b;
y4=0xaf;
delay2ms();
仿真图
-
仿真图
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
#define uchar unsigned char
sbit x=P0;
sbit y=P2;
void delay2ms()
{
uchar i;
TMOD=0x10;
for(i=0;i<8;i++)
{ TH1=256-250;
TL1=256-250;
TR1=1;
while(!TF1)
TF1=0;
}
}
void main()
{
x=0x00;
y=0xff;
x=0x04;
y=0xaf;
delay2ms();
x=0x0f;
y=0x1f;
delay2ms();
x=0x04;
y=0xaf;
delay2ms();
x=0x0b;
y=0xaf;
delay2ms();
}
仿真图
呵呵,不好意思,我刚在学习,具体怎么赋值呢
一周热门 更多>