PDA

View Full Version : Simulink and USB/COM ports


Gean
Apr7-09, 03:13 AM
Hello,

I'm new to working with matlab and simulink, but I'm trying to connect a USB device with Simulink. Is there any way to connect Simulink with either a USB-port or a COM-port?

Thanks in advance!

MATLABdude
Apr7-09, 01:12 PM
You can make use of the built-in MATLAB serial stuff (navigate using the left-hand panel--this just links to the first page):
http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/f105659.html

Note, as per the first page I linked to above, that you don't need the Instrument Control Toolbox (extended serial port features and graphical user interface) or Data Acquisition Toolbox if you're just looking to communicate via the serial port.

Gean
Apr7-09, 01:20 PM
I tried to make a connection with COM-port, but the problem was that Simulink "sees" only COM port 1 to 8 or something. The connected device is at COM 11.

mgb_phys
Apr7-09, 02:08 PM
You can change the port number of a device (well most devices)
control panel->system->hardware->device manager
Select the device (under Ports)->properties->port settings->click advanced

You might have to disable some other devices to free up a low numbered com port first

Gean
Apr8-09, 01:57 AM
You can change the port number of a device (well most devices)
control panel->system->hardware->device manager
Select the device (under Ports)->properties->port settings->click advanced

You might have to disable some other devices to free up a low numbered com port first

Allright, i have the com-port set to COM2, wich allows me to select it from 'Query Instrument'. However, it does not seem to work.

You can make use of the built-in MATLAB serial stuff (navigate using the left-hand panel--this just links to the first page):
http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/f105659.html

Note, as per the first page I linked to above, that you don't need the Instrument Control Toolbox (extended serial port features and graphical user interface) or Data Acquisition Toolbox if you're just looking to communicate via the serial port.

Like i said, I'm new to the entire Matlab and Simulink thing. I really have no idea how to use the built-in Matlab stuff :(

MATLABdude
Apr8-09, 05:20 AM
Allright, i have the com-port set to COM2, wich allows me to select it from 'Query Instrument'. However, it does not seem to work.



Like i said, I'm new to the entire Matlab and Simulink thing. I really have no idea how to use the built-in Matlab stuff :(

Right: which is why I link to the documentation! Read through the stuff on the left hand side under serial interface and you'll be able to find some examples to help you with your application.

EDIT: Whoops! Didn't realize that link didn't autoload the left-hand menu. Click the first link (What is the MATLAB Serial Port Interface) under the "On This Page" box to have the left-hand menu open up the Serial Port I/O pages.