Get binary data out of usb port
I've written a PRN generator in Python and I am trying to test the sequences to validate them. I have a bit error rate tester, but in order for everything to work, I need to provide it with clocked data.
Is there any way of getting raw binary data out of the computer via USB or serial? I haven't found any python modules which are capable of doing this, but the language I use doesn't really matter so if this is doable in a dif开发者_如何转开发ferent language, I can use that.
To get the data from the serial port use pyserial. To convert the binary data use the struct module. These tools should work for Windows, Linux, and Mac.
Edit: Maybe, by "raw data", the OP means he would like to use the serial port as a DIO interface with no serial protocol? This type of thing is generally done using the parallel port, and is easy and possible using the pyParallel module within pyserial (given that one has a parallel port). I know of no way to do this directly with a serial port.
精彩评论