📄 zlg7290.c
字号:
#include "SPI/SPI.h"
#include "ZLG7290.h"
#include "LPC213x.h"
#include "I2CINT.h"
/*
*********************************************************************************************************
** 函数名称 :ZLG7290_Cmd()
** 函数功能 :ZLG7290写命令函数
** 入口参数 :uint8 cmd0, uint8 cmd1
** 出口参数 :返回结果
*********************************************************************************************************
*/
uint8 ZLG7290_Cmd( uint8 cmd0, uint8 cmd1 )
{
uint8 b;
uint8 buf[2];
buf[0] = cmd0;
buf[1] = cmd1;
b = I2C_WriteNByte(0x70, ONE_BYTE_SUBA, 0x07, buf, 2);
return b;
}
/*
*********************************************************************************************************
** 函数名称 :ZLG7290_Download()
** 函数功能 :ZLG7290下载译码函数
** 入口参数 :uint8 addr,uint8 dp, uint8 flash, uint8 dat
** 出口参数 :返回ZLG7290_Cmd
*********************************************************************************************************
*/
uint8 ZLG7290_Download( uint8 addr,uint8 dp, uint8 flash, uint8 dat )
{
uint8 cmd0;
uint8 cmd1;
cmd0 = addr & 0x0F;
cmd0 |= 0x60;
cmd1 = dat & 0x1F;
if( dp == 1 )
{
cmd1 |= 0x80;
}
if( flash == 1 )
{
cmd1 |= 0x40;
}
return ZLG7290_Cmd( cmd0, cmd1);
}
/*
*********************************************************************************************************
** 函数名称 :ClearAll( )
** 函数功能 :清除所有显示
** 入口参数 :无
** 出口参数 :无
*********************************************************************************************************
*/
void ClearAll( void)
{
uint8 x;
for( x = 0; x < 8; x++ )
{
ZLG7290_Download( x, 0, 0, 31);
}
}
/*
*********************************************************************************************************
** 函数名称 :Disp_Value
** 函数功能 :显示100以内的值
** 入口参数 :uint8 x, uint8 dat
** 出口参数 :无
*********************************************************************************************************
*/
void Disp_Value( uint8 x, uint8 dat )
{
uint8 d;
d = dat/10;
ZLG7290_Download( x, 0, 0, d );
d = dat - d*10;
ZLG7290_Download( x, 0, 0, d );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -