Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
RS232 and Escorts 3136A

Subject: RS232 and Escorts 3136A

From: Vihang Patil

Date: 4 Dec, 2008 07:55:10

Message: 1 of 3

Hello
I am using ESCORTS 3136A Bench Multimeter with standard RS232 interface which is used to communicate with the PC.
Now I tried some of the command's that comes with multimeter for serial communication using HyperTerminal, and it works fine,
ex: I configure my hyper terminal with 9600 baud rate, parity none, 8 data bits, 1 stop bit
 and then send "RST", without the quotes and I see the multimeter is Reset and "R1" to get the data from the multimeter and so on and so forth
But I am having problem doing the same through Matlab

This is what I tried
 s = serial('COM1','BAUD',9600);
fopen(s);
fprintf(s,'RST');
out = fscanf(s);

But I see that the out has this char "!>" which according to the manual is "Command Error".
I need to know where exactly I might be going wrong?
Thanks
Vihang

Subject: RS232 and Escorts 3136A

From: Vihang Patil

Date: 4 Dec, 2008 12:12:02

Message: 2 of 3

OK
I got it folks
The serial port terminator was LF , I changed it to CR and it works fine now
s = serial('COM1', 'BaudRate', 9600, 'Terminator', 'CR')

Vihang

Subject: RS232 and Escorts 3136A

From: Trent Jarvi

Date: 4 Dec, 2008 14:52:18

Message: 3 of 3


"Vihang Patil" <vihang_patil@yahoo.com> wrote in message
news:gh82cu$iuq$1@fred.mathworks.com...
> Hello
> I am using ESCORTS 3136A Bench Multimeter with standard RS232 interface
> which is used to communicate with the PC.
> Now I tried some of the command's that comes with multimeter for serial
> communication using HyperTerminal, and it works fine,
> ex: I configure my hyper terminal with 9600 baud rate, parity none, 8 data
> bits, 1 stop bit
> and then send "RST", without the quotes and I see the multimeter is Reset
> and "R1" to get the data from the multimeter and so on and so forth
> But I am having problem doing the same through Matlab
>
> This is what I tried
> s = serial('COM1','BAUD',9600);
> fopen(s);
> fprintf(s,'RST');
> out = fscanf(s);
>
> But I see that the out has this char "!>" which according to the manual is
> "Command Error".
> I need to know where exactly I might be going wrong?

Hi Vihang

When you use HyperTerminal, I assume you press the enter key to send the
command. By default, the Serial port "Terminator" character that fprintf
appends is the new line character. You can change the terminator character
and see if it resolves the problem. Serial sniffing software is handy for
debugging problems like this.

s = serial('COM1','BAUD',9600);
s.Terminator='CR'
fopen(s);

fprintf(s,'RST');
...

inspect(s) will show you the options for the terminator character.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us