Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

RS232 interface using matlab

ks0818ks0818 Posts: 2Member
I am trying to do a serial interface on a medical pump via Matlab using examples of serial communication that I have found on the internet, but what seems like a really simple task just isn't working for me. Here are the codes that I've been trying with:

!mode com1:9600,n,8,1
s = serial('COM1');

fopen(s);
fprintf(s,'*IDN?');
get(s,{'InputBufferSize','BytesAvailable'});


This should return me with some device information but on the command window, it only shows:


Serial Port Object : Serial-PORT

Communication Settings
Port: PORT
BaudRate: 9600
Terminator: 'LF'

Communication State
Status: closed
RecordStatus: off

Read/Write State
TransferStatus: idle
BytesAvailable: 0
ValuesReceived: 0
ValuesSent: 0


so here it is telling me that the communication is closed, yet in the code that I used, this status should be open shouldn't it?

If anyone can point me in the right direction it'll be much appreciated.

Thanks in advance
Sign In or Register to comment.