There are some refueling data that need to be communicated between the motherboard and the keyboard in a multi-gun tanker, and there may be multiple keyboard boards connected to a tanker motherboard. So we need a communication protocol that can realize data exchange between the motherboard and multiple keyboard boards.

In modern multi-gun tanker systems, data exchange is required between the tanker motherboard and multiple keyboard boards. To ensure smooth communication between different devices, we use a communication protocol based on the 485 bus. Next, we will introduce the working principle of this communication protocol and its various components in detail.
First, in terms of hardware, we connect all keyboards and motherboards to a 485 bus, where the motherboard is responsible for initiating communication as the host, and the keyboard is the slave and responds after receiving the communication of the corresponding address of the motherboard. Then the serial port configuration used by the protocol is baud rate 57600, data bit 8 bits, stop bit 1 bit, no check.
Then there is the composition of the protocol itself, which can be divided into 6 parts:
- Frame header: one byte, usually 0x01.
- Address and data length: one byte, the first 3 bits represent the address, and the address range is 0-7. The last 5 bits are the data length, ranging from 1-31, indicating the length of the command and command content.
- Address and length check: one byte, which is the bitwise inversion of the address and data length, is used to check the address and data length.
- Command: one byte, indicating the type of command for this frame of data. There are SYN commands 0x36 for refueling, ACK response commands 0x50, FSYN commands 0x92 for refueling, etc. In addition, the slave needs to invert the command bit by bit when replying to the command.
- Data: Different lengths depending on the command.
- Check: Two bytes, the first byte is the XOR checksum of the data packet, which is obtained by adding the command and data bit by bit modulo 2. The second byte is the checksum of the data packet, which is obtained by adding the command and data modulo 256.

In the non-refueling state, the first byte of the data is the keyboard status request KBSTATUS, where bits 1-4 are request data, bits 5-6 are request mode, and bits 7-8 are keyboard status.
- When the request mode is 00, it means no request, 01 means query request, 10 means configuration request, and 11 means mode switch request.
- When the query mode is 01 query request, the request data is 000, which means requesting system configuration and oil gun parameters, 001, which means requesting current refueling completion data, 010, which means requesting current cumulative data, 011, which means querying refueling records, 100, which means requesting current time, and 101, which means changing guns.
- When the request mode is 10 configuration request, the request data is 000, which means system configuration changes, 001, which means clearing shift cumulative data, 010, which means clearing total cumulative data, 100, which means current time changes, 101, which means setting total oil volume, 110, which means oil gun parameter changes, and 111, which means multi-gun unit price changes.
- When the request mode is 11 mode switching requests, the request data is 000, which means exiting parameter modification mode, 001, which means entering parameter modification mode, 010, which means exiting parameter query mode, and 011, which means entering parameter query mode.