EZ-Serial: Set Device Name in Binary Mode

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi,

   

I'm using EZ-Serial in binary mode and I'm unable to set the Device Name (it works flawlessly in Text Mode using "SDN,N=TEST"). My packet looks like this:

   

0xc0 0x04 0x04 0x0f 'T' 'E' 'S' 'T'

   

and, of course, the checksum. What am I doing wrong here?

   

Thanks,

   

Andreas

0 Likes
1 Solution
Anonymous
Not applicable

Hi Andreas,

   

Your format is close, but it is missing the preceding "length" byte required on all uint8a arguments. In addition to the overall payload length value in the binary packet header, variable-length arguments require an additional argument-specific length value. To supply the four-byte string "TEST", you would actually need the following five-byte value:

   

0x04 'T' 'E' 'S' 'T'

   

Or, the whole binary packet including checksum in simple hex:

   

C0 05 04 0F 04 54 45 53 54 B5

   

Note that the payload length in the header has increased from 0x04 to 0x05 as well, since we added a byte to the payload.

   

For details on this preceding length requirement (and a similar two-byte length value required on longuint8a/longstring arguments), review the "API Protocol Data Types" table in Section 7.1.2 of the EZ-Serial User Guide.

   

Jeff

View solution in original post

0 Likes
2 Replies
Anonymous
Not applicable

Hi Andreas,

   

Your format is close, but it is missing the preceding "length" byte required on all uint8a arguments. In addition to the overall payload length value in the binary packet header, variable-length arguments require an additional argument-specific length value. To supply the four-byte string "TEST", you would actually need the following five-byte value:

   

0x04 'T' 'E' 'S' 'T'

   

Or, the whole binary packet including checksum in simple hex:

   

C0 05 04 0F 04 54 45 53 54 B5

   

Note that the payload length in the header has increased from 0x04 to 0x05 as well, since we added a byte to the payload.

   

For details on this preceding length requirement (and a similar two-byte length value required on longuint8a/longstring arguments), review the "API Protocol Data Types" table in Section 7.1.2 of the EZ-Serial User Guide.

   

Jeff

0 Likes
Anonymous
Not applicable

Thanks for your help, I completely overlooked that section of the Manual!

0 Likes