Forum Discussion
Altera_Forum
Honored Contributor
17 years agoRS232 interface, DE2-70 board
Can someone please help me? I have two weeks left in my senior design project and have to interface a Doran 2200 Scale to an Altera DE2-70 board using RS232. I have the configuration set-up on the bo...
Altera_Forum
Honored Contributor
17 years agoSorry code got screwed up here it is ;
void get_weight_from_uart(char * weight) { FILE* fp; char in_char = 0; int pointer = 0; fp = fopen ("/dev/RS232", "r+"); //Open file for reading and writing if (fp ==0) { printf("error"); } if (fp) { while (1) { in_char = fgetc(fp); // Get a character from the UART. // if ((in_char == '\n') | (in_char == '\r') | (in_char == 0)) // { // fclose (fp); // return; // } // else // { weight[pointer++] = in_char; printf("0%0x\n",weight); delay(1000); // } } fclose (fp); } // return 0; }