📄 82c79.c
字号:
#include <reg51.h>
#include <absacc.h>
#include "82c79.h"
/********************** 共阴段码表******************************/
uchar code LED[] = {
0xF3,0x60,0xB5,0xF4,0x66,0xD6,0xD7,0x70,0xF7,0xF6,
// "0" "1" "2" "3" "4" "5" "6" "7" "8" "9"
0x77,0xC7,0x93,0xE5,0x97,0x17,0x37,0x67,0x00 };
// "A" "B" "C" "D" "E" "F" "P" "H" "熄灭符"
void Delay_8279()
{
uchar i;
for(i=0;i<200;i++);
}
void SendCmd(uchar DATA)
{
Cmd8279 =DATA;
Delay_8279(); //延时
}
void SendDat(uchar DATA)
{
Dat8279 = DATA;
Delay_8279(); //延时
}
void GetKey()
{
SendCmd(0x40);
key = Dat8279;
}
//8279初始化
void Init8279()
{
SendCmd(0x00); //8字符显示,左端输入,内部译码双键互锁
SendCmd(0x34); //设定CLK端的输入时钟的分频系数为31
SendCmd(0xd3); //清除命令 显示RAM的所有单元均置为零
IT0=1;
IE0=1;
EX0=1;
EA=1;
}
//数码管显示清除
void DispClear()
{
SendCmd(0xd3);
}
//数码管定位显示数字
void DispNum(uchar nLed,uchar Num)
{
SendCmd(nLed+0x80);
SendDat(LED[Num]);
}
//数码管定位显示16进制数,nLed为个位数字位置
void DispHex(uchar nLed,uchar Hex)
{
DispNum(nLed,Hex%16);
DispNum(nLed+1,Hex/16);
}
//数码管定位显示10进制数,nLed为个位数字位置
void DispDec(uchar nLed,uchar Dec)
{
DispNum(nLed,Dec%10);
DispNum(nLed+1,Dec/10);
}
void int0(void) interrupt 0 using 1
{
GetKey();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -