Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Cannot read data from GUI through UART

Status
Not open for further replies.

doremifaso

Newbie level 6
Joined
Jan 6, 2011
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,370
Hi!

Below are my C codes using NIOS 2 IDE to send and read data using DE2 board through UART by RS232 port.

Also, I build my own GUI to receive and send data to UART. After I read the data from my GUI and store the data in array prompt [10], I decide to display the array prompt [10] to my GUI by using several type of function calling, as shown coding below in bold style. However, from my GUI I cannot read the data sending. may i know how to solve it? Thanks!

int main ()
{
FILE* fp1;
char prompt[10] ;

fp1 = fopen(UART_0_NAME , "r+");

if (fp1)
{
while (1)
{
//I get the data from my GUI
fgets(prompt, 8, fp1);

// I send data to be displayed in my GUI
fwrite (prompt , 1 , sizeof(prompt) , fp1 );
cout<< prompt;
fputs (prompt,fp1);

}
fclose (fp1);
}
return 0;
}
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top