Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Honored Contributor I
703 Views

Reading from the RS232 Port

Hello everybody, i'm a bignner in software development using Nios II and i'm trying to read some data sent from my computer to my De2-70. I built this, shown in the image below, using the Qsys tool. 

 

https://www.alteraforum.com/forum/attachment.php?attachmentid=8470  

 

I followed the steps described here: http://www.labbookpages.co.uk/fpgas/alterahowtos/simpleniosii.html 

 

This tutorial helped me sending data from the De2-70 to my computer using this code here: 

# include <stdint.h># include "system.h" int main(void) { volatile uint32_t *uart = (volatile uint32_t*) UART_BASE; char *str = "Hello from NIOS II\n"; while (1) { char *ptr = str; while (*ptr != '\0') { while ((uart[2] & (1<<6)) == 0); uart[1] = *ptr; ptr++; } } return 0; } 

 

I would like to know how to read the data sent from my computer? I tried to include "altera_up_avalon_rs232.h" to use the int alt_up_rs232_read_data(...), but when i compiled this code this lib was not found. 

 

Thank you all for the attention.
0 Kudos
0 Replies