以下程序是两个字的动态显示,怎么改成八个字动态显示
#include<reg52.h>#define uchar unsigned char #define uint unsigned intuchar code col[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f}; uchar code row[][32]={{0x00,0x08,0x00,0x04,0x00,0x03,0xE0,0x00,0x00,0x00,0x00,0x40,0x00,0x80,0xFF,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x40,0x00,0x80,0x01,0x00,0x0E,0x00,0x00,}, //显示 字码:你{0x00,0x88,0x00,0x68,0x3E,0x09,0x22,0x09,0x2A,0x29,0x32,0xC9,0x22,0x09,0xFE,0x0F,0x22,0x29,0x32,0xC9,0x2A,0x09,0x22,0x09,0x3E,0x29,0x00,0xC8,0x00,0x08,0x00,0x00,}, // 显示字码:好 }; void delayms(uint t) //每1延时1ms{ uint x,y; for(x=t;x>0;x--) for(y=124;y>0;y--);} void display(uint n) //n为显示字码的序数{ uint i,j; for(j=0;j<10;j++) for(i=0;i<16;i++) { if(i<8) P2=col[i],P3=0xff; else P2=0xff, P3=col[i-8]; P0=row[n][2*i]; P1=row[n][2*i+1]; delayms(3); } } void main(){ while(1) { display(0); delayms(50); display(1); delayms(50); } }
|