Is there an agreement for transmitting part numbers through the serial port?

I have some devices that read the RFID tag and transmit the serial number of the tag through the serial port.

It seems to me that it’s β€œbetter” to use two bytes for each digit of the serial number, especially since some devices send a trailing 0x0D 0xA (CR / LF).

Now I find one device that uses one byte per digit, so for sending "12" it does not send 0x31, 0x32, but rather 0x12. This means that I cannot distinguish between CR / LF and real 0xA and 0xD. I ask and get some waffles about it no matter how fixed-length strings - so why bother with CR LF? And, to be consistent, they use two bytes for CR / LF.

As you could put together, I am pretty new to this project and somewhat confused by the discrepancies between devices from different manufacturers.

The manufacturer of this will happily change his firmware to suit me. Should I ask them to use two bytes for each digit?

+3
source share
2 answers

- , . , / . - . - : STARTBYTE, DATA, CHECKSUM sumtimes ~ CHECKSUM ( ) , , STOPBYTE. , , .

. . , CR/LF . , CR LF , . , . , , , ( ). . - . 0xFF 0x00 DATA0 DATA1 0xFF. 2 -. , . 0xFF 0x00 0xFF . , .

, CR/LF , , , RFID, CR/LF .

, , - . , .

, , .

+6

, , - , . ( , 256 ) .

0

Source: https://habr.com/ru/post/1767627/


All Articles