Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
21615 Discussions

Writing integer value out to LCD on DE2 board

Altera_Forum
Honored Contributor II
1,336 Views

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
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
509 Views

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
0 Kudos
Altera_Forum
Honored Contributor II
509 Views

 

--- 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
0 Kudos
Altera_Forum
Honored Contributor II
509 Views

Great! 

 

Cheers, 

Dave
0 Kudos
Reply