?? 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 + -