Azzera filtri
Azzera filtri

Serial connections with different baud rate on each COM port

3 visualizzazioni (ultimi 30 giorni)
Hello I have a doubt and I can't see a solution for now. I have three sensors that communicate via serial port with different baud rates. I have to write a simulink model on the target (that's Arduino Mega2560 for me) to set the communication between each sensor and the target itself. I've seen in the demo file demo_arduino_serial_communication that it has been made using the blocks in the Instruments Control Toolbox on the host side; in that case on the target side there's just a 'serial config' block to set the baud rate because there's only one device linked on the board. My problem is that i've several devices linked on the target and i can't understand how to differentiate the setting of baud rate for each one of them (there's the same problem to set a com port for each sensor). I reapeat for clearness that my problem is on the target side (communication between many sensors and the target).
Have you a solution for this? If there's something not very clear i'd be ready to offer a better explanation.

Risposte (1)

Rolfe Dlugy-Hegwer
Rolfe Dlugy-Hegwer il 14 Giu 2012
Hi Valerio, (assuming you are using R2012a and installed the Arduino target using Target Installer) To set the baud rate for each serial port: # In your model, select Tools > Run on Target Hardware > Options. # In the Configuration Parameters dialog that opens, wait a few moments for the Run on Target Hardware pane to display, and then set the Target hardware parameter to Arduino Mega 2560. # At the bottom of the same dialog, you can set baud rates for each serial port. I hope this helps. Rolfe

Categorie

Scopri di più su Instrument Control Toolbox in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by