Mark, I think it is just a very specialized area. I did a lot of that kind of work in my earlier days using Delphi and the RS232 serial port. The modules (ADAM from Advantech Co., Ltd.) I used exchanged data as strings. It worked very well and was fun!
I trust you have taken a look at PyVisa:
http://pyvisa.sourceforge.net/
vegaseat
DaniWeb's Hypocrite
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
It almost seems like what you need is a simple C function to write the char to the port, and then link it in to your Python program.
Jeff
jrcagle
Practically a Master Poster
608 posts since Jul 2006
Reputation Points: 92
Solved Threads: 156
It almost seems like what you need is a simple C function to write the char to the port, and then link it in to your Python program.
Jeff
If you use Windows XP forget that, you can only get to the ports using the designated driver. The days you could go directly to a port are long gone!
vegaseat
DaniWeb's Hypocrite
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
Python has full set of binary operators, but I don't think there is one way to send bitstring to USB chip. Ultimately that is how data would travel in the serial wire.
bumsfeld
Nearly a Posting Virtuoso
1,445 posts since Jul 2005
Reputation Points: 404
Solved Threads: 184
Its looking a lot like this cant be done...
So i think im going to have to do some sort of work around.
Just seems absolutely ridiculous to me that it is not possible to send binary / hex data to a serial port.
Mark
Wait a second. Going back to your first post:I have been using the win32 module along with USPP and so far so good, apart from one thing. As far as i can work out it is only possible to write strings to the port as USPP uses a file handling style.
I am hoping to be able to send simple 8bit packets. I tried converting my data into the corresponding ASCII character and writing that to the port, but for anything lower than 0x20 it wont work as anything lower is an unprintable character...
So your problem isn't sending a single byte, nor is it communicating with the device. Rather, your problem is sending chars between 0x01 and 0x20.
Now, if I type
print '\x03'
I get a , which means that the terminal printed something else instead ... but 0x03 was actually sent to the character mapper.
What happens when you try to send 0x03 to your device? Does it get sent as the box character? Do you have success sending 0x25 (say)?
Jeff
jrcagle
Practically a Master Poster
608 posts since Jul 2006
Reputation Points: 92
Solved Threads: 156