Help:not able to go specific locaion on lcd

Status
Not open for further replies.

Newbie level 2
I use atmega32 (16mhz), avr studio 6, and an avr usb programmer
My LCD is 16X2 JDH162A

I successfully made a code for writing to an LCD...but when I tried making for writing to a specific location,
all I was able to do was move the cursor to a specific location, but not able to write on that location..

the program compiled successfully, but I could not burn the program on the microcontroller..
it produced some sort of error :https://obrazki.elektroda.pl/4505256400_1355675700.png

Code:
void gotoxy(unsigned int x,unsigned int y)
{
unsigned char t=0;
if(y==0)
t=0;
else
t=64;

t=t+x-1;

Send_A_Command(t);

}

CAn someone help me out??
I have also uploaded the .c fileView attachment lcd_phd.rar

Last edited:

rohitkhanna

Banned
LCD controllers have different codes for 'command' and for 'data'.

It looks like you are only sending commands ( Send_A_Command() ). Where are you sending any data ?!?

all the best !

Newbie level 2
LCD controllers have different codes for 'command' and for 'data'.

It looks like you are only sending commands ( Send_A_Command() ). Where are you sending any data ?!?

all the best !

That was the code for gotoxy()

Here is my main routine:

Code:
int main(void)
{

_delay_ms(15);

Send_A_Command(0x01); //Clear Screen 0x01 = 00000001
//delay

Send_A_Command(0x38);    //set up interface length
//delay

Send_A_Command(0b00001111);   //turn on the lcd. enble cursor, enable blinking

gotoxy(5,2);

Send_A_String("Hi!!");

while(1)
{

}

}

PS: most of the code has taken from another code by Patrick Hood Daniels, on you tube

Status
Not open for further replies.