picture home | pixelblog | qt_tools

omino code blog

We need code. Lots of code.
David Van Brink // Thu 2007.06.7 09:58 // {wbl weird blinking lights}

MPLAB under Virtual PC and USB Serial

Keywords: MPLAB IDE Virtual PC USB Serial Cable Mac OS X PowerBook G4

Tedious “Human Interest” Introduction

In 1999, I purchased a “PicStart Plus” kit from MicroChip. This is a full development kit for their line of single-chip microcontrollers. Really quite amazing! Came with MPLAB, a Windows-based development tool suite (Windows 3.x era stuff, actually), and a serial-based programmer. They even threw in an 18-pin PIC16F84 chip. Just great stuff. With a protoboard and a few wires, you can write some assembly code and get the LEDs to count in binary after an hour’s play. Good clean fun.

So just recently, here in the year 2007, I’ve decided to return for a bit of LED blinking. Broke out the old programmer, and uncrated the old Windows 98 Vaio Ultralight with its studly 64MB and 233 MHz… and it worked… but oh, it was painful. Everything ran so slowly, and moving files on my network was… not transparent. I needed to upgrade to the present.

I do most of my tinkering on Mac OS, and to retain transparency with my revision control and network and such decided to pursue the Virtual PC route, since MPLAB has been updated quite a bit but is still Windows only.

Ran into a few snags. But it can be done!

How to Run MPLAB on a Macintosh

I shall here document the steps I took to get the latest version of MPLAB running on a 12″ PowerBook G4, under Virtual PC 7.0.2, using a USB Serial Cable.

On the Microchip forums and elsewhere there seems to be a fair amount of doubt regarding both Virtual PC and USB Serial cables in general. I assure you: it can be done!

Ingredients:

  • PowerBook G4 with Mac OS X 10.3 or later
  • Virtual PC 7.0.2 with Windows XP Home (about $200 from MacMall)
  • Any name or noname USB to Serial “cable” (they’re all based on the same Prolific 2303 chip) (about $15 from MacMall)
  • PicStart Plus programmer ($199 from DigiKey or Microchip)
  • PicStart Plus firmware upgrade (if you have an ancient 1999 version like I do; a new one will be up-to-date) ($30 from DigiKey or Microchip)

Step 1: Install Virtual PC & Windows XP
This was pretty annoying: the product activation codes were misprinted on the CD package! (I was home sick after surgery trying to do this install, and fortunately my smart girlfriend said, Try the other code first, instead. Wow. Doing anything with Windows really requires your full faculties.)

Other than that, no problem. Actually, it’s quite technically impressive, this virtual PC thing.

Step 2: Install USB Serial Drivers
You know, you can just plug any ol’ thing into a Mac and it works. But if you so much as glance at the USB port under Windows, you’d better be ready to click Next a lot.

Fire up Virtual Windows. Plug in the serial cable. New Hardware Discovered! says Windows, and “Show Me The Driver!” (It won’t find it by itself.) The “driver” disk that came with the USB-serial cable is a 3″ minidisc which cannot be used on the PowerBook’s slot loader. So I mounted it on my other Mac, used AFP to get it to show up on the PowerBook, and mapped it to drive M:\ under Virtual Windows. (Like I said, pretty slick virtuality, really.)

Driver installed fine. Under Windows System Properties/Device Manager, you can see the serial port like so:

I don’t know if this matters, but I double-clicked in the Device Manager and set the port to 57600 baud, 8 bits, 1 stop, no parity, no flow control.

Step 3: Install and Run MPLAB

Download the latest MPLAB from the Microchip web site. I got MPLAB 7.6. Under the menu Programmer:Settings… set it to COM3. The PicStart Plus wouldn’t work until I installed the new 40-pin upgrade — if your PicStart is newer than my 1999 edition, you might not have to do that. And after that, things worked great!

Conclusion

Ignore the naysayers, Serial USB and Virtual PC work just fine with MPLAB. On this 1.5Ghz PowerBook G4 performance is completely acceptable. Faster than the old Vaio.

oh, i dont know. what do you think?



(c) 2003-2011 omino.com / contact poly@omino.com