基于C语言对51单片机的控制,涉及按键控制数码管,小灯,点阵。
#include<reg52.h>
sbit ADDR0 = P1^0;
sbit ADDR1 = P1^1;
sbit ADDR2 = P1^2;
sbit ADDR3 = P1^3;
sbit ENLED = P1^4;
sbit KEY1 = P2^4;
unsigned char code LedChar[] = {
0xC0, 0xF9, 0xA4, 0xB0, 0x99, 0x92, 0x82, 0xF8,
0x80, 0x90, 0xBF,
};
unsigned char LedBuff[6] = {
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
};
unsigned char code image[] = {
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x85,0xB5,0xB5,0xB5,0xB5,0xB5,0x85,0xFF,
0xC3,0xDB,0xDB,0xC3,0xDF,0xDF,0xC3,0xFF,
0xC3,0xDB,0xDB,0xC3,0xDB,0xDB,0xC3,0xFF,
0xC3,0xDF,0xDF,0xDF,0xDF,0xDF,0xDF,0xFF,
0xC3,0xFB,0xFB,0xC3,0xDB,0xDB,0xC3,0xFF,
0xC3,0xFB,0xFB,0xC3,0xDF,0xDF,0xC3,0xFF,
0xEF,0xE7,0xEB,0x81,0xEF,0xEF,0xEF,0xFF,
0xC3,0xDF,0xDF,0xC3,0xDF,0xDF,0xC3,0xFF,
0xC3,0xDF,0xDF,0xC3,0xFB,0xFB,0xC3,0xFF,
0xE7,0xE3,0xE1,0xE7,0xE7,0xE7,0xC3,0x81,
0xC3,0xDB,0xDB,0xDB,0xDB,0xDB,0xC3,0xFF
};
unsigned char fla