Tuesday, October 4, 2011

PIC + pyserial + Windows

I use PIC microcontrollers fairly often since I'm familiar with them and they generally have the features I need. That's a pain when I need to program a PIC board, then talk to the code over a serial port. I need Windows to burn the firmware, but I've never bothered to learn Windows serial port programming. 

Then I realized the pyserial library for Python is cross-platform. Sweet! One download and one "import serial" later I was burning firmware and talking to the PIC over USB serial, all from inside Vista.

PIC serial comms to the left of me, Python to the right, here I am, stuck in the middle with you...
(Well, almost... there's some weird version conflict where the pyserial version I downloaded doesn't like the Python version I have. Lucky I found a sketchy-looking forum post with some random dude's replacement for a key pyserial file. Copy, paste, run, and done. Sure, I can't close the serial port without getting an error, but it opens and handles data just fine. Thanks Internet!)


No comments:

Post a Comment