serial port - Regarding ascii and python packing -


I have some problems with python packaging, its yields range from 0x00 to 0xff, and I think that This decline of representation.

I want to send the data to the serial port, some things should be kept in mind that hex values ​​such as 0x11 and 0x13 are used by the serial protocol for internal flow control. I need to avoid sending them.

I can escape by sending one to two bytes, like 0x11 is encoded as 0x7d, 0x31. And 0x13 is encoded as 0x7d, 0x33. At the end, this option complexically maintains a temproveri byte array and checks the assurance of two strings and converts it back into one. - Use Base 64 encoding - Simple but only increases data by 25% .. I'm using the Radialo link .. It is really hard I do not know what to do .. help me ..!

How to encrypt and decode bytes in Ajaan:

  Gt; & Gt; & Gt; '\ X41' 'A'  

If you want to chr (int ()) it with function use:

  chr (65) A ' 

decode known string:

  ord (' A ') 65  

Hex int: < Int for hex:

  hex (65) '0x41'    

Comments