#include <reg51.h>
#include<intrins.h>
#define COLP P1
#define repeat 30
sbit MR=P2^6;
sbit ST=P2^7;
sbit OE=P2^5;
unsigned char code c[8]={0xef,0xfe,0xef,0xfe,0xef,0xfe,0xef,0xfe};
void delay1ms(int);
main()
{int i,j,scan;
unsigned char d;
SCON=0;
while(1)
{for(i=0;i<1;i++)
for(j=0;j<repeat;j++)
{
for(scan=0;scan<8;scan++)
{
MR=0;
COLP=~scan;
SBUF=c[scan];
while(TI==0);
TI=0;
ST=0;
_nop_();
_nop_();
ST=1;
_nop_();
_nop_();
OE=0;
delay1ms(1);
}
}
}
}
void delay1ms(int x)
{int i,j;
for(i=0;i<x;i++)
for(j=0;j<120;j++);
}
|