Connect with us

LCD problem with ATmega16 and CVAVR

Discussion in 'Misc Electronics' started by Simoc, Oct 15, 2006.

Scroll to continue with content
  1. Simoc

    Simoc Guest

    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?
     
  2. Rich Webb

    Rich Webb Guest

    Try instead:

    int h = '1';
     
  3. Fred Bartoli

    Fred Bartoli Guest

    Rich Webb a écrit :
    Or
    char h = 0x30 + 1;

    :)
     
  4. Simoc

    Simoc Guest

    Thanks a lot! That did it :)
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-