|
"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.
|