Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

Writing integer value out to LCD on DE2 board

I'm using the university program 16x2 character display component in SOPC builder and i can write text to the LCD via a C program in NIOS II no problem. eg ...

alt_up_character_lcd_string(char_lcd_dev, "Hello Altera Forum!");

But, i have a 7 bit PIO value defined as# define switches (volatile char*) 0x00101060

How can i display this on the LCD ? i know how to do it with standard C and printf but not this.

I have looked through the document for this component and there is another function called alt_up_character_lcd_write but it doesn't give an example of it should be used

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Why not format a string first?

    char str[80];

    int data;

    data = <read from the LED>

    sprintf(str, "LED value is 0x%X", data);

    alt_up_character_lcd_string(char_lcd_dev, str);

    Cheers,

    Dave
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    Why not format a string first?

    char str[80];

    int data;

    data = <read from the LED>

    sprintf(str, "LED value is 0x%X", data);

    alt_up_character_lcd_string(char_lcd_dev, str);

    Cheers,

    Dave

    --- Quote End ---

    Dave you're a hero. I didn't think i could do it like that. Works a charm

    Thankyou