1

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?

dsolimano
  • 8,870
  • 3
  • 48
  • 63
cyberdyne
  • 426
  • 3
  • 5
  • 23
  • Please add to the question. If you simulate the system it moves the marker, but in real time it does not? Sounds like you are not communicating over serial at all. Might want to include what you are communicating with, baud rate, parity, etc. – macduff Feb 19 '14 at 16:17
  • Yes. During simulation it moves the marker but in real time it does not. – cyberdyne Feb 19 '14 at 20:30
  • I edited my question. I hope now it is clear. Sorry for the lack of details. – cyberdyne Feb 19 '14 at 20:58

0 Answers0