sending commands using C

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

Moderators: Henry, Mods

Post Reply
ndyguy
LCD?
Posts: 7
Joined: Fri Feb 02, 2007 4:32 pm

sending commands using C

Post by ndyguy »

I'm using a LK162-12 and I was wondering if anyone knew how to send commands using C. I've tried

Code: Select all

#define command 0xFE
#define clear_screen 0x58

while(1)
{
......display some text.......
......wait a second.............
printf("%X%X", command, clear_screen);
}
but it just displays them as text. Any suggestions?
Raquel
Matrix Orbital
Matrix Orbital
Posts: 834
Joined: Thu Aug 19, 2004 3:37 pm
Location: MO Office

Post by Raquel »

Hi ndyguy,

Please take a look at this post (I think it will help you out):

http://www.lcdforums.com/forums/viewtopic.php?t=1553

Best Regards,
Raquel Malinis
Design and Development
Matrix Orbital
ndyguy
LCD?
Posts: 7
Joined: Fri Feb 02, 2007 4:32 pm

Post by ndyguy »

Thanks for the response. The link you gave me seems to be focused on opening COM ports in Windows. What I'm looking for is help on sending raw hex (like 0xFE) in C using a microcontroller. I have the micro connected to the LCD and it's displaying text, but I'm not sure of the best way to send hex commands in C. I thought using a printf statement with %X would do the trick, but it just prints the characters as text on the LCD.
Raquel
Matrix Orbital
Matrix Orbital
Posts: 834
Joined: Thu Aug 19, 2004 3:37 pm
Location: MO Office

Post by Raquel »

What uC are you using?
Raquel Malinis
Design and Development
Matrix Orbital
ndyguy
LCD?
Posts: 7
Joined: Fri Feb 02, 2007 4:32 pm

Post by ndyguy »

Raquel
Matrix Orbital
Matrix Orbital
Posts: 834
Joined: Thu Aug 19, 2004 3:37 pm
Location: MO Office

Post by Raquel »

Hi,

On page 149 of the ATmega16 datasheet, there is a good example of transmitting data (hex data). I am not sure if there are any built-in functions in the software/compiler you are using; but the example on the datasheet is generic and works down to the register levels, so there is a small chance of getting it wrong.

Best Regards,
Raquel Malinis
Design and Development
Matrix Orbital
Post Reply