0

I'm currently working on creating a POS machine for Fuel Pumps for Gas Station and the manufacturer gave me what they call as "Communication Protocols"

I asked for more guidance but they're no longer replying.

This is given in the Communication Protocols they gave me.

  1. Communication assumption: 9600 BPS, Even Parity,8 data bits,1 stop bit
  2. Data structure of instruction

    2.1 Synchronous head: 3 Byte. All instruction and reply must use three 0FCH as synchronous head.

    2.2 Instruction: 1 Byte

    2.3 Nozzle number: 1 Byte

    2.4 Data: length of the data can be changed according to different instruction.

    2.5 Checksum: 2 Byte . CRC parity is used which is the CRC parity value of instruction, nozzle number and data bytes.

In the table of Instructions, this is an example

to Read Total, num is 08H and the data to be received is Total sales(4 Hex), total liter (4 Hex), total kilogram (4 Hex).

But how do I send 08H? What is Synchronous Head? It says as stated above "All instruction and reply must use three 0FCH as synchronous head"

I tried to send string to serial port: "0FCH 0FCH 0FCH 08H" but no success.

Can anyone help?

.

This is some of the example

Art
  • 9
  • 2
  • You left out salient information. What is the electrical interface? Synchronous or asynchronous? RS-232? *"This is given in the Communication Protocols they gave me...Communication assumption"* -- What do you mean by *"assumption"*? Is the baudrate *specified* or are you assuming it? – sawdust Mar 10 '17 at 23:37
  • Hi sawdust. Thanks for responding. I'm not sure what they mean assumption but that was written in the pdf file they gave. I think 9600 baud rate is given. It's RS-232 and I'm not sure if it's synchronous or asynchronous. The manufacturer is not giving lots of info.. – Art Mar 11 '17 at 06:33
  • *"I think 9600 baud rate is given."* -- You *"think"* or do you know for a fact? RS-232 is asynchronous, so *"synchronous head"* could very well be a bad translation for "synchronization header" aka "sync bytes". *"I tried to send string to serial port: "0FCH 0FCH 0FCH 08H" but no success."* -- Looks like you sent an ASCII text string, instead of binary data. Maybe you also need to append two bytes of checksum/CRC. – sawdust Mar 11 '17 at 07:23
  • Hi Sawdust. I remember one of the engineer mentioned that it uses "current loop". It's stated in the communication assumption above that it's 9600 BPS. I'm not sure why they're using the word "assumption". Sometimes, it's difficult to understand their english. – Art Mar 12 '17 at 12:21
  • Hello Sawdust. for the 2 bytes of Checksum, what does this mean "CRC parity is used which is the CRC parity value of instruction, nozzle number and data bytes.?" How do I calculate it? – Art Mar 12 '17 at 12:53
  • Current loop should only involve the electrical interface, and not impact the message protocol (i.e. it's still async bytes). The parity, checksum & CRC wording is a confusing mashup of validation items. Since CRC is sometimes called checksum, but the reverse is not common, you could try a [CRC-16](http://stackoverflow.com/questions/10564491/function-to-calculate-a-crc16-checksum) with big-endian order. But even more confusing are the `1+2 BCD` and `1+3 BCD` items in the "example". An odd number of BCD digits is problematic. Are there any numeric examples of message in the doc? – sawdust Mar 13 '17 at 21:28

1 Answers1

0

I think the synchronization header should be three bytes: { 0xFC, 0xFC, 0xFC }.

Regarding the CRC, you can find a calculator for CRC16 here: https://www.lammertbies.nl/comm/info/crc-calculation.html

chb
  • 1,727
  • 7
  • 25
  • 47