Forum Discussion
Altera_Forum
Honored Contributor
16 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; }