LCD problem with ATmega16 and CVAVR

Well, I'm attempting to use an LCD-module with ATmega16 -controller. I met a confusing problem. I'm programming with CodeVisionAVR, which has a library of lcd functions.

When I wrote into main program:

lcd_gotoxy(0,0); lcd_putsf("hello world");

That resulted perfectly correct displaying of text "hello world" on the LCD, so the lcd and its connections seem to be ok.

BUT when I attempted to use lcd_putchar -function, which should display the value of a variable, a problem occured. So firstly, I declared a global variable h and set it to 1, by writing at the beginning of the code:

int h=1;

Then attempted to get it displayed by writing into the main program:

lcd_gotoxy(0,0); lcd_putchar(h);

But the "1" didn't get displayed. Instead, it displays || -looking character. As well did many other values of h, and some values displayed as |||

-character.

I also tried changing the data type of the h from int to char and unsigned char, but with same results. What might be wrong?

-- I don't read top-posted messages.

Reply to
Simoc
Loading thread data ...

Look into ASCII or whatever character encoding the library uses. Once you figure out what your problem is, change int h = 1 to char h = '1'.

---Matthew Hicks

Reply to
Matthew Hicks

On 15 Oct 2006 09:13:27 -0700, "Simoc" wrote: [snip...snip...]

Try instead:

int h = '1';

--
Rich Webb   Norfolk, VA
Reply to
Rich Webb

Or char h = 0x30 + 1;

:-)

--
Thanks,
Fred.
Reply to
Fred Bartoli

Thanks a lot! That did it :-)

Reply to
Simoc

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.