Forum Discussion
Altera_Forum
Honored Contributor
15 years agoRS232 coding problem
Hi all, I require to send/receive a character through the rs232 port, however i only be able to receive character. I had problem with sending the character out. Below is my coding for sending a...
Altera_Forum
Honored Contributor
15 years agoHi liscabello,
I found that we have 2 ways of doing it: 1. Using simple getc(fp) function where by pointer *fp is point to my uart. The code is something like this: FILE *fp fp = fopen ("/dev/uart_0", "r+"); while(fp) { getc(fp);read } fclose(fp) 2. Using IORD & IOWR for read and write.Example code as below: IOWR_ALTERA_AVALON_UART_TXDATA(UART_0_BASE,*(b+j)); for write IORD_ALTERA_AVALON_UART_TXDATA(UART_0_BASE,*(b+j)); for wirte You can refer to the handbook for further details. Sry that if I cant help much:)