Ondraa Mas

LCD hitachi hc9s12256Dp

Discussion created by Ondraa Mas on Mar 29, 2008
Latest reply on Mar 30, 2008 by Jim Donelson
hello, I have problem with program. I don't know what is cmd_reg. This program is from one book. But there wasn't explaint it.
#include hc12.h
#include stdio.h
char *msg = "this is a very very very long string in the desert storm";
void putc2lcd(char ch);
void puts2lcd(char *ptr);
void lcd_init();

void main(void)
{
lcd_init();
puts2lcd(msg);
asm("swi");
}
void lcd_init()
{
while(cmd_reg & 0x80); /* wait until LCD is ready */
cmd_reg = 0x3C; /* set 4 x 20 display */
while(cmd_reg & 0x80);
cmd_reg = 0x0f; /* display and cursor on */
while(cmd_reg & 0x80);
cmd_reg = 0x14; /* display and cursor on */
while(cmd_reg & 0x80);
cmd_reg = 0x01; /* display and cursor on */
while(cmd_reg & 0x80);
}
void puts2lcd (char *ptr)
{
while (*ptr) {
putc2lcd (*ptr);
ptr++;
}
} Do you know please. What should be cmd_reg? And how i can do that? Thank you very much. I sorry for my english.

Message Edited by nevi on 2008-03-29 11:29 PM

Message Edited by nevi on 2008-03-29 11:30 PM

Outcomes