Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

Matlab serial transmit problem

Status
Not open for further replies.

niddss

Newbie level 1
Joined
Nov 16, 2010
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Pakistan
Activity points
1,289
hi!
I am trying to transmit data from MATLAB to PIC16F887 microccontroller...
Data is being transmitted to Microcontroller through hyperterminal without any error, but when I run following code in MATLAB:
s = serial('COM1');
set(s,'DataBits',8);
set(s,'BaudRate',9600);
set(s,'Parity','none');
set(s,'StopBits',1);
set(s,'FlowControl','none');
fopen(s)
fwrite(s,5);
fclose(s)
delete s
clear s
...I get the error 'Empty state-space model.'
Is there any error in the above code??
kindly help!
 

xpress_embedo

Advanced Member level 4
Joined
Jul 5, 2011
Messages
1,165
Helped
161
Reputation
396
Reaction score
189
Trophy points
1,353
Location
India
Activity points
10,570
try this...

s = serial('COM1','BaudRate',9600);
fopen(s);
%wait for some time
fprintf(s,"5");


% i mean to say try fprintf and in "5"

Try
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top