Setting up UART for Transmission and Reception................................................................................................................6
Set up Transmission................................................................................................................................................................... 6
Set up Reception......................................................................................................................................................................... 8
Setting up UART with Heartbeat Messages............................................................................................................................9
SC0XX-1XX devices are supported for use with the library.
•
SC0XX-0XX devices are not supported for use with the library.
•
MCXXX-0XX, MCXXX-1XX and Display devices are not supported by the library.
•
Minimum required SC0XX-1XX HWD version is v210.
•
Make dependency files available, as follows:
1. After you add the first UART function block to the application, click Yes in the dialog box that
appears.
Limitations
2. In the project manager, right click on UART_Include.h and select Make available to PLC C code
POUs.
Before using the function blocks in this library, note the following limitations of some blocks.
A UART_Tx_Msg block can only transmit every other loop. If a piece of data needs to be sent every loop,
ensure it uses two blocks with two different IDs with alternating transmission.
The UART_Tx_Buffer block can send up to four messages per loop. Any additional messages stored in
the buffer are sent in the following loop following a First In, First Out queue. The buffer can hold 18
messages from the UART_Tx_Msg block.
Set up UART so an application can transmit messages and an application can receive messages.
Set up Transmission
To set up an application to transmit messages, complete the tasks that follow.
1. From the Library, drag in the UART_Tx_Buffer block. Place this function near the end of the
application.
2. Connect the UART_In bus to the UART_App bus from the Inputs bus of the controller template.
Then, connect the UART_Out bus to the UART_App_Outputs bus from the Outputs bus of the
controller template.
3. Navigate to the UART page in the outputs section of the controller template, “!TOP!Outputs!UART.”
Remove the logic from the following signals for proper compilation: TxMsg_Len, TxMsg_Tx, and
TxMsg_Data.
Make the changes shown in the following figure. If you are using the UART_Rx_Buffer block, also
•
remove the signal mentioned in the next section.
4. Add a UART_Tx_Msg block. This block is used to send 8 bytes of data over UART. The messages are
added to a queue that is processed by the UART_Tx_Buffer.
5. Connect inputs to the block, as shown in the following example.
ID: 25. Values from 0 to 120 are allowed.
•
Data: Safety Layer Failure signal in the lower four bytes, zero in the upper four bytes.
In the example, the message is then sent every 100 ms. To set up the other application to receive the
message, see Set up Reception.
Set up Reception
To set up an application to receive messages, complete the tasks that follow.
1. From the Library, drag in the UART_Rx_Buffer block. Place this function near the front of the
application.
2. Connect the UART_In bus to the UART_App bus from the Inputs bus of the controller template.
Then, connect the UART_Out bus to the UART_App_Outputs bus from the Outputs bus of the
controller template.
3. Navigate to the UART page in the outputs section of the controller template, “!TOP!Outputs!UART.”
Remove the logic from the following signal for proper compilation: RxMsg_Clear
Make the changes as shown in the following figure. If you are using the UART_Tx_Buffer block, you
also remove the signals mentioned in the topic Set up Transmission.
4. Add a UART_Rx_Msg block. This block is used to receive 8 bytes of data over UART. The messages are
processed from a queue that is managed by the UART_Rx_Buffer.
5. Connect the block to input, as the following example shows. Get an output signal that was sent over
UART.
ID: 15, Values from 0 to 120 are allowed. In the previous section’s example, the “UART_Tx_Msg”
•
block was setup to transmit using an ID of 15.
Data: Safety Layer Failure signal in the lower four bytes, zero in the upper four bytes. This is the
•
signal that was transmitted using the UART_Tx_Msg from the previous section.
Setting up UART with Heartbeat Messages
Set up UART so that heartbeat messages can be transmitted and received.
The UART_Tx_Hrtbeat block handles the packetization of successfully received IDs.
This message is sent every other loop, automatically alternating between ID 121 and 122. A
UART_Rx_Hrtbeat block placed in the other application receives the message.
1. From the Library, drag in the UART_Tx_Hrtbeat block.
Place this function after any UART_Rx_Msg blocks.
•
It is recommend to place the function before any UART_Tx_Msg blocks.
•
2. The following example shows a UART_Tx_Hrtbeat block in an application. Note how it is after any
UART_Rx_Msg blocks and before any UART_Tx_Msg blocks. The example that follows shows how,
when a message with ID 15 is received, it is added to a Heartbeat message to transmit back to the
other processor.
Heartbeat Reception
The UART_Rx_Hrtbeat block receives a heartbeat message from the other application.
It contains an array of successfully received IDs. The message is sent every other loop by the other
processor via UART_Tx_Hrtbeat. Due to the asynchronous nature of the processors and the
communication method, 0, 1, or 2 messages could be received in a single loop.
1. From the Library, drag in the UART_Rx_Hrtbeat block.
Place this function after the UART_Rx_Buffer block.
•
It is recommend to be placed before any UART_Tx_Msg blocks.
•
2. To determine if a sent message was properly received, you can monitor the RcvdIDs signal and use
the Find Array component to look for the ID. An example follows.
3. Inside the Example_RcvdOK block, you can use a section of logic to search for a certain ID.
When a message is sent, it sets the Set/Reset Latch component true, which starts two counters.
•
If the message ID does not appear in the RcvdIDs array, then they eventually pulse true.
•
Otherwise, if the ID does appear in the RcvdIDs array, the Success signal goes true.
Danfoss | October 2020AQ339983296573en-000101 | 11
User Manual
PLUS+1® Function Block Library—UART
UART_Rx_Buffer
The UART_Rx_Buffer function block receives data transmitted over the UART connection.
The received data is placed in a common buffer that the UART_Rx_Buffer message blocks use.
Place the UART_Rx_Buffer function block at the front of the application.
Inputs
Inputs to the UART_Rx_Buffer function block are described.
ItemTypeRangeDescription [Unit]
FailU80-3Bitwise code where multiple items can be reported at a time.
0x00: OK.
0x01: A UART_Rx_Msg block executed before the UART_Rx_Buffer block.
0x02: ExecTime of Primary differs from Secondary. Expect communication issues to arise.
K_OverflowBOOLT/FSignal that indicates if an overflow occurred in the lower level kernel buffer.
T: An overflow occurred. Data was lost.
F: No overflow occurred.
A_OverflowBOOLT/FSignal that indicates if an overflow occurred in the local application buffer.
T: An overflow occurred. Data was lost.
F: No overflow occurred.
UART_OutBUS——Connect to the UART_App_Outputs sub-bus if using the Main template.
RxMsg_Clear BOOLT/FSignal used to clear the receive buffer.
You can find this variable in the UART_App_Outputs sub-bus if using the Main template.
*Disconnect on Outputs_UART page.
T: Clear buffer.
F: Do not clear input buffer.
IEC 61508-3 Annex D Supplemental Information
The following table provides IEC 61508-3 Annex D supplemental information.
LabelDescription
Software Name
Software Version
Release StatusReleased.
Required Knowledge
Revision History
Known IssuesNot applicable.
Backward Compatibility
Market Requirements Not
Met
Change RequestDirect any change request to the PLUS+1® help desk:
SupportDirect any request to the PLUS+1® help desk:
OSThe software only runs on SCXXX-1XX series hardware with minimum HWD version
Tool RequirementsPLUS+1® GUIDE version 10.1 or later certified version.
SecurityNot applicable.
Design Level
CertificationNot certified.
UART_Rx_Buffer
2.10
1. The programmer must fully read and understand all parts of the Safety Manual
before attempting to use the software product.
2. The programmer must have well-founded knowledge about using PLUS+1® tools.
3. The programmer must fully read and understand all parts of the Safety Library—
User Manual before attempting to use the software product.
2.10. First release of function.
——
——
plus1helpdesk@danfoss.com
plus1helpdesk@danfoss.com
210.
All software development has been done using SIL2 processes.
•
The hardware library is not SIL2 certified.
•
Danfoss provides required documentation to certifying bodies on customer request.
Danfoss | October 2020AQ339983296573en-000101 | 13
User Manual
PLUS+1® Function Block Library—UART
UART_Rx_Hrtbeat
The UART_Rx_Hrtbeat function block receives a heartbeat message over the UART connection.
This function block unpacks successfully received IDs.
You must place this function block after the UART_Rx_Buffer function block.
The heartbeat contains information about what messages were properly received by the other processor.
The function block receives ID 121 and 122, messages that alternate in reception. However, it is possible
that both might be received during the same loop.
Input data types must exactly match the indicated type to successfully compile.
Outputs
Outputs of the UART_Rx_Hrtbeat function block are described.
ItemTypeRangeDescription [Unit]
DiagBUS——This bus provides diagnostic values for troubleshooting.
All output signals are in the bus.
Heartbeat_A BUS——Bus containing signals related to the heartbeat with ID 121.
Err BUS——Contains the errors detected by the function block.
CRC_Mismatch BOOLT/FIndicates if the received CRC does not match the calculated CRC.
T: CRC mismatch.
F: CRC OK.
SeqNum_Mismatch BOOLT/FIndicates if the received sequence number does not match the calculated
sequence number.
T: Sequence Number mismatch.
F: Sequence Number OK.
Data (ARRAY[8]U8)——The data received.
Updated BOOLT/FTrue when new data is available.
T: Received new data.
F: Did not receive new data.
MsgFound BOOLT/FTrue when a matching message is found.
T: Found a message matching the defined ID.
F: Did not find a message.
CalcCRC U80-255The CRC calculated by the receiver based on the data received.
The UART_Rx_Msg function block receives a message over the UART connection.
This function block handles the unpacking of the data. It receives the message based on ID.
Place the UART_Rx_Msg function block after the UART_Rx_Buffer function block.
Input data types must exactly match the indicated type to successfully compile.
Inputs
Inputs to the UART_ Rx_Msg function block are described.
ItemTypeRangeDescription [Unit]
IDU80-120A unique identifier for the message being received.
Outputs
Outputs of the UART_Rx_Msg function block are described.
ItemTypeRangeDescription [Unit]
DiagBUS——This bus provides diagnostic values for troubleshooting.
All output signals are in the bus.
MsgFound BOOLT/FTrue when a matching message is found.
T: Found a message matching the defined ID.
F: Did not find a message.
CalcCRC U80-255The CRC calculated by the receiver based on the data received.
RcvCRC U80-255The CRC from the received message.
CalcSeqNum U80-31The sequence number calculated by the receiver.
RcvSeqNum U80-31
ErrBUS——Contains the errors that the function block detects.
The UART_Tx_Hrtbeat function block transmits a heartbeat message over the UART connection.
The function block creates packets for successfully received IDs. The UART_Rx_Hrtbeat function block
receives the message of the UART_Tx_Hrtbeat function block, to provide feedback of a properly
received message.
The function block alternates between ID 121 and 122, to transmit every other loop.
Input data types must exactly match the indicated type to successfully compile.
You must place the UART_Tx_Hrtbeat function block:
•
After the UART_Rx_Msg function blocks.
•
Before the UART_Tx_Buffer function block.
It is recommended you place the UART_Tx_Hrtbeat function block before any UART_Tx_Msg function
blocks.
Outputs
Outputs of the UART_Tx_Hrtbeat function block are described.
ItemTypeRangeDescription [Unit]
DiagBUS——This bus provides diagnostic values for troubleshooting.
All output signals are in the bus.
Heartbeat_A BUS——Bus containing signals related to the heartbeat with ID 121.
Sent BOOLT/FTrue when the message is added to the buffer.
T: Message is added to the buffer.
F: No action.
CalcCRC U80-255The CRC calculated by the function block based on the data being sent.
CalcSeqNum U80-31The Sequence Number calculated by the function block.
Heartbeat_B BUS——Bus containing signals related to the heartbeat with ID 122.
Sent BOOLT/FTrue when the message is added to the buffer.
T: Message is added to the buffer.
F: No action.
CalcCRC U80-255The CRC calculated by the function block based on the data being sent.
CalcSeqNum U80-31The Sequence Number calculated by the function block.
Heartbeat_B BUS——Bus containing signals related to the heartbeat with ID 121.
Danfoss | October 2020AQ339983296573en-000101 | 21
User Manual
PLUS+1® Function Block Library—UART
UART_Tx_Hrtbeat
ItemTypeRangeDescription [Unit]
Sent BOOLT/FTrue when the message is added to the buffer.
T: Message is added to the buffer.
F: No action.
CalcCRC U80-255The CRC calculated by the function block based on the data being sent.
CalcSeqNum U80-31The Sequence Number calculated by the function block.
Heartbeat_B BUS——Bus containing signals related to the heartbeat with ID 122.
Sent BOOLT/FTrue when the message is added to the buffer.
T: Message is added to the buffer.
F: No action.
CalcCRC U80-255The CRC calculated by the function block based on the data being sent.
CalcSeqNum U80-31The Sequence Number calculated by the function block.
OverflowBOOLT/FIndicates if there is room available in the buffer for the heartbeat message.
T: No space.
F: Space is available.
SentBOOLT/FIndicates if a message is added to the buffer.
T: Message is added to the buffer.
F: No action.
IEC 61508-3 Annex D Supplemental Information
The following table provides IEC 61508-3 Annex D supplemental information.
LabelDescription
Software Name
Software Version
Release StatusReleased.
Required Knowledge
Revision History
Known IssuesNot applicable.
Backward Compatibility
Market Requirements Not
Met
Change RequestDirect any change request to the PLUS+1® help desk:
SupportDirect any request to the PLUS+1® help desk:
OSThe software only runs on SCXXX-1XX series hardware with minimum HWD version
Tool RequirementsPLUS+1® GUIDE version 10.1 or later certified version.
SecurityNot applicable.
Design Level
CertificationNot certified.
UART_Tx_Hrtbeat
2.10
1. The programmer must fully read and understand all parts of the Safety Manual
before attempting to use the software product.
2. The programmer must have well-founded knowledge about using PLUS+1® tools.
3. The programmer must fully read and understand all parts of the Safety Library—
User Manual before attempting to use the software product.
2.10. First release of function.
——
——
plus1helpdesk@danfoss.com
plus1helpdesk@danfoss.com
210.
All software development has been done using SIL2 processes.
•
The hardware library is not SIL2 certified.
•
Danfoss provides required documentation to certifying bodies on customer request.
The UART_Tx_Msg function block transmits a message over the UART connection.
It creates packets for the data and places the data in a form that the UART_Rx_Msg function block can
interpret.
Inputs
Inputs to the UART_Tx_Msg function block are described.
ItemTypeRangeDescription [Unit]
IDU80-120Used as a unique identifier for the message being transmitted.
Data(ARRAY[8]U8)——
SendBOOLT/FOn positive transition, Send adds the message to the buffer if there is room
The data to be sent.
available. If Overflow is true, the message was not added to the transmission
buffer.
T: Add message to transmission buffer.
F: Do not add message to buffer.
Outputs
Outputs of the UART_Tx_Msg function block are described.
ItemTypeRangeDescription [Unit]
DiagBUS——This bus provides diagnostic values for troubleshooting.
All output signals are in the bus.
CalcCRC U80-255The CRC calculated by the function block based on the data being sent.
CalcSeqNum U80-31The Sequence Number calculated by the function block.
OverflowBOOLT/FTrue, if no room is available in the buffer while Send is true.
T: No space.
F: Space is available.
SentBOOLT/FIndicates if a message is added to the buffer.
2800 East 13th Street
Ames, IA 50010, USA
Phone: +1 515 239 6000
Danfoss
Power Solutions Trading
(Shanghai) Co., Ltd.
Building #22, No. 1000 Jin Hai Rd
Jin Qiao, Pudong New District
Shanghai, China 201206
Phone: +86 21 2080 6201
Products we offer:
Hydro-Gear
www.hydro-gear.com
Daikin-Sauer-Danfoss
www.daikin-sauer-danfoss.com
Cartridge valves
•
DCV directional control
•
valves
Electric converters
•
Electric machines
•
Electric motors
•
Gear motors
•
Gear pumps
•
Hydraulic integrated
•
circuits (HICs)
Hydrostatic motors
•
Hydrostatic pumps
•
Orbital motors
•
PLUS+1® controllers
•
PLUS+1® displays
•
PLUS+1® joysticks and
•
pedals
PLUS+1® operator
•
interfaces
PLUS+1® sensors
•
PLUS+1® software
•
PLUS+1® software services,
•
support and training
Position controls and
•
sensors
PVG proportional valves
•
Steering components and
•
systems
Telematics
•
Danfoss Power Solutions is a global manufacturer and supplier of high-quality hydraulic and
electric components. We specialize in providing state-of-the-art technology and solutions
that excel in the harsh operating conditions of the mobile off-highway market as well as the
marine sector. Building on our extensive applications expertise, we work closely with you to
ensure exceptional performance for a broad range of applications. We help you and other
customers around the world speed up system development, reduce costs and bring vehicles
and vessels to market faster.
Danfoss Power Solutions – your strongest partner in mobile hydraulics and mobile
electrification.
Go to www.danfoss.com for further product information.
We offer you expert worldwide support for ensuring the best possible solutions for
outstanding performance. And with an extensive network of Global Service Partners, we also
provide you with comprehensive global service for all of our components.
Local address:
Danfoss can accept no responsibility for possible errors in catalogues, brochures and other printed material. Danfoss reserves the right to alter its products without notice. This also applies to products
already on order provided that such alterations can be made without subsequent changes being necessary in specifications already agreed.
All trademarks in this material are property of the respective companies. Danfoss and the Danfoss logotype are trademarks of Danfoss A/S. All rights reserved.