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.

serial port programming using matlab GUI

Status
Not open for further replies.

neesha

Newbie level 4
Joined
Jul 19, 2013
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
43
This is my codes for base workspace in MATLAB. the codes turns ON the pump. BUT it does not work when i used this is GUI. can anyone help me on what modification should i do in order to make the pump to turn ON when it is controlled using GUI? ;)

s = serial ('COM7');
set (s,'Baudrate',1200,'Parity','even');
set (s,'DataBits',8);
set (s,'Stopbits',1);
fopen(s);
txdata = ['E9';'01';'06';'58';'4C';'00';'C8';'01';'01';'DB'];
txdata_dec = hex2dec(txdata);
fwrite(s,txdata_dec,'unit8')
 

try set (s,'Stopbits',2);
 

try set (s,'Stopbits',2);


Its still not working. I think there might be smtg wrong with the commands, because the hex codes are the protocols for the pump.it is fixed.There are different commands for MATLAB GUI. they are not the same with base workspace commands. But i cant figure out which line. :-(
 

I did this ... I can send and recieve it.
s = serial ('/dev/ttyUSB0');
s.BaudRate = 9600;
s.Terminator = 'LF/CR';
fopen(s);
fprintf(s,'ls');
out = fscanf(s);
fclose(s)
delete(s)
clear s
 

I did this ... I can send and recieve it.
s = serial ('/dev/ttyUSB0');
s.BaudRate = 9600;
s.Terminator = 'LF/CR';
fopen(s);
fprintf(s,'ls');
out = fscanf(s);
fclose(s)
delete(s)
clear s[/Q

can i use these codes in GUI? But there is no any commands for converting hex codes using GUI?
 

What do you mean by GUI?
 

as standalone application?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top