Description |
Format Overview
The OpenFormat is designed to enable developers to inferface their own hardware with LogView via a configurable serial data protocol. To use the OpenFormat (short name: OF) you have to create an INI file and an optional picture for your device. The INI file contains all the needed configuration information for LogView to display your serial data.
The format OF is pure ASCII data where the items are separated by ";".
An OF packet starts with "$", then has several values separated by ";" and always ends up with CR + LF (#13#10). An example of a packet your device may produce is:
$1;1;0;1133;318;0;0;0;0;0;20;21;0;16<cr><lf>
We will explain what you can make all the values do in a bit.
Device Settings
Name - The name of your device Vendor - Your (company) name Vendor Link - Company link [optional] LogView Link - If we have a special info on our website [optional]
TimeStep - Time difference between two packets within one channel. This is a global setting for all channels. Time given from device - If set, the time must be included in the packet and will be used by LogView. If not set, the time is calculated from TimeStep and counting your packets. We will go into more detail later, see chapter 4c.
Value format - At the moment LogView only supports ASCII format. Checksum - If you can make your device generate a checksum, LogView can check it. Again more detail later, see chapter 4e none - Checksum isn't used. Checksum = 0 ! xor - Your device must use the XOR method for checksum calculations.
Port Settings
Baudrate - Device baud rate Databits - Device data bits (7 / 8 / 9) Stopbits - Device stop bits (1 / 1,5 / 2) Flowcontrol - Flowcontrol (None / Xon,Xoff / Hardware) State DTR - Controls the state of the DTR line State RTS - Controls the state of the RTS line Clustersize - Defines the size of the packet in Bytes. Don´t change this value if you don´t know the exact value. Negative values tell LogView that the size is variable.
DelayTime - These values control the receiving and sending of serial data and are related to the used baudrate. Increase the values for RTOCharDelay if you have problems receiving your data correctly. Useable values for xxxCharDelay are 200-2000. WTOxxxx controls the timeouts for sending. Normally you don´t have to change this.
Packet parts
An average packet may look like the one shown below. Have a quick look as in the next few chapters we will explain it in detail.
$1;1;0;1133;318;0;0;0;0;0;20;21;0;16<cr><lf> ....................................-------- > End Sign #13#10 ..................................-- > Checksum (see chapter 4e) .......-------------------------- > Data Stream (see chapter 4d) .....- > Time Stamp (see chapter 4c) ...- > States (see chapter 4b) .- > Channel Number (see chapter 4a) - > Start Sign "$"
a. Channel Number
The OF can handle up to 8 separated channels with 40 data streams each. We class data streams as the values you want to display, such as voltage, current, etc. Channels are something most devices don't make use of. To explain say for instance you built a changer that can independantly change 3 batteries at once but you still only wanted one serial connection to your PC. Logview can cope with all of them at once by using channels and assigning each individual charger to a seperate channel.
In our example from chapter 1. the bold entry is the channel number.
$1;1;0;1133;318;0;0;0;0;0;20;21;0;16<cr><lf>
b. States
[Stati] StatiAnzahl = 1
001 = Flight logging
So in state 1 Logview will name the data set "Flight logging". You have to define at least one state within your INI file. The states are used in LogView to build useful dataset names. Some example state names might be : charging, discharging, balancing, Charging in Lipo Mode, ... etc. States are only labels which can contain any ASCII character.
Again in our example the bold entry is the state.
$1;1;0;1133;318;0;0;0;0;0;20;21;0;16<cr><lf>
c. Time Stamp
$1;1;;1133;318;0;0;0;0;0;20;21;0;16<cr><lf> ....^^
The Timestamp (if given by your device) should be given in seconds. You can use fractions, for instance 200ms = 0.2 Always start at 0 !
Again in our example the bold entry is the timestamp.
$1;1;0;1133;318;0;0;0;0;0;20;21;0;16<cr><lf>
If you don't want your device to give a timestamp you have to set "Time given from device" in "Device Settings" to off, then LogView will use the "TimeStep" value in "Device Settings" multiplied by the packet count to work out the passage of time.
If no timestamp is sent you have to send ;; !
d. Data Stream
You have to let LogView know how to interpret each of the data items which are part of your packet. To explain this let's use the example from above:
$1;1;0;1133;318;0;0;0;0;0;20;21;0;16<cr><lf>
The items in bold are the data items, this example has 10 seperate data items.
Each of the data items must be specified in the INI file. These are the settings used:
Name (Messgröße) - name of the value (for example Voltage) Unit (Einheit) - unit (U for voltage) Symbol - symbol (V for voltage) Factor (Faktor) - floating value for the value calculation (see explanation) - default : 1,0 Pre Factor Offset (OffsetWert) - floating value for the value calculation (see explanation) - default : 0,0 Post Factor Offset (OffsetSumme) - floating value for the value calculation (see explanation) - default : 0,0
If you want LogView to display the values from your device verbatim you don't have to change the last 3 settings. If you want to add an offset or a scaling factor to the sent value you can specify it with "Factor", "Pre Factor Offset" and "Post Factor Offset".
LogView calculates the resulting value with this formula: y = ( x + [Pre Factor Offset] ) * [Factor] + [Post Factor Offset] y: displayed value x: input value, sent in data packet Pre Factor Offset: OffsetWert Factor: Faktor Post Factor Offset: OffsetSumme
e. Checksum
You can use XOR and AND as Checksum calculation.
Example code for XOR Calculation (Pascal / Delphi Code !!):
CheckCalc := 0; Data := '$1;1;0;1133;318;0;0;0;0;0;20;21;0;' // see Example above ! For _i := 1 to Length(Data) do begin CheckCalc := CheckCalc XOR Byte(Data[_i]); end;
This means LogView takes the data bytes until the last ";" for the checksum calculation.
$1;1;0;1133;318;0;0;0;0;0;20;21;0;16<cr><lf> Data used for the checksum calculation |
Send feedback on this topic
Copyright (C) 2013-2014 Dominik Schmidt / Holger Hemmecke. All rights reserved. |