Altera_Forum
Honored Contributor
14 years agoUrgent HELP!!! RS232 problem
Hi all,
I trying to send signal through the RS232 port. I have problem in sending out the integer/character. Below is my code: void serial() { unsigned int a = 0x61626364; char* msg = "Testing 't'.\n"; char *b; char e[16]; unsigned char ch='f'; int c; system("pause"); FILE *fp; fp = fopen ("/dev/uart_0", "r+"); while(1) { b=&e; for(c=16;c>=1;c--) if (fp) { *b = getc(fp); printf("%c",*b); //if (ferror(fp))// Check if an error occurred with the file //clearerr(fp);// If so, clear it //putc('c',fp); } for(c=16;c>=1;c--) { IOWR_ALTERA_AVALON_UART_TXDATA(UART_0_BASE,ch); usleep(1000); } THIS IS THE PROBLEM PART!!! } } If possible, please provide me with example of simple RS232 transmission. THANKS!! Regards Vincoldes