这是我最近做的八位LED显示的工程
- #include<reg52.h>
- #include<intrins.h>
- #define uint unsigned int
- #define uchar unsigned char
- delay(ms)
- {
- while(ms--)
- {int i;
- for(i=0; i<110; i++);}
- }
- void main(){
- uchar
- a[16]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xal,0x86,0x8e };
- uchar b[8]={0x08,0x07,0x02,0x0a,0x0f,0x06,0x03,0x05},j;
- uint i ;
- while(1) {
- j=0x01 ;
- for( i=0; i<8;i++){
- P2=j;
- P0=a[b[i]];j=_crol_( j,1);
- delay(3);}
- }}
复制代码
|