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.

About serial communication and it correction

Status
Not open for further replies.

yousufsaleem

Junior Member level 1
Junior Member level 1
Joined
Mar 7, 2012
Messages
18
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,414
***At sending side***

s = serial('COM1');
set(s,'BaudRate',9600,'DataBits',8);
fopen(s);
fwrite(s,'we love you')
fclose(s)
***at receiving side***

s = serial('COM1');
set(s,'BaudRate',9600,'DataBits',8);
fopen(s);
x=fgets(s)
fclose(s)
**but at receiving only we is coming **

can you help me to get complete data at receiving side plz reply fast
 

Try to check the value 's.BytesAvailable' at receiver side
then use 'fread'

type 'get(s)' (without semicolumn) in command window to view all the serial port structure parameters.
 

Maybe your function call of fgets is executed before all bytes can come and maybe it is better to wait a little in an empty loop checking available bytes in the receiver buffer, how you think?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top