RS232 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 board and have the scale transmitting data to the board (I know this based off the blinking LED that is telling me data is being received). I am using C code to run on a softcore processor that I have put in the FPGA and need to read data from the RS232 port. I have this code written so far;
However when I read the data from those ports, I get the same thing printing over and over again which is;
void get_weight_from_uart(char * weight)
char in_char = 0;
int pointer = 0;
fp = fopen ("/dev/RS232", "r+"); //Open file for reading and writing
if (fp ==0)
in_char = fgetc(fp); // Get a character from the UART.
// if ((in_char == '\n') | (in_char == '\r') | (in_char == 0))
// fclose (fp);
weight[pointer++] = in_char;
// return 0;
I am not sure whether or not I have the correct code written or why I am getting the same thing. Please advise.