Frequently Asked Question
Press "Ctrl + F" to find the keyword of your interest.
If you wish to have a direct link access to the video timestamps, please follow these instructions.
Found this video helpful? Why not take the whole HIL Specialist course? A Certificate is waiting for you for free at HIL Academy.
Would you or your organization benefit from having these videos narrated in your native language? Contact us and let us know if you wish to contribute.
Hello everyone and welcome to our Serial communicationprotocol Introduction in Typhoon HIL device.
The Serial protocol components are availableunder the communication protocol tab of the
Schematic Editor Library Explorer and it correspondsto three main components: Serial Setup, Serial
Send, and Serial Receive.
Serial communications are enabled by a UniversalAsynchronous Receiver and Transmitter controller,
or UART, which is the key component of theserial communications subsystem of a computer.
The UART takes bytes of data and transmitsthe individual bits in a sequential fashion.
At the destination, a second UART re-assemblesthe bits into complete bytes.
Each UART contains a shift register, whichis the fundamental method of conversion between
serial and parallel forms.
Serial transmission of digital informationthrough a single wire or other medium is less
costly than parallel transmission throughmultiple wires, which is a key advantage of
the serial transmission protocol.
Communication can be simplex, that is in onedirection only, with no provision for the
receiving device to send information backto the transmitting device, full duplex, when
both devices send and receive at the sametime, or half duplex, when devices take turns
transmitting and receiving.
The speed of the UART is defined by its baudrate.
This is the number of bits that can be transmittedin one second.
In Typhoon HIL Schematic Editor, Serial componentscould be found in the Serial folder under
the Communication tab.
The Serial library consists of three components:Serial Setup, Serial Send, and Serial Receive
as shown here.
The Setup component is the main componentof Serial library.
This component is used for basic UART settings,like baud rate, data bits, parity, and stop
Most HIL devices have an exclusive connectorfor Serial RS232 communication which is used
for sending and receiving Serial signals.
Only in HIL402 specifically, there is an optionto select which digital input at the HIL device
will act as the UART receive pin, since HIL402slack a dedicated RS232 connector.
The selected settings will apply for SerialSend and Serial Receive components.
For example, if you choose a baud rate of9600, the Serial Send component will send
data at a 9600 baud rate, and the Serial Receivecomponent will read data at a 9600 baud rate,
To reach these settings, double click on theSerial Setup component in Schematic Editor.
A dialog window should appear like the oneshown here.
The Serial Send component is used to sendmessages from the HIL device to any attached
device via the UART controller.
It is possible to set the Byte order, Headermessage, and Sending period.
The input of this component is a vector, andthis vector is defined by the component which
is connected to the Serial Send component.
The message can be represented in two ways,which are represented in this slide.
In the first, the message contains a headerpart and a data part, while in the second,
the message has only a data part.
In either configuration, the message doesnot have an end indicator.
It is important to be careful with parsingdata on your machine.
The data type is defined by the componentthat is connected to the Serial Send component.
The allowed data types are float, unsignedinteger, and integer.
In order to define the message header, wehave three options as shown here.
The first is to leave the Header textbox empty.
That means that the Data will be sent withouta header frame as raw bytes, corresponding
to a message that only sends data values.
The second option is to define an Array ofhexadecimal numbers.
In this case, you need to write the 0x preamblebefore your hexadecimal numbers array, as
The third option is to define an Array ofcharacters, where any ASCII character can
The Serial Receive component is used for readingmessages which are sent to the HIL Device
from any attached device to the RS232 port.
This component receives input bytes and convertthem into data values.
Input data values are represented by variablesof a type defined in the Input variable data
Once the variables are received, they canbe used within the simulation.
The Messages can be any of the types we describedin the previous slides.
As you can see, this component has two ports:the Data port and the Status port.
The Data port is the port which outputs thereceived data to the component that Serial
Receive is connected to.
The Status port, on the other hand, outputsthe number of Framing and Parity errors that
occurred while receiving.
If parity is not enabled, such as when parityin the Serial Setup component is defined as
None, the Status port output will always bezero.
Let s show an example of how simple serialcommunication looks.
In this example, we will perform a loopbackcommunication with the HIL device UART controller.
A loopback test can verify the operation ofserial communication by sending and receiving
data from the same serial port.
It can show problems in the serial port, thecable, or the software generating the messages
without having to connect to third-party hardware.
To do this simply connect the receive RXDand transmit TXD terminal together with a
jumper wire, like shown here.
The connections are indicated in grey.
In the model we have connected a Constantcomponent to the Serial Send component.
The variable types are described in the Constantcomponent s properties, as shown here in the
The Value text box defines a vector of constants.
There are four constants, so the number ofvariables which will be sent through the UART
The Signal type is real, which means thatevery variable will be formatted as real,
which is the same as float type.
The execution rate of the Serial Send componentdepends on the execution rate defined in the
Next, we will use the Serial Receive component.
In this case, the number of input variablesis four.
For this reason, the Bus Split component hasfour outputs, and it is used to split the
To analyse the received variables, we connectfour probes on the Bus Split outputs.
When we compile this schematic and run itin HIL SCADA, Probe 1 will represent the first
variable, Probe 2 will represent the second,Probe 3 the third, and Probe 4 the fourth.
Lastly, Probe 5 will output the count of receivingerrors.
We ve now finished our introduction to Serialcommunication in the Typhoon HIL Toolchain.
In the next lesson, we will look at a morepractical example of using Serial.