void Ht1621_Wr_Cmd(u8 Cmd) 
{ 
    LCD_SPI_CS_LOW();
    Ht1621_Delay(HT1621_BIT_DELAY);
    Ht1621_Wr_Data(0x80, 4);               //写入命令标志100 
    Ht1621_Wr_Data(Cmd, 8);                //写入命令数据 
    LCD_SPI_CS_HIGH();
    Ht1621_Delay(HT1621_BIT_DELAY); 
} 
Example #2
0
/*******************************************************************************
Func:LCD写入命令
Date:2016-3-11
Note:
*******************************************************************************/
void Ht1621Wr_Cmd(u8 Cmd)   //写命令也可以连续写,这里一次只写一次
{
	GPIO_ResetBits(GPIOA,HT1621_CS);  //CS = 0;  先拉底,准备传数据
	Ht1621_Delay(3);
  Ht1621Wr_Data(0x80, 4); //写入命令标志 "100+0",命令格式="100+0+8位的命令字节"
  Ht1621Wr_Data(Cmd, 8);  //写入命令数据
	GPIO_SetBits(GPIOA,HT1621_CS);   //不写数据就再次拉高
	Ht1621_Delay(4);    //写数据结束
}
Example #3
0
/*******************************************************************************
Func:LCD写入寄存器
Date:2016-3-11
Note:
*******************************************************************************/
void Ht1621_WriteReg(u8 Addr, u8 Data)   //可以控制四个段
{
	GPIO_ResetBits(GPIOA,HT1621_CS);  //CS = 0;  先拉底,准备传数据
	Ht1621_Delay(3);
	Ht1621Wr_Data(0xa0, 3);         //写入数据标志101
	Ht1621Wr_Data(Addr << 2, 6);    //写入地址数据  因为数据是八位的,只用
	Ht1621Wr_Data(Data << 4, 4);    //写入数据   这个道理如上,只用后4位。
	GPIO_SetBits(GPIOA,HT1621_CS);     //拉高,终止传数据 
}
void Ht1621_Wr_Data(u8 W_Data, u8 Num) 
{ 
    u8 i; 
    
    for (i = 0; i < Num; i++) 
    {   
        LCD_SPI_CLK_LOW();
        Ht1621_Delay(HT1621_BIT_DELAY);
        if(W_Data & 0x80){
            LCD_SPI_DATA_HIGH();
        }
        else{
            LCD_SPI_DATA_LOW();                              
        }
        Ht1621_Delay(HT1621_BIT_DELAY);
        LCD_SPI_CLK_HIGH();
        Ht1621_Delay(HT1621_BIT_DELAY);
        W_Data <<= 1;  
    } 
} 
Example #5
0
/*******************************************************************************
Func:LCD写入数据
Date:2016-3-11
Note:
*******************************************************************************/
void Ht1621Wr_Data(u8 Data, u8 cnt)
{
	u8 i;
	for (i = 0; i < cnt; i++)
	{
	 GPIO_ResetBits(GPIOA,HT1621_WR);  
	 Ht1621_Delay(3);
	 if (Data & 0x80)
	 {
			GPIO_SetBits(GPIOA,HT1621_DAT); 
	 }
	 else
	 {
			GPIO_ResetBits(GPIOA,HT1621_DAT);
	 }
	 Ht1621_Delay(3);
	 GPIO_SetBits(GPIOA,HT1621_WR); 
	 Data <<= 1;
	 Ht1621_Delay(1);
	}
}
void lcd_ht1621_init(void)
{
    LCD_spi_gpio_Init();

    lcd_backlight_ctrl(TRUE);
	
    Ht1621_Delay(HT1621_INI_DELAY);      //延时使LCD工作电压稳定 
    Ht1621_Wr_Cmd(HT1621_BIAS); 
    Ht1621_Wr_Cmd(HT1621_RC256);                 //使用内部振荡器 
    Ht1621_Wr_Cmd(HT1621_SYSDIS); 
    Ht1621_Wr_Cmd(HT1621_WDTDIS); 
    Ht1621_Wr_Cmd(HT1621_SYSEN); 
    Ht1621_Wr_Cmd(HT1621_LCDON); 
    //Ht1621_Wr_Cmd(HT1621_LCDOFF); 
    disp_buf_clear();
    sys_printf("  lcd_ht1621_init  ");
}