1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
| #include <REGX52.H> typedef unsigned int UI; typedef unsigned char UC;
void timer(UI i) { UC j; while (i--) for (j = 90; j > 0; j--); }
void init(void) { P0 = P1 = 0x00; P2 = 0xF0; }
void dzpDisplay(UC * top,UC * bot) { static UC i = 0; P0 = top[i]; P1 = bot[i]; timer(2); P0 = P1 = 0x00; i = ++i % 16; P2 += 0x01; if (P2 == 0x10) P2 = 0x00; }
void main(void) { UC code posTop[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x40,0x41,0x7F,0x7F,0x41,0x41,0x41,0x7F,0xFF,0x41,0x01,0x03,0x01,0x00,0x00, 0x00,0x00,0x10,0x22,0x2B,0x6F,0x6A,0xFE,0xBE,0xEA,0x6E,0x6B,0x23,0x31,0x20,0x00,0x00,0x00, 0x00,0x00,0xFF,0x44,0xFF,0x00,0xFF,0x44,0xFF,0x10,0xEF,0xDF,0x51,0x4B,0x7D,0x01 }; UC code posBot[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x10,0x10,0x10,0x10,0x90,0x10,0x10,0x10,0x10,0x32,0x12,0x07,0xFE,0xF8,0x00,0x00,0x00, 0x00,0x41,0x8B,0xC9,0xFF,0x7F,0xC9,0x8B,0x41,0x8B,0xC9,0x7F,0x7F,0xC9,0x8B,0x41,0x00,0x00, 0x00,0x03,0xFC,0x41,0xFE,0x01,0xFE,0x41,0xFE,0x08,0x98,0x18,0x10,0x12,0xFF,0xFE }; UC top[16],bot[16]; UC i,v,f = 0; init(); while (1) { v = 30; for (i = 0; i < 16; i++) { top[i] = posTop[(i + f) % sizeof posTop]; bot[i] = posBot[(i + f) % sizeof posBot]; } while(v--) dzpDisplay(top,bot); f = ++f % sizeof posTop; } }
|