Connecting Simulink to USB and COM Ports: A Beginner's Guide

  • Thread starter Thread starter Gean
  • Start date Start date
  • Tags Tags
    Simulink
Click For Summary

Discussion Overview

The discussion revolves around connecting USB and COM ports to Simulink using MATLAB. Participants explore methods for establishing communication between Simulink and external devices, addressing both theoretical and practical aspects of the connection process.

Discussion Character

  • Exploratory
  • Technical explanation
  • Homework-related

Main Points Raised

  • One participant inquires about the possibility of connecting a USB device to Simulink, specifically asking about USB and COM port connections.
  • Another participant suggests using MATLAB's built-in serial functionality and provides a link to the documentation, indicating that the Instrument Control Toolbox may not be necessary for basic serial communication.
  • A participant mentions encountering a limitation where Simulink only recognizes COM ports 1 to 8, while their device is assigned to COM 11.
  • There are suggestions on how to change the COM port number through the device manager, with a note that some devices may need to be disabled to free up lower-numbered ports.
  • One participant reports successfully changing their device to COM2, allowing it to be selected in Simulink, but notes that it still does not work as expected.
  • Another participant reiterates the importance of consulting the MATLAB documentation for examples and guidance on using the serial interface.

Areas of Agreement / Disagreement

Participants express various challenges and solutions regarding COM port recognition and configuration, but there is no consensus on the effectiveness of the proposed solutions or the specific steps to resolve the issues.

Contextual Notes

Limitations include potential dependencies on specific device configurations and the need for participants to familiarize themselves with MATLAB's documentation and serial communication protocols.

Gean
Messages
5
Reaction score
0
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!
 
Physics news on Phys.org
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.
 
Last edited by a moderator:
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.
 
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
 
mgb_phys said:
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, which allows me to select it from 'Query Instrument'. However, it does not seem to work.

MATLABdude said:
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 :(
 
Last edited by a moderator:
Gean said:
Allright, i have the com-port set to COM2, which 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.
 
Last edited:

Similar threads

  • · Replies 7 ·
Replies
7
Views
1K
  • · Replies 8 ·
Replies
8
Views
6K
  • · Replies 6 ·
Replies
6
Views
2K
Replies
1
Views
1K
Replies
1
Views
6K
  • · Replies 15 ·
Replies
15
Views
4K
  • · Replies 2 ·
Replies
2
Views
6K
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K