I receive some data signals from Serial Port using Serial Receive
block (and Serial Configuration block of course). I use it to move a marker in a video. It works during simulation but when I generate .exe file using Simulink Coder
marker doesn't move during execution. It would seem that it does not receive data from serial.
*EDIT:*The original data is an int16
but the "source" is built on Arduino Mega2560
using Target Support Package
and so using an Arduino serial send
block it generates the source on USB COM port
with a baud rate of 9600. Because Arduino serial block
wants only uint8
I used a byte pack block
before Arduino Serial block
. The parameters of byte pack block
are:
1)Input port data types = {'int16'}
2)Byte Alignment = 2
In model that receives I use Serial Receive
block from instrument control toolbox
with:
(Serial Configuration Block
:)
Baud Rate = 9600;
Data Bits = 8;
Stop Bits = 1;
Byte Order = LittleEndian;
Flow Control = none;
Time Out = 10;
Header = none;
Terminator = none;
Data size = [2 1];
Data Type = uint8;
Enable blocking mode = flag;
Action when data is unavailable = output last received value;
Block sample time = (same sample time setted in the model built on Arduino)
I have connected this Serial Receive Block to a Byte Unpack block with:
Output dimensions = {[1]};
Output Port Data types = {'int16'} (data type of original signal)
Suggestions?