hessu / aprs-specs

APRS specifications written or maintained by OH7LZB
22 stars 6 forks source link

Unclear on binary in telemetry format #6

Open EricAndrechek opened 1 year ago

EricAndrechek commented 1 year ago

Per the apr base91 comment telemetry spec (also at he.fi), section 3.9 says:

3.9 If binary values are transmitted, they MUST appear last in the
extension, after all 5 "analog" channels. They are put into a single
Base91 encoded integer, where the LSB (least significant bit) corresponds
to B1 of the traditional Telemetry specification, the 8th bit corresponds
to B8. Bits 9 to 13 are reserved to future use and will not currently be
treated as additional binary values.

Then, later, in the examples it is given:

Binary values:    '!"' decodes to decimal 1, binary values 10000000,
                          B1 is 1, B2 to B8 are 0.

I could be misunderstanding, but it was my understanding that in binary, the LSB was the right-most bit. Wouldn't this mean that in the given example B1 would be 0? I guess I am confused as to whether the binary representation goes from B8-B1 like 87654321 or from B1-B8 like 12345678. If B1 were the LSB I would think it would be 87654321 but in the example, it seems to go 12345678. Could I get some clarity here? Also, I am assuming, but would appreciate some clarity as well, as to where the 9-13 reserved bits would then go.

Thanks!

hessu commented 1 year ago

Please look up APRS101.PDF, telemetry specification in Chapter 13. The !" base91 decodes to a decimal value of 1. Whether the LSB of an integer is left or right is an implementation detail of your computer but does not affect the spec. :) But the intention of the spec here is that the !" base91 decodes to a decimal value of 1 (only the of the integer LSB is 1), and in this case the first bit of APRS telemetry (B1) is 1.

In the classic APRS telemetry the first bit B1 is the first character in the ASCII telemetry string ("10000000"). In Mic-E telemetry it's encoded as a single integer and the LSB is B1.