What's e LK204-25 LCD C programme 4 ATmega8 microcontroller?

LK/ELK/VK/PK/OK/MX/GLK/EGLK/GVK/GLT Series

Moderators: Henry, Mods

Post Reply
darchua1
LCD?
Posts: 4
Joined: Mon Sep 03, 2007 1:25 am

What's e LK204-25 LCD C programme 4 ATmega8 microcontroller?

Post by darchua1 »

Hi,
I'm currently doing a mini project and I want to display characters on the LK204-25 LCD. The microcontroller I'm using is ATmega8 from ATMEL and the ports that are used are the VCC, GND, RXD and TXD. As this is a new LCD to me, I have no idea how to go about writing the C programme. Can you help me? By the way, is there a header file for the LCD programming?

Darren

Clark
Matrix Orbital
Matrix Orbital
Posts: 881
Joined: Fri Aug 17, 2007 10:58 am
Location: Matrix Orbital
Contact:

Post by Clark »

Hi Darren,

Thanks for your question. C programming our LCD's is as easy as following the commands in your manual and learning serial transmission in C. I can help you with any problems you have with our commands, and would recommend using 'raw data' commands within our development tool uProject to get used to the command set of your LCD. As for your C programming all I can tell is that you only need to output the commands you wish to send to the appropriate serial port, and there is no special LCD header file to use. You may be able to get a feel for programming your display by looking through this example posted on the forums

Hope this helps answer your question, sorry I can't be more help with the C language but I'll be happy to guide you through any of our commands,

Troy
Troy Clark
Design & Development
Matrix Orbital

darchua1
LCD?
Posts: 4
Joined: Mon Sep 03, 2007 1:25 am

Resetting LK204-25LCD to default factory settings

Post by darchua1 »

Hi Troy,
Thanks for the help on the progamming. Now I have another problem. I wish to reset my LK204-25 LCD to the default setting. I have short the Manual Override pins but I'm not sure how to save the settings. Can you help me out with that? Thanks.

Regards,
Darren

darchua1
LCD?
Posts: 4
Joined: Mon Sep 03, 2007 1:25 am

LK204-25 LCD display gets stuck at startup screen

Post by darchua1 »

Hi Troy,
The reason why I needed to reset my LK204-25 LCD was because I had a problem. Originally, my LCD would show the startup screen and continue with what I wanted to display on it. Unfortunately, I wasn't sure what happened. Now, my LCD only shows the startup screen and gets stuck there. I tried shorting the Manual Override switch and the LCD was able to work normally. Once I turned off the power and turn it on again, the LCD only displays the startup screen and stops there unless I short it again. Is there anything I can do to rectify this problem. I look forward to your advice. Thanks.

Regards,
Darren

Clark
Matrix Orbital
Matrix Orbital
Posts: 881
Joined: Fri Aug 17, 2007 10:58 am
Location: Matrix Orbital
Contact:

Post by Clark »

Hi Daren,

Good to hear that you have a start on programming your display. To save settings after a manual override, which you should do because the override settings are not saved, you can do one of two things. First, you can find the commands such as 'Set Baudrate' and 'Set and Save Contrast' that are listed as 'Remember: Always' in your manual. These will allow you to set and save the settings you desire so they remain on restart. Second, you can issue the 'Set Remember' command, 254 147 1, alter any of the settings you wish, and then issue the command to turn remember off, 254 147 0. This method is slightly easier and is documented in the forums, but has experienced known issues in older displays. Use what works for you, and let me know if you experience any more problems.

Best of luck in your project,

Troy
Troy Clark
Design & Development
Matrix Orbital

darchua1
LCD?
Posts: 4
Joined: Mon Sep 03, 2007 1:25 am

Post by darchua1 »

HI Troy,
Thanks for the fast response and advice. I have tried shorting the manual override switch and doing the settings stated in your last post:

Code: Select all

// Set Remember ON first
/*
putchar(254);   
putchar(147);    
putchar(1);
*/

//secondly, Set Brightness, Baud Rate, I2C Slave address, Data Lock and RS232 Auto Transmit Data
//Default Values from Manual
/*
putchar(254);   
putchar(154);    
putchar(255);

putchar(254);   
putchar(57);    
putchar(51);

putchar(254);   
putchar(51);    
putchar(80);

putchar(254);   
putchar(202);    
putchar(245);
putchar(160);   
putchar(0);    

putchar(254);   
putchar(65);    


while(1){}
*/

//lastly Set Remember OFF
/*
putchar(254);   
putchar(147);    
putchar(0);
while(1){}
*/
After doing all this, I turned off the power and turn it on again. The problem still comes back. Is there anything wrong with my code? Is it possible to help me check my code? Thanks.

Regards,
Darren

Ray
Matrix Orbital
Matrix Orbital
Posts: 742
Joined: Thu Dec 13, 2001 4:00 pm
Location: Earth.... I think..
Contact:

Post by Ray »

Please don't shoot me for pointing out the obvious :)

But all your code seems te be commented out, so will never be really executed when compiled.

Also due to the while(1) loop the SetRemember off Code will never execute even if all code wasn't commented out..

Clark
Matrix Orbital
Matrix Orbital
Posts: 881
Joined: Fri Aug 17, 2007 10:58 am
Location: Matrix Orbital
Contact:

Post by Clark »

Hi Daren,

Sorry to hear that you are having a little trouble with your C code. I hope that you have read my colleagues previous post; please don't shoot him, he's a pretty cool guy 8).

Also, I'm not sure what purpose you intended for the while statements, but I would suggest looking into a do while, delay, or key board hit function to preform this task. In addition, I have noticed that you have used the value 154 to set the brightness of your display, that command should be 153. I'm not sure if you have the unit in I2C mode, you would have to change some solder jumps, but if you don't you won't need to change that address. On that note, you probably don't need to worry about automatically receiving data transmitted from the keypad yet either.

Try tweaking your code a little to reflect these changes, otherwise it looks alright, command wise, to me. Unfortunately I can't help you too much with the C portion of the code, but Ray might be able to take a look at it, provided you don't shoot him :nono: .

Thanks for your continued patience,

Troy
Troy Clark
Design & Development
Matrix Orbital

Post Reply