标签:main static reg ++ unsigned sig nbsp code i++
#include<reg52.h>
//绑定位
sbit ADDR0 = P1^0;
sbit ADDR1 = P1^1;
sbit ADDR2 = P1^2;
sbit ADDR3 = P1^3;
sbit ENLED = P1^4;
unsigned char code LedChar[] = { //点阵显示字符转换表
0xff,0x99,0x00,0x00,0x00,0x81,0xc3,0xe7//实心
//空心(0x99,0x66,0x7E,0x7E,0xBD,0xDB,0xE7,0xFF),case 7:需注释
};
void main(){
EA=1;
ADDR3=0; //使能U4
ENLED=0;
TMOD=0x01; //使能T0为模式1
TH0=0xFC; // 为T0赋初始值
TL0=0x67;
ET0=1; //使能中断
TR0=1; //开启T0
while(1);
}
/**
中断处理
*/
void InterRupt() interrupt 1{
static unsigned char i=0;
TH0=0xfc;
TL0=0x67;
P0=0xff;//清屏
switch(i){//点阵显示循环图案部分
case 0: ADDR2 = 0; ADDR1 = 0; ADDR0 = 0; i++; P0=LedChar[0]; break;
case 1: ADDR2 = 0; ADDR1 = 0; ADDR0 = 1; i++; P0=LedChar[1]; break;
case 2: ADDR2 = 0; ADDR1 = 1; ADDR0 = 0; i++; P0=LedChar[2]; break;
case 3: ADDR2 = 0; ADDR1 = 1; ADDR0 = 1; i++; P0=LedChar[3]; break;
case 4: ADDR2 = 1; ADDR1 = 0; ADDR0 = 0; i++; P0=LedChar[4]; break;
case 5: ADDR2 = 1; ADDR1 = 0; ADDR0 = 1; i++; P0=LedChar[5]; break;
case 6: ADDR2 = 1; ADDR1 = 1; ADDR0 = 0; i++; P0=LedChar[6]; break;
case 7: ADDR2 = 1; ADDR1 = 1; ADDR0 = 1; i=0; P0=LedChar[7]; break;
}
}
标签:main static reg ++ unsigned sig nbsp code i++
原文地址:http://www.cnblogs.com/robotes/p/7653478.html