Wednesday, November 14, 2012

Pennybot restart

Knowing as always time is short for robot building I wanted to break down the tasks to build pennybot into smaller achievable tasks that would take 1-2 weekends (I only get a few hours spare per weekend) to complete but would aid in the final design.  Putting the chassis aside for now as it was mainly complete I concentrated on the microcontroller.  I hadn't touched a microcontroller for 4 years so it was pretty much relearning from scratch.

The first thing to learn was MPLAB X.  I could have stuck with MPLAB 8 but it was time to move on.  I also had invested in a PicKit 3 as a serial port wasn't an option on any of the laptops I wanted to use for development.  I used a simple "blink the leds" assembly program as the trial experiment.  

I soldered up a little PicKit 3 breadboard header and cable, plugged everything in a hoped.  I fell down the usual holes along the way (power from board or from pickit for example) and got burnt by having to be strict on the formatting in the MPLAB editor.  Previously the text files could be pretty sloppy and still work with mpasm.  However the formatting rules made me do things the proper way, which saved me time when I came back after a week or so to review some code.  

I also jumped pic models to a pic16f628.  That's right, I upgraded to a ~10 year old pic.  One day I'll join the real world.  Not having to have an external timing crystal (and getting two pins back) and the comparator module onboard were a big plus.  Also it was a very simple cutover from the pic16f84.  Finally I could buy (and did) 5 pic16f628 chips for $10 off ebay.  This means I have enough for this project and a few others so any investment in time in learning to program this model would pay off.  This did mean that C was pretty much out of the picture.  However I liked learning how to do things in assembly.  I enjoy having that real low level knowledge of what is going on even if the setup on some features (eg pwm) can get a bit messy.

I started development on a Windows 7 desktop.  After awhile I moved onto a linux laptop.  The only issue I had was the include statement.  In Linux (which is case sensitive) the include file is in capitals.  Everything else was fine.  So with MPLABX and the PicKit 3 sorted out it was time to do some real programs.

No comments: