|
#include<reg52.h>
#include<intrins.h>
sbit se = P2 ^ 5;
sbit sc = P2 ^ 4;
sbit rc = P2 ^ 6;
int dat1,dat2;
void ledsend(int);
void main()
{
while(1)
{
P1 = 0x80;
ledsend(0xfe);//列是低電平有效行是高電平有效
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
// P1 = 0xfe;
}
}
void ledsend(int dat1)
{
int a;
sc = 1;
rc = 1;
for(a = 0;a < 8;a ++)
{
se = dat1 >> 7;
dat1 <<= 1;
sc = 0;
_nop_();
_nop_();
sc = 1;
//_nop_();
}
rc = 0;
_nop_();
_nop_();
rc = 1;
_nop_();
_nop_();
}
|
評分
-
查看全部評分
|