Data Link Editor

The Data Link Editor provides a graphical interface to design and generate code for implementing an application specific messaging protocol for a data link. The Data Link Editor application is part of the Developer Tools download.

See the Data Link Overview for general information about a data link.

Getting Started

The data link editor provides the ability to create new or open existing data link definition files. To create a new data link definition, from the main menu, select FILE -> New Definition File (or CTRL + N). A new untitled definition file will be displayed. To open a data link definition, select FILE -> Open (or CTRL + O) to browse for the file to be opened. Each open definition file will appear as a tab within the editor.

Main Properties

Select the 'Main' item under the Properties group within the left pane to display the main properties for the definition file. Figure 1 below shows the main properties pane.

Figure 1 - Shows the Main properties pane for a data link definition file.

The following options can be configured for the data link definition file.

Link Options
  • Link Name - The link name is used within the generated code to uniquely identify the link. This name only needs to be changed if a device is going to have multiple data links.
  • Validation - Check the 'Append CRC' box to have the link append a CRC check value to all messages.
Code Generation Options
  • Host Type - Specify the code language for the host end of the link.
  • Host Directory - Specify the directory of where the generated host code should be saved.
  • Device Type - Specify the code language for the device end of the link.
  • Device Bool Size - The size of a BOOLEAN type within the device. Only used for message size calculations and does not affect transfers over the link.
  • Device Directory - Specify the directory of where the generated device code should be saved.

Code Generation

To generate the code for the data link definition, select the 'Code Generation' item under the Properties group within the left pane. Press the 'GENERATE CODE' button to have the code files generated for the definition file. A log of the code generation process is displayed onto the 'Code Generation' pane.

Figure 2 - Shows the displayed log after generating code for the definition file.

Check for and correct any errors or warnings that were displayed while generating the code. Any warnings or errors during code generation can result in code that will not properly compile or build in the target applications.

Device Handler Functions

Since the request-response message handler functions are application specific, the editor provides a dialog for creating handler function templates that can be pasted into the MCU application. The handler function dialog is opened by selecting the 'Code Generation' item of the definition file and pressing the 'EMBEDDED HANDLERS' button.

Figure 3 - Shows the embedded handlers dialog for copying handler function templates to the clipboard.

The embedded handlers dialog will list the handler functions that need to be implemented within the device application based upon the definition file. Check the desired handler functions within the dialog and press the 'COPY TO CLIPBOARD' button to have the function templates copied to the clipboard. The function templates can then be pasted anywhere into the device application. The prototypes for the handler functions will already exist within the generated header file for the data link.

Messages

Messages can be added to the definition file either by pressing the 'INSERT MESSAGE' button or by selecting EDIT -> Insert -> Message (CTRL + M) from the main menu. When a message is selected within the left pane, a message editor is displayed as shown in figure 4 below.

Figure 4 - Shows the 'Read Memory' message selected and displayed within the demolink definition file.

The message editor provides the ability to edit the following fields for a message.

Type
  • Unsolicited - Select unsolicited if the message is simply transferred across the link.
  • Request-Response - Select request-response if the message is sent as a request message and has a response message in return.
Recipient
  • Device Only - Indicates that only the device will receive this message and only the host will send this message.
  • Host Only - Indicates that only the host will receive this message and only the device will send this message.
  • Host and Device - Indicates that both the host and device can send and receive this message.
Name
  • A name for the message.
ID
  • The identifier value for the message. This value is automatically populated when the message is created. This value must be unique for each message within the definition.
Request Parameters
  • Define a collection of parameters to be transferred within this message.
Response Parameters
  • If the message is a request-response type message, define a collection of parameters to be transferred as the response of this message. Response parameters are not used for unsolicited type messages.

Parameters

Each message for the data link is defined by a collection of parameters. Add and edit parameters for each message. If a message is a request-response type message, provide parameters for both the request and response.

Enumerations

Application specific enumerations can be added to the definition. An enumeration can be added to the definition by pressing the 'INSERT ENUMERATION' button or by selecting EDIT -> Insert -> Enumeration (CTRL + E) from the main menu.

Structures

Application specific structures can be added to the definition to create reusable groups of parameters. A structure can be added to the definition by pressing the 'INSERT STRUCTURE' button or by selecting EDIT -> Insert -> Structure (CTRL + T) from the main menu.

More Information