HD7279(c语言)驱动程序含有两个按键驱动程序
来源:百度文库 编辑:神马文学网 时间:2024/05/05 04:49:17
〖说明〗标准8段数码管驱动程序不用使用者更改另外送多个时序函数,还有赠送按键扫描及两键驱动程序,全中文提示使用更方便快捷 http://www.mcuzb.com 坐标网时时更新为您的工作带来方便。
默认11.0592Mhz的晶振。
—————————————————————*/
#include
/*--------------------------------------------
调用方式:自行I/O 口定义﹫2001/05/12
函数说明:私有函数,各接口定义
--------------------------------------------*/
sbit HD7279_CS=P1^4; // HD7279_CS--P1.4
sbit HD7279_CLK=P1^5; // HD7279_CLK-- P1.5
sbit HD7279_DATA=P1^6; // HD7279_DATA-- P1.2
sbit HD7279_KEY =P1^7; // HD7279_KEY-- P1.3
/*--------------------------------------------
调用方式: HD7279A 各指令定义﹫2001/05/12
函数说明:私有函数,接口定义
--------------------------------------------*
/#define HD7279_RESET 0xa4 //复位
#define HD7279_TEST 0xbf //测试
#define HD7279_RLC 0xa3 //循环左移
#define HD7279_RRC 0xa2 //循环右移
#define HD7279_RL 0xa1 //左移
#define HD7279_RR 0xa0 //右移
#define HD7279_DECODE0 0x80 //译码方式0
#define HD7279_DECODE1 0xc8 //译码方式1
#define HD7279_UNDECODE 0x90 //译码方式2: 不译码
#define HD7279_HIDE 0x98 //消隐
#define HD7279_FLASH 0x88 //闪烁
#define HD7279_SEGON 0xe0 //段亮
#define HD7279_SEGOFF 0xc0 //段灭
#define HD7279_READ 0x15 //读
/*--------------------------------------------
调用方式: void HD7279_LongDelay(void) 等侍函数﹫2001/05/12
函数说明 私有函数,>500ms
--------------------------------------------*/
void HD7279_LongDelay(void)
{
unsigned char i;
for (i=0;i<6;i++);
}
/*--------------------------------------------
调用方式:void HD7279_ShortDelay(void) 等侍函数﹫2001/05/12
函数说明:私有函数,=500ms
--------------------------------------------*
/void HD7279_ShortDelay(void)
{;}
/*--------------------------------------------
调用方式:void Delay10ms(unsigned char time) 等侍函数﹫2001/05/12
函数说明:私有函数, 6M晶振
--------------------------------------------*/
void Delay10ms(unsigned char time)
{
unsigned char i;
unsigned int j;
for(i=0;i
默认11.0592Mhz的晶振。
—————————————————————*/
#include
/*--------------------------------------------
调用方式:自行I/O 口定义﹫2001/05/12
函数说明:私有函数,各接口定义
--------------------------------------------*/
sbit HD7279_CS=P1^4; // HD7279_CS--P1.4
sbit HD7279_CLK=P1^5; // HD7279_CLK-- P1.5
sbit HD7279_DATA=P1^6; // HD7279_DATA-- P1.2
sbit HD7279_KEY =P1^7; // HD7279_KEY-- P1.3
/*--------------------------------------------
调用方式: HD7279A 各指令定义﹫2001/05/12
函数说明:私有函数,接口定义
--------------------------------------------*
/#define HD7279_RESET 0xa4 //复位
#define HD7279_TEST 0xbf //测试
#define HD7279_RLC 0xa3 //循环左移
#define HD7279_RRC 0xa2 //循环右移
#define HD7279_RL 0xa1 //左移
#define HD7279_RR 0xa0 //右移
#define HD7279_DECODE0 0x80 //译码方式0
#define HD7279_DECODE1 0xc8 //译码方式1
#define HD7279_UNDECODE 0x90 //译码方式2: 不译码
#define HD7279_HIDE 0x98 //消隐
#define HD7279_FLASH 0x88 //闪烁
#define HD7279_SEGON 0xe0 //段亮
#define HD7279_SEGOFF 0xc0 //段灭
#define HD7279_READ 0x15 //读
/*--------------------------------------------
调用方式: void HD7279_LongDelay(void) 等侍函数﹫2001/05/12
函数说明 私有函数,>500ms
--------------------------------------------*/
void HD7279_LongDelay(void)
{
unsigned char i;
for (i=0;i<6;i++);
}
/*--------------------------------------------
调用方式:void HD7279_ShortDelay(void) 等侍函数﹫2001/05/12
函数说明:私有函数,=500ms
--------------------------------------------*
/void HD7279_ShortDelay(void)
{;}
/*--------------------------------------------
调用方式:void Delay10ms(unsigned char time) 等侍函数﹫2001/05/12
函数说明:私有函数, 6M晶振
--------------------------------------------*/
void Delay10ms(unsigned char time)
{
unsigned char i;
unsigned int j;
for(i=0;i