MATLAB Answers

In Simulink, how can I send uint8 array through an RS232-usb cable?

1 view (last 30 days)
HJ on 4 Jan 2018
Hi. I'm trying to send an array of 9 uint elements from the PC to my device via an RS-232 to USB cable (bought from Startech) in a Simulink environment.
These are some of things I have tried so far: 1. use "to instrument" block or "serial send" block -> The array data didn't seem to properly reach my device. The device did detect something, so there seems to be a problem with the content of data during communication. 2. use the mat function that was built-in with my device by "matlab function" block -> serial class didn't support code generation, so I had to create an equivalent C function and use coder.ceval to call the function. Still working on it, since I got the same problem as #1.
I would like to know if anyone had similar experience with RS-232 commuincation in Simulink. I am out of ideas.. :( Thanks.

Community Treasure Hunt

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

Start Hunting!

Translated by