Jump to content

LIGO PRO BLE Protocol: Difference between revisions

From SOJI ELECTRONICS
[checked revision][checked revision]
Update
Tag: Reverted
Tag: Reverted
Line 257: Line 257:
The checksum is calculated using Dallas APPLICATION NOTE 27 table method: ''Understanding and Using Cyclic Redundancy Checks with Dallas Semiconductor iButton Products''. One can use the following algorithms to calculate the checksum with a polynom <code>x^8 + x^5 + x^4 + 1</code> (C language):
The checksum is calculated using Dallas APPLICATION NOTE 27 table method: ''Understanding and Using Cyclic Redundancy Checks with Dallas Semiconductor iButton Products''. One can use the following algorithms to calculate the checksum with a polynom <code>x^8 + x^5 + x^4 + 1</code> (C language):


<pre>
<pre style="background:#f6f8fa;border:1px solid #d0d7de;border-radius:6px;padding:12px 16px;font-family:Consolas,'SF Mono','Menlo','Courier New',monospace;font-size:12px;line-height:1.5;overflow-x:auto;">
U8 CRC8(U8 data, U8 crc)
U8 CRC8(U8 data, U8 crc)
{
{
Line 275: Line 275:


<div class="noprint">
<div class="noprint">
== Related Documents ==
== Related Documents ==
''Cross-references to other documents.''
''Cross-references to other documents.''

Revision as of 04:20, 10 June 2026

General Introduction

LLS Protocol is used in LIGO RS232 / RS485 fuel level sensor with the following parameters:

  • Baud rate: 2400, 4800, 9600, 19200, 38400, 115200 (can be configured by software on PC)
  • Data bits: 8
  • Parity: None
  • Stop bits: 1
  • Flow control: None

LIGO fuel level sensor has 2 working modes:

  1. Slave mode: In this mode, the sensor will respond to all requests from the external device (master device). Each sensor in the network will be distinguished by different addresses configured with the LIGO Configurator software.
  2. Master mode: In this mode the sensor will automatically send data to the external device with a preset interval (message interval).

To enable this mode on the LIGO Configurator software, do the following:

  • Automatic transmission: select HEX (binary) or ASCII or ASCII EXT
Automatic transmission dropdown in LIGO Configurator
  • Set the time of each transfer (Message interval)
Message interval setting in LIGO Configurator

Exchange Protocol Description

The LLS protocol supports two types of exchange protocols: binary (HEX) and character view (transmission of ASCII sequences). It is recommended to use binary exchange protocol.

1. Format of Binary Protocol Messages

All the commands of the binary communication protocol have the same standardized format which is given in the table:

Sequential number of the field Field name Field size, byte Description
1 Prefix 1 The field is a marker of the message beginning shall have prefix 31h, and an outcoming messages shall be displayed with 3Eh prefix by the program.
2 Network address 1 For prefix 31h specify the network address of the recipient.
For prefix 3Eh specify the network address of the sender.
3 Operation code 1 For prefix 31h specify the code of operation which the program shall perform.
For 3Eh prefix specify the code of operation to which the response is given.
4 Data It depends on the operation code Data composition and format of the field depends on the operation code.
5 Checksum 1 The field is used to control over data integrity.

2. Single-Stage Data Reading (command 06h)

The command is designed for reading of the current data: relative level, temperature, frequency. The data are transmitted with a lower byte ahead.

2.1. Command format

Offset, bytes Field size, bytes Value Description
0 1 31h Prefix
+1 1 00h..FFh Network address of the recipient
+2 1 06h Operation code
+3 1 00h..FFh The checksum

2.2. Response format

Offset, bytes Field size, bytes Value Description
0 1 3Eh Prefix
+1 1 00h..FFh Network address of recipient
+2 1 06h Operation code
+3 1 −128…127 Temperature in degrees Celsius
+4 2 0000h…FFFFh Relative level
+6 2 0000h…FFFFh Frequency value
+8 1 00h..FFh Checksum

3. Periodic Data Output (command 07h)

Command is designed to switch on periodic data output.

After the command is processed, the sensor starts sending data periodically — level, temperature, and frequency — with the time interval prescribed by the 13h command.

Turning off of the periodic data output is performed after receipt of any true command, reset of the processor or disconnection of power supply (if the data output mode is not installed by default).

3.1. Command format

Offset, bytes Field size, bytes Value Description
0 1 31h Prefix
+1 1 00h..FFh The Network address of the sender
+2 1 07h Operation code
+3 1 00h..FFh Checksum

3.2. Response format

Offset, bytes Field size, bytes Value Description
0 1 3Eh Prefix
+1 1 00h..FFh Network address of recipient
+2 1 07h Operation code
+3 1 00h The command has been executed successfully
01h The command cannot be executed
+4 1 00h..FFh Checksum

3.3. Periodic data output format

Offset, bytes Field size, bytes Value Description
0 1 3Eh Prefix
+1 1 00h..FFh The Network address of the sender
+2 1 07h Operation code
+3 1 −128…127 Temperature in degrees Celsius
+4 2 0000h…FFFFh Relative level
+6 2 0000h…FFFFh Frequency value
+8 1 00h..FFh Checksum

4. Periodic Data Output Interval Adjustment (13h command)

Command is designed to set up interval of periodic data output.

4.1. Command format

Offset, bytes Field size, bytes Value Description
0 1 31h Prefix
+1 1 00h..FFh Network address of the recipient
+2 1 13h Operation code
+3 1 0…255 Interval of the data output in seconds
+4 1 00h..FFh Checksum

4.2. Response format

Offset, bytes Field size, bytes Value Description
0 1 3Eh Prefix
+1 1 00h..FFh The Network address of the sender
+2 1 13h Operation code
+3 1 00h The command has been executed successfully
01h The command cannot be executed
+4 1 00h..FFh Checksum

5. Default Data Output Mode (command 17h)

This command determines the order of data output after the sensor is powered on or the processor is reset. After the power is on or the processor is reset, the program will send data periodically via the interface at the time interval prescribed by the 13h command.

5.1. Command format

Offset, bytes Field size, bytes Value Description
0 1 31h Prefix
+1 1 00h..FFh Network address of the recipient
+2 1 17h Operation code
+3 1 00h The command has been executed successfully
01h The data are output in binary form
02h The data are output in character-coded form (ASCII mode)
03h The data are output in character-coded form (ASCII EXT mode)
+4 1 00h..FFh Checksum

5.2. Response format

Offset, bytes Field size, bytes Value Description
0 1 31h Prefix
+1 1 00h..FFh Network address of the recipient
+2 1 17h Operation code
+3 1 00h The command has been executed successfully
01h The command cannot be executed
+4 1 00h…FFh Checksum

Description of Commands for the Text-Based Protocol

Data exchange via the text-based protocol includes receipt and sending of ASCII symbols sequence interpreted and the request and response commands.

Reading the Data

The command is designed for reading of the current data: relative level, temperature, frequency. The command is a sequence of symbols ASCII "D" and "O". After receipt of the "DO" command the program will response in the form of ASCII symbols sequence.

For example, F=0AF9 t=1A N=03FF.0 <CR><LF>, where F is the current frequency value, t is the current value of temperature in Celsius degrees, N is the level value. All values are in hexadecimal form.

In case the frequency value exceeds FFFh, the data are considered invalid.

Periodic Data Output

The command is designed to switch on periodic data output. After processing the command, the sensor performs periodic data output in the text-based form (ASCII codes) of the following data: relative level, temperature, frequency.

The data are being output periodically with an interval set up when configuring the sensor (LIGO Configurator software). In case the data output interval is set to zero, the data output won't be performed.

Switching on of the periodic data output is done by sending of the "DP" symbols in line. After processing of the command, the symbols line will be received. For example, F=0AF9 t=1A N=03FF.0 <CR><LF>, where F is the current frequency value, t is the current value of temperature in Celsius degrees, N is the level value. Turning off of the periodic data output is performed after receipt of any true command, reset of the processor or disconnection of power supply.

Checksum Calculation Algorithm

The checksum is calculated using Dallas APPLICATION NOTE 27 table method: Understanding and Using Cyclic Redundancy Checks with Dallas Semiconductor iButton Products. One can use the following algorithms to calculate the checksum with a polynom x^8 + x^5 + x^4 + 1 (C language):

U8 CRC8(U8 data, U8 crc)
{
    U8 i = data ^ crc;
    crc = 0;
    if (i & 0x01) crc ^= 0x5e;
    if (i & 0x02) crc ^= 0xbc;
    if (i & 0x04) crc ^= 0x61;
    if (i & 0x08) crc ^= 0xc2;
    if (i & 0x10) crc ^= 0x9d;
    if (i & 0x20) crc ^= 0x23;
    if (i & 0x40) crc ^= 0x46;
    if (i & 0x80) crc ^= 0x8c;
    return crc;
}

Revision History

Loading revision history...

SOJI Electronics