Project

General

Profile

UART Tx

How this block appears in a Simulink model?

appearanceTX.PNG

What can be configured?

  • Packet mode – ASCII
  • Packet mode – Binary
  • Packet mode – Read Line
Configuration Parameter Selectable Option/Value Description
UART module 0--1--2 Select UART module to receive the Rx data from
Packet mode Ascii--Binary--Read Line Binary : This packet mode will accept the packets that contain binary data, by specifying the Header, Data format and Terminator of a packet to receive. The block will not accept the packet which contains invalid Header or Terminator.
Ascii : This packet mode will accept the packets that contain ascii data (string), by specifying the sscanf format. The block will create the output port corresponding to the sscanf % format.
Example: for packet format "Value=%d", the output port of block will be uint32. If packet "Value=100" is received, the block will return 100 to output port of block.
Raw buffer : This packet mode is receiving the raw string data and store into string buffer directly without processing the packet.
Buffer size 32--64--128--256--512--1024 Specify the expected size of the buffer.
ASCII format Scanf format specifier, start with %. Below is supported by block.
%u, %i, %d, %o, %x: sscanf output will be type of uint32
%e, %g, %f : sscanf output will be type of single
%s: sscanf output will be type of string.
End of packet CR--LF--CRLF Terminator in ascii mode is used for detect the end of packet. The block will continue receive ascii and store in a buffer, and detect terminator in the same time. After found and match terminator, the block will perform sscanf function to extract the value in a packet.
Binary header Specify the Header pattern of packet to receive This header is used for packet synchronization, the block will continue search for header, once header is matched then next bytes will be data.
Binary terminator Specify the terminator pattern of packet to receive This terminator is used for packet validation, once header is matched and all data types are received, the next bytes will be terminator. if terminator is not matched, the block will reject the previous bytes (Header and data), and continue searching for new packet start with header again.
Number of data port, Type UINT8 Number of data type uint8 in packet 1 data port of this data type contains 1byte in packet.
Sample time (sec) -1 (inherited) or specify Specify the sample time.

When to use this block?

Use this block to receive data from UART when application need communication between device to device via UART protocol.

How does this block work?

The block will acquire transmit data from the selected UART module buffer and process the packet depending on the configurations selected by the user.

Demo

UART demo

Previous : UART Setup Block
Next : UART Rx Block

Also available in: PDF HTML TXT