I have problem with HT1621 LCD driver.

Status
Not open for further replies.

m_esparham

Newbie level 1
Joined
Apr 30, 2010
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Iran
Activity points
1,310
hello
I use HT1621 with ATmega16L for LCD driving (Bias:1/3, Duty:1/4). I create my

microcontroller program with CodeVision AVR compiler. the command functions execute

correctly. for example I can change the tone output frequency. but I can’t change the

contents of RAM with writeData function. I see the HT1621 output waveform on

oscilloscope. this waveforms don’t change by write function. in other words I can’t change

the HT1621 LCD outputs. can someone help me please?
my code is here:

#include <mega16.h>
#include<delay.h>

#define DELAY_RW 50
#define DELAY_CS 100
#define SET_DATA PORTA.4=1
#define CLR_DATA PORTA.4=0
#define CLK_WR PORTA.5=0;delay_us(DELAY_RW);PORTA.5=1;delay_us

(DELAY_RW)
#define CLK_RD PORTA.6=0;delay_us(DELAY_RW);PORTA.6=1;delay_us(DELAY_RW)
#define SET_CS delay_us(DELAY_CS);PORTA.7=1
#define CLR_CS PORTA.7=0;delay_us(DELAY_CS)
#define SET_ALL PORTA|=0xF0;delay_us(DELAY_CS)
#define SYS_DIS 0x00
#define SYS_EN 0x01
#define LCD_OFF 0x02
#define LCD_ON 0x03
#define TIMER_DIS 0x04
#define WDT_DIS 0x05
#define TIMER_EN 0x06
#define WDT_EN 0x07
#define TONE_OFF 0x08
#define TONE_ON 0x09
#define CLR_TIMER 0x0C
#define CLR_WDT 0x0E
#define XTAL_32K 0x14
#define RC_256K 0x18
#define EXT_256K 0x1C
#define BIAS_2 0x028
#define BIAS_3 0x29
#define TONE_4K 0x40
#define TONE_2K 0x60
#define IRQ_DIS 0x80
#define IRQ_EN 0x88
#define F1 0xA0
#define F2 0xA1
#define F4 0xA2
#define F8 0xA3
#define F16 0xA4
#define F32 0xA5
#define F64 0xA6
#define F128 0xA7
#define TEST 0xE0
#define NORMAL 0xE3

//************************************
void command(unsigned char);
void init(void);
void writeData(unsigned char address);

void main(void)
{
init();
SET_ALL;//100
CLR_CS;
SET_DATA;
CLK_WR;
CLR_DATA;
CLK_WR;
CLK_WR;
command(SYS_EN);
command(LCD_ON);
command(TIMER_DIS);
command(WDT_DIS);
command(TONE_ON);
command(CLR_TIMER);
command(CLR_WDT);
command(RC_256K);
command(BIAS_3);
command(TONE_4K);
command(IRQ_DIS);
command(NORMAL);
SET_CS;
SET_ALL;
writeData(0x00);
while (1);
}
//*********************************************************************************
void command(unsigned char Comm)
{
unsigned char i=0;
for(i=0;i<8;i++)
{
if(Comm&0x80) SET_DATA;
else CLR_DATA;
CLK_WR;
Comm<<=1;
}
CLK_WR;
}
//*********************************************************************************
void writeData(unsigned char address)
{
unsigned char i;
SET_ALL;
delay_ms(1);
CLR_CS;
//send 101
SET_DATA;
CLK_WR;
CLR_DATA;
CLK_WR;
SET_DATA;
CLK_WR;
for(i=0;i<6;i++)
{
if(address&0x20) SET_DATA;
else CLR_DATA;
CLK_WR;
address<<=1;
}
SET_DATA;
for(i=0;i<128;i++)
CLK_WR;
SET_CS;
SET_ALL;
}
//*********************************************************************************
void init(void)
{
PORTA=0x00;
DDRA=0x00;
PORTB=0x00;
DDRB=0x00;
PORTC=0x00;
DDRC=0x00;
PORTD=0x00;
DDRD=0x00;
TCCR0=0x00;
TCNT0=0x00;
OCR0=0x00;
TCCR1A=0x00;
TCCR1B=0x00;
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x00;
ICR1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;
ASSR=0x00;
TCCR2=0x00;
TCNT2=0x00;
OCR2=0x00;
MCUCR=0x00;
MCUCSR=0x00;
TIMSK=0x00;
ACSR=0x80;
SFIOR=0x00;
ADCSRA&=0x7F;
DDRA=0xF0;
PORTA|=0xF0;
DDRB=0x10;
PORTB.2=1;
}
//*********************************************************************************
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…