本人第一次使用HT1625,液晶屏始终不亮,求助用过的大神帮忙分析一下,万分感激!
程序如下,在线等,急!急!急!
#define CMD_SYSEN 0x01
#define CMD_LCDON 0x03
#define CMD_TIMERDIS 0x04
#define CMD_WDTDIS 0x05
#define CMD_RC32K 0x18
#define CMD_IRQDIS 0x80
void LCD_Init(void)
{
SendCmd(CMD_SYSEN);
SendCmd(CMD_LCDON);
SendCmd(CMD_TIMERDIS);
SendCmd(CMD_WDTDIS);
SendCmd(CMD_RC32K);
SendCmd(CMD_IRQDIS);
}
void SendBit_1625(uint8_t mdata, uint8_t cnt)
{
uint8_t i;
Delayus(1);
for(i=0; i<cnt; i++)
{
if(mdata & 0x80)
LCD_DATA_H;
else
LCD_DATA_L;
LCD_WR_L;
Delayus(1);
LCD_WR_H; //write one bit
Delayus(1);
mdata <<= 1;
}
}
void SendDataBit_1625(uint8_t mdata, uint8_t cnt)
{
uint8_t i;
for(i=0; i<cnt; i++)
{
if(mdata & 0x01)
LCD_DATA_H;
else
LCD_DATA_L;
LCD_WR_L;
Delayus(1);
LCD_WR_H; //write one bit
Delayus(1);
mdata >>= 1;
}
}
void SendCmd(uint8_t command)
{
LCD_CS_L;
SendBit_1625(0x80, 3); //100
SendBit_1625(command, 9);
LCD_CS_H;
}
void Write_1625(uint8_t addr, uint8_t mdata)
{
LCD_CS_L;
SendBit_1625(0xa0, 3); //101
SendBit_1625(addr<<1, 7);
SendDataBit_1625(mdata, 4);
LCD_CS_H;
}
void WriteAll_1625(uint8_t addr, uint8_t *p, uint8_t cnt)
{
uint8_t i;
LCD_CS_L;
SendBit_1625(0xa0, 3); //101
SendBit_1625(addr<<1, 7);
for(i=0; i<cnt; i++)
{
SendDataBit_1625(*p, 8);
p++;
}
LCD_CS_H;
}
void test(void)
{
uint8_t i, temp;
temp = 0xFF;
LCD_CS_L;
SendBit_1625(0xa0, 3); //101
SendBit_1625(0x00, 7);
for(i =0; i <64; i ++)
{
SendDataBit_1625(temp, 8);
}
} |