|
我用3.3V电源给HT1621供电
示波器显示HT1621驱动输出最高峰值也是3.3V
我想问一下 这样的话 有的LCD根本无法点亮....
而换做5V供电 就能把LCD点亮得很清晰
请问 HT1621 能否靠自身解决这个问题呢?
或者说 需要 什么样的升压电路吗?
小弟感激不尽啦
顺便分享个我的 驱动程序 使用HT1621 驱动 EDS801 液晶段码管~ 呵呵
/****************************************************************************
HT1621初始化程序
****************************************************************************/
//定义HT1621的命令
#define ComMode 0x40 //4COM,1/3bias 1000 010 1001 0 YUAN 52
#define RCosc 0x30 //内部RC振荡器(上电默认)1000 0011 0000
#define LCD_on 0x06 //打开LCD 偏压发生器1000 0000 0 11 0
#define LCD_off 0x04 //关闭LCD显示
#define Sys_en 0x02 //系统振荡器开 1000 0000 0010
#define Sys_dis 0x00 //系统振荡器关 节电
#define Ctrl_cmd 0x80 //写控制命令
#define Data_cmd 0xa0 //写数据命令
#define HT1621_RAMSIZE 0x10 // LCD显示RAM大小16个字节
//定义 sbi()置位 clr()清零
//#define sbi(x, y) (x |= (1 << y)) /*置位寄器x的第y位*/
//#define clr(x, y) (x &= ~(1 <<y )) /*清零寄器x的第y位*/
//定义 WR DATA CS 端口
SBIT (WR, SFR_P1, 0);
SBIT (DATA, SFR_P1, 2);
SBIT (CS, SFR_P1, 3);
/**-------------------------------------------------------------------------
Name: SendBit_1621(送数据程序)
---------------------------------------------------------------------------*/
void SendBit_1621(uchar sdata,uchar cnt) //data 的高cnt 位写入HT1621,高位在前
{
uchar i;
for(i=0;i<cnt;i++)
{
WR=0;
NOP();
if(sdata&0x80) DATA=1;
else DATA=0;
WR=1;
NOP();
sdata<<=1;
}
}
/************************************************************/
/****************************************************************************
Name: SendCmd(送命令)
****************************************************************************/
void SendCmd_1621(uchar command)
{
CS=0;
SendBit_1621(0x80,4); //写入标志码"100"和9 位command 命令,由于
SendBit_1621(command,8); //没有使有到更改时钟输出等命令,为了编程方便
CS=1; //直接将command 的最高位写"0"
}
/************************************************************/
/****************************************************************************
Name: Write_1621(送数据和命令程序)
****************************************************************************/
void Write_1621(uchar addr,uchar sdata)
{
CS=0;
SendBit_1621(0xa0,3); //写入标志码"101"
SendBit_1621(addr<<2,6); //写入addr 的高6位
SendBit_1621(sdata,4); //写入data 的4位
CS=1;
}
//*****************************************************************
//*名称:void ht1621_write_string(unsigned char *prt,address,len) *
//*功能:向ht1621写入一组显示数据 *
//*参数:prt 指向字节数组的指针 *
//* address 数据首地址 *
//* len 数组的长度 *
//*返回:无 *
//*****************************************************************
void ht1621_write_string(unsigned char *prt,unsigned char addr,unsigned char len)
{
unsigned char temp;
CS=0;
SendBit_1621(0xA0,3); //发送写数据模式101
SendBit_1621(addr<<2,6); //发送地址
/*if((len+addr)>HT1621_RAMSIZE)
{
len=HT1621_RAMSIZE-addr;
}*/
for(temp=0;temp<len;temp++)
{
SendBit_1621(*prt++,8); //发送数据字节
}
CS=1;
}
/****************************************************************************
Name: all_off(清除1621显示)
****************************************************************************/
void HT1621_all_off(void)
{ uchar i;
uchar addr=0;
for(i=0;i<32;i++)
{
Write_1621(addr,0x00);
addr+=1;
}
}
/****************************************************************************
Name: all_on(全部点亮1621)
****************************************************************************/
void HT1621_all_on(void)
{ uchar i;
uchar addr=0;
for(i=0;i<32;i++)
{
Write_1621(addr,0xff);
addr+=1;
}
}
/****************************************************************************
Name: Init_1621(初始化1621)
*****************************************************************************/
void Init_1621(void)
{
SendCmd_1621(ComMode);
//delay_ms(100);
SendCmd_1621(Sys_en);
//delay_ms(100);
SendCmd_1621(LCD_on);
//delay_ms(100);
SendCmd_1621(RCosc);
//delay_ms(100);
}
/****************************************************************************
Name: LCDoff(初始化1621)
*****************************************************************************/
void LCDoff(void)
{
SendCmd_1621(LCD_off);
}
/****************************************************************************
Name: LCDon(初始化1621) LCDon
*****************************************************************************/
void LCDon(void)
{
SendCmd_1621(LCD_on);
}
/****************************************************************************
Name: LCDon(初始化1621) LCDon
*****************************************************************************/
void Sysdis(void)
{
SendCmd_1621(Sys_dis);
}
/****************************************************************************
HT1621初始化程序结束
****************************************************************************/
//*****************************************************************
//*名称:Disp_lcd(unsigned char *prt,address,len) *
//*功能:向ht1621写入一组显示数据 *
//*参数:prt 指向字节数组的指针 *
//* address 数据首地址 *
//* len 数组的长度 *
//*返回:无 *
//*****************************************************************
void Disp_lcd(unsigned char POS, unsigned char sz)
/*断码 GF ED CB AD */
/*SEG 01 23 45 67 */
{
uchar xdata D1[4]={0x00,0x00,0xFF,0x00};
uchar xdata D2[4]={0xF0,0xFF,0x0F,0xF0};
uchar xdata D3[4]={0xF0,0x0F,0xFF,0xF0};
uchar xdata D4[4]={0xFF,0x00,0xFF,0x00};
uchar xdata D5[4]={0xFF,0x0F,0xF0,0xF0};
uchar xdata D6[4]={0xFF,0xFF,0xF0,0xF0};
uchar xdata D7[4]={0x00,0x00,0xFF,0xF0};
uchar xdata D8[4]={0xFF,0xFF,0xFF,0xF0};
uchar xdata D9[4]={0xFF,0x0F,0xFF,0xF0};
uchar xdata D0[4]={0x0F,0xFF,0xFF,0xF0};
uchar xdata D11[4]={0xF0,0x00,0x00,0x00};
/*uchar xdata D1[4]={0x00,0x00,0x88,0x00};
uchar xdata D2[4]={0x80,0x88,0x08,0x80};
uchar xdata D3[4]={0x80,0x08,0x88,0x80};
uchar xdata D4[4]={0x88,0x00,0x88,0x00};
uchar xdata D5[4]={0x88,0x08,0x80,0x80};
uchar xdata D6[4]={0x88,0x88,0x80,0x80};
uchar xdata D7[4]={0x00,0x00,0x88,0x80};
uchar xdata D8[4]={0x88,0x88,0x88,0x80};
uchar xdata D9[4]={0x88,0x08,0x88,0x80};
uchar xdata D0[4]={0x08,0x88,0x88,0x80};
uchar xdata D11[4]={0x80,0x00,0x00,0x00};
*/
unsigned char addr;
unsigned char l=4;
if(POS!=5)
{addr=0x00+POS*8; //计算显示位置的地址 最低位 POS=0 addr=0x00
// 第二位 POS=1 addr=0x08
// 第二位 POS=2 addr=0x10
switch(sz) //根据sz内容,将显示码送入 HT1621
{
case 1 : ht1621_write_string(D1,addr,l);break;
case 2 : ht1621_write_string(D2,addr,l);break;
case 3 : ht1621_write_string(D3,addr,l);break;
case 4 : ht1621_write_string(D4,addr,l);break;
case 5 : ht1621_write_string(D5,addr,l);break;
case 6 : ht1621_write_string(D6,addr,l);break;
case 7 : ht1621_write_string(D7,addr,l);break;
case 8 : ht1621_write_string(D8,addr,l);break;
case 9 : ht1621_write_string(D9,addr,l);break;
case 0 : ht1621_write_string(D0,addr,l);break;
case 11 : ht1621_write_string(D11,addr,l);break;
}
}
else
{
if(sz=='d')
{ Write_1621(0x07,0xF0);
}
if(sz=='f')
{ Write_1621(0x19,0xF0);
}
if(sz=='v')
{ Write_1621(0x0f,0xF0);
}
}
}
//*****************************************************************
//*名称:Disp_flo(float fd) *
//*功能: 显示3位整数 一位小数 100以内的浮点数据 *
//*参数:fd *
//* *
//* *
//* *
//*返回:无 *
//*****************************************************************
void Disp_flo(float fd)
{
int xdata a,b,c;
if(fd>=99.9)
{
HT1621_all_off();
Disp_lcd(0, 0);
Disp_lcd(1, 0);
Disp_lcd(2, 1);
Disp_lcd(3, 11);
//Disp_lcd(5, 'd');
}
else
{
a=(int)fd/10;
b=(int)(fd-10*((int)fd/10));
c=(int)(10*fd-10*(int)fd);
HT1621_all_off();
Disp_lcd(0, c);
Disp_lcd(1, b);
if(a!=0||(b==0&&c==0))
{
Disp_lcd(2, a);
}
Disp_lcd(5, 'd');
}
}
//*****************************************************************
//*名称:Disp_Vt(float fd) *
//*功能: 显示3位整数 一位小数 100以内的浮点数据 *
//*参数:fd *
//* *
//* *
//* *
//*返回:无 *
//*****************************************************************
void Disp_Vt(float vv)
{
int xdata a,b,c;
a=(int)vv/10;
b=(int)(vv-10*((int)vv/10));
c=(int)(10*vv-10*(int)vv);
HT1621_all_off();
Disp_lcd(0, c);
Disp_lcd(1, b);
Disp_lcd(2, a);
Disp_lcd(5,'v');
Disp_lcd(5,'f');
} |
阿莫论坛20周年了!感谢大家的支持与爱护!!
月入3000的是反美的。收入3万是亲美的。收入30万是移民美国的。收入300万是取得绿卡后回国,教唆那些3000来反美的!
|