RS232 Serial communication
8 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I am trying to communicate with a device via RS232. When communicating thru Windows Powershell, I wrote the following and I can receive data just fine.
C:\> $port= new-Object System.IO.Ports.SerialPort COM67,4800,Even,7,one
C:\> $port.open()
C:\> $port.ReadLine()
I get the expected data in Powershell just fine when I do this. The remote device is currently set RUN mode, where it output data constantly without polling. Now, when I try to communicate with the same device thru MATLAB, I am facing issues. This is what I have written in the *.m file:
s = serial('COM67');
set(s,'BaudRate',4800, 'DataBits', 7, 'Parity', 'even', 'StopBits', 1);
fopen(s);
out = fscanf(s);
fclose(s)
delete(s)
clear s
I do not get an output, and get a timeout message. What am I doing wrong? Thank you.
0 Commenti
Risposte (1)
Walter Roberson
il 22 Set 2017
It could be a line termination property issue. For example it might sending carriage returns but the default setting is newlines
0 Commenti
Vedere anche
Categorie
Scopri di più su Data Acquisition Toolbox Supported Hardware in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!