markwalker84
Programmer
Hi!
Im really struggling here...
Im trying to communicate with a piece of hardware that accepts a specific package format for control.
I need to be able to send an 8 bit data word via a serial connection from my Python program.
I have been using USPP & PySerial so far but have found a problem. Both those modules rely on file-style operation... writing strings etc. So so far i have been converting my 8bits of data to the relevant ASCII character and writing that to the port.
The problem occurs when i need to send a packet that has a value of less than 0x20... as from this point the relevant character is no longer printable (carriage return, tab etc) and so it cant be written as such.
Does anybody know of a way to send raw data in binary form to the serial port?
Many thanks,
Mark
Im really struggling here...
Im trying to communicate with a piece of hardware that accepts a specific package format for control.
I need to be able to send an 8 bit data word via a serial connection from my Python program.
I have been using USPP & PySerial so far but have found a problem. Both those modules rely on file-style operation... writing strings etc. So so far i have been converting my 8bits of data to the relevant ASCII character and writing that to the port.
The problem occurs when i need to send a packet that has a value of less than 0x20... as from this point the relevant character is no longer printable (carriage return, tab etc) and so it cant be written as such.
Does anybody know of a way to send raw data in binary form to the serial port?
Many thanks,
Mark