Serial connections with different baud rate on each COM port

조회 수: 3 (최근 30일)
Valerio
Valerio 2012년 3월 7일
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.

답변 (1개)

Rolfe Dlugy-Hegwer
Rolfe Dlugy-Hegwer 2012년 6월 14일
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

카테고리

Help CenterFile Exchange에서 Arduino Hardware에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by