⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ht1621.h

📁 ht1621 lcd 驱动程序
💻 H
字号:
/*****************************************************************************************************************
** Program Author  :  WuBing
** Completion Date :  2008-10-29
** Usable Function :  Disp_HT1621(Address,Array Pointer,Size)
**                    HT1621_Init()
**Entry Parameter  :  sbit cs  I/O
**                    sbit dat I/O
**                    sbit wr  I/O
**                    And you should define the function Delay_Us(50)
*****************************************************************************************************************/
#ifndef _HT1621_H_
#define _HT1621_H_
#define SYSEN    0x02
#define LCDON    0x06
#define TIMERDIS 0x08
#define WDTDIS   0x0a
#define TONEOFF  0x10
#define TONEON   0x12
#define RC256K   0x30
#define BIAS     0x52
#define TONE2K   0x80
#define TNORMAL  0xc6
#define  Delay_1621()  Delay_Us(50)  
void Send_Data_1621_High_to_Low(unsigned char dt,unsigned char cnt)
{
	unsigned char i;
	for(i=0;i<cnt;i++)
	{
		if((dt & 0x80)==0)  
			dat = 0;
		else  
			dat = 1;
		wr = 0;
		Delay_1621();
		wr = 1;
		dt <<= 1;
		Delay_1621();
	}
}

void Send_Data_1621_Low_to_High(unsigned char dt,unsigned char cnt)
{
	unsigned char i;
	for(i=0;i<cnt;i++)
	{
		if((dt & 0x01)==0) 
			da t= 0;
		else
			da t= 1;
		wr=0;
		Delay_1621();
		w r= 1;
		dt >>= 1;
		Delay_1621();
	}
}

void Send_Cmd_1621_0(unsigned char command)
{
	cs = 0;
	Delay_1621();
	Send_Data_1621_High_to_Low(0x80,4);
	Send_Data_1621_High_to_Low(command,8);
	cs = 1;
	Delay_1621();
}

void Send_Cmd_1621_1(unsigned char command)
{
	cs = 0;
	Send_Data_1621_High_to_Low(0x90,4);
	Send_Data_1621_High_to_Low(command,8);
	cs = 1;
	Delay_1621();
}
void Disp_1621(unsigned char addr,unsigned char *dt,unsigned char size)
{
	unsigned char i;
	cs = 0
	Send_Data_1621_High_to_Low(0xa0,3);
	Send_Data_1621_High_to_Low(addr,6);
	for(i=0;i<size;i++)
	{
		Send_Data_1621_Low_to_High(dt[i],8);
	
	}
	cs = 1;
}
void HT1621_Clear(void)
{
	unsigned char i = 0;
	cs = 0;
	Send_Data_1621_High_to_Low(0xa0,3);
	Send_Data_1621_High_to_Low(0x00,6);
	for(i=0;i<84;i++)
	{
		dat = 0;
		wr = 0;
		Delay_1621();
		wr = 1;
		Delay_1621();
	}
	cs = 1;
	Delay_1621();
}
void HT1621_Init(void)
{
  cs=1;
  dat=1;
  wr=1;
  Send_Cmd_1621_0(SYSEN);
  Send_Cmd_1621_0(RC256K);
  Send_Cmd_1621_0(LCDON);
  Send_Cmd_1621_0(BIAS);
  Send_Cmd_1621_0(TIMERDIS);
  Send_Cmd_1621_0(WDTDIS);
  Send_Cmd_1621_0(TONEOFF);
  Send_Cmd_1621_1(TNORMAL);
  HT1621_Clear();
}
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -