IXXAT - Products, Services and Training for CAN, CANopen, DeviceNet, CAL, FlexRay, LIN, Embedded TCP/IP
Home
Features
Gallery
Interface Boards
Tutorial
Tips, News, Articles
Support & FAQ
Downloads
Impressum


Deutsch
Tutorial

14.1 Creation of a database with the database editor

An example of a data-interpreter database is to be created with the aid of the database editor, which describes the protocol of a device with the following properties:

The device has a button with three positions and has a pressure and a temperature sensor.
After switching on, the device transmits the values of its process variables (switch position, pressure and temperature) cyclically via the CAN-bus. The CAN identifier used is 5.
The switch position is transmitted in the first databyte as an unsigned integer and can assume the values 0,1 and 2 for Off, Middle Position and Full Load.
The next two bytes contain the pressure in hPa in the INTEL-format as unsigned DWORD.
In bytes 3 and 4 the temperature in °C is transmitted in the INTEL-format as signed DWORD.

To start the Database Editor form the Control panel open the Controller Properties dialog by double clicking to a controller. Select the Bus Properties index card and press the button. Now the Database Editor is started.

After starting the Editor, an empty project is automatically created. A new project can also be created at any time with the aid of the menu commands File | New. An empty project contains only the project node. This appears on the left side of the program window. The project data are entered on the right side.


The project database to be created should interpret the telegram with the identifier 5. For this reason we define a message object with this identifier. Click with the right mouse button on the project node to open its context menu.

Add a message object by selecting the menu point Add Message.


After selecting the newly created message node, you obtain the dialog below. Enter the Identifier "5" in the identifier field, additionally you can enter a name for the message. In the Msg Lenth field enter the value "5" for the length of the data field.


Now that you have defined the message, you must define the signals that the CAN-telegram with the identifier 5 should contain.

For this, add a first signal definition below the message object by clicking with the right mouse button on the message object to obtain the context menu shown below:


Add a signal definition by selecting the menu point Add Signal. In the signal window that appears, the attributes for the signal "Pressure" should first be defined. The Name field is to be filled out accordingly, the Unit field receives the entry "hPa". The databytes are shown symbolically in the Range area of the window. At first the first byte is marked with a blue bar. This bar marks the bits that are occupied by this signal. The bar can be moved with the mouse (cursor symbol quadruple arrow) and enlarged or scaled down (cursor symbol double arrow). According to our assumption, the pressure value is to be transmitted in byte 2 and byte 3 of the field. The bar marking is therefore to be moved to byte 1 and enlarged until it extends over byte 1 and byte 2. The position and length of the allocated range appear in numerical form in the fields below.


We have defined the data type as an unsigned DWORD in the INTEL format. Make the corresponding settings in the Datatype and Encoding fields. Scale and Offset are two parameters of a linear equation with which the raw data are converted into the physical value of the signal. As the pressure value is transmitted one-to-one, Scale is set to the value 1 and Offset to the value 0. In the attribute Display, you can parameterize the display of the signal value with the Signal module. Via MinValue, MaxValue and DefaultValue the signal values can be checked or preallocated. For this example it should be sufficient to define the maximum pressure at 10000 hPa.

Create the signal "Temperature" in the same way. It is recorded in bytes 3 and 4 of the data field and has a maximum value of 2000°C and a minimum value of -40°C. The temperature is transmitted one-to-one and therefore Scale is also set to the value 1 here and Offset to the value 0. In this case the data type is a signed DWORD in the INTEL-format.


Finally, create the digital signal "Switch". The state of the button is described in byte 0 of the data field and is transmitted as an unsigned integer value.


"Switch" is a digital signal that describes states. The button has the three positions or states

Off (0)
Middle position (1)
Full load (2)

The allocated numerical values are given in parentheses. Now add the definition of the three states to the database. For this, click with the right mouse button on the signal node Switch to obtain the following context menu:


Now add a state data record by selecting the menu point Add State. After clicking on the newly created state data record, you can enter the name and the numerical value of the state.

For the remaining two states "Middle position" and "Full load", proceed in the same way, so that in the end you obtain the project tree shown. Save the created database.