LCD problem with ATmega16 and CVAVR

Oct 15, 2006 4 Replies

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.



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

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

Try instead:

int h = '1';

Rich Webb Norfolk, VA

Or char h = 0x30 + 1;

:-)

Thanks, Fred.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required