Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

COM Port & Matalb

Status
Not open for further replies.

mtawada

Mechanical
Oct 30, 2002
8
0
0
BE
I'm facing the following problem: Matlab doesn't recognize the COM1 port. Is there any command we can enter under the Matlab workspace to establish the communication between Matlab & COM1?

Thanks in advance.

TAWADA.

 
Replies continue below

Recommended for you

Matlab does not, as far as I know, have any facility to talk to a COM port, if you mean the serial port on a PC.

What are you trying to do? Matlab is for calculating not communicating.
 
Hi Lewish,

Thanks for answering me.

What I want to do is to link two PC: host PC (with Matlab+Simulink+Real_time Workshop; Windows as an operating system) and target PC (xPC target as an operating system) with an RS232 null-modem. For the moment, I don't succeed. I tried these options:

1- I have checked the COM1 cable. When I connect directly the two PC (host and target PC) with the windows 2000 as operating system, the communication works. So, there is no problem with the RS232.

2- I have checked the ports and it seems that com1 is connected effectively to RS232.

3- When trying to check if Matlab communicates with the COM1 port, I have obtained the output of the 's = serial ('COM1'), fopen(s)' commands as following:
------------------------------------------------------------

>> s = serial('COM1')
fopen(s)

Serial Port Object : Serial-COM1

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

Communication State
Status: closed
RecordStatus: off

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

??? Error using ==> fopen
Port: COM1 is not available. Available ports: COM2.
Use INSTRFIND to determine if other instrument objects are connected to the requested device.
------------------------------------------------------------

Now, we see that the serial 'Status' is closed.

What do you think about this?

Regards…

Tawada


 
Hello Tawada, I am afraid I can't be of much help on this one. While I use Real Time Workshop, I don't use it for xPC. I use it to talk to a TI DSP emulator. All of the communication is handled by the TI DSP blockset.

Thus, I would assume that the communication in your case is handled by the xPC blockset. I would dig around in the help file for that blockset.

Best of luck.
 
Hi Lewish,

I find out what's he problem. I had to delete the "Direct Connection" in the PC target's Network and Dial-up Connections.

Now, it's fine regarding the xpctest, etc...

This time my question is how to configure the PCI-6024E, which is in the target PC, in order to communicate with a physical system? I have taken a look in the xPC Target documentation found in but I don't enough elements to realize this configuration.

Regards…

Mohamed
 
Dear mtawada,

The similar kind of application i am also looking for.
but i am trying out in a different manner.
1.what ever simualtion needs to be done has to be modelled first.and then the output is to be stored in data file.
2. The stored data file has to be opened through a seperate C file
3.The third C file will extract the data and will place in the communication buffer.
4.From the communication buffer the data has to be sent to the serial port.

I feel that these may be the steps followed.but if u really have got some interesting solution
please let me also know..

Best wishes & Regards
pranesh
 
Status
Not open for further replies.
Back
Top