#include<reg51.h>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
sbit SH_cp=P3^0;
sbit ST_cp=P3^2;
sbit DS="P3"^1;
unsigned char code seg[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,
0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e,0x00,0xff};
void delay(uint t)
{
uint i;
while(t--)
for(i=0;i<125;i++);
}
void write(uchar date)
{
uchar i;
SH_cp = 0;
for(i=8;i>0;i--)
{
DS=(bit)(date&0x01);
SH_cp=1;
_nop_();
SH_cp=0;
date>>=1;
}
}
void main()
{
write(0xc0);
write(0xf9);
write(0xa4);
ST_cp=0;
_nop_();
ST_cp=1;
ST_cp=0;
while(1);
}
文章评论(0条评论)
登录后参与讨论