Building Robots at School

October 25, 2009

PIC Assembly Language Using PICBots

Filed under: Uncategorized — dtengineering @ 11:20 am

Assembly language is cool.  Not just because it is the most fundamental level at which one can write a computer program… using the bare hardware instructions of the microcontroller itself… but because it forces the programmer to develop a fundamental understanding of what, exactly, a processor is doing when it is running any program.  Teaching assembly teaches fundamental skills such as binary and hexadecimal representations of numbers, the difference between a bit, byte and word, the importance of interrupts and — most importantly — forces a logical, procedural thought process.
The Set Up Screen From PICBots
Unfortunately there isn’t a lot of material out there to introduce high school students to assembly language, and even less of it is free.  So about ten years ago I started writing some handouts for my students, and in 2003 I consolidated them into a roughly 20-hour introduction to PIC assembly language.  The key to this was a wonderful little software simulation of the PIC 16c74 microcontroller called “PICBOTS”.  (See the post, below, for a download link.)  Unfortunately the company that wrote PICBOTS, Innovatus, has long since disappeared… but their freely downloadable code has survived, and when combined with the equally free MPLAB compiler from Microchip (still very much in business) has kept my worksheets reasonably relevant.  Some of the references to “the RISC chips from Motorola in Apple computers” are a bit dated, but the fundamentals will be sound for a long time to come.

I’ve posted my handouts… about 40 pages worth… here in .pdf format in the hopes that they will be of use to other teachers looking for a low-cost way to introduce low-level computer fundamentals to their students in an intereactive and engaging manner.

1 Binary Worksheet  An introduction to Hexadecimal and Binary
2 DIGITAL LOGIC worksheet How transistors form logic gates, and how logic gates can create useful functions
3 The PIC Microcontroller A brief introduction to the PIC 16f84a Microcontroller
3a The PIC 16f627a Microcontroller Worksheet 3 updated a few years later for the more current 16f627a
4 First MPLAB program Getting started in MPLAB
4c Inside The PIC Microcontroller How compilers create machine code for you… there is no Worksheet 4b
5 Loops and Input Getting into PICBOTS and creating some useful routines — the decfsz command.
6 Shortcuts and Math Cleaning up the code a bit and the subwf command
7 Interrupts I really, really, really like interrupts.  An intro to a very powerful tool and a PICBOTS assignment.
8 Pic Control Stepping away from PICBOTS, how do you get a real PIC to do a something real?
9 PIC Inputs How can you get a real PIC to read a real input?
11b The Sony IR Protocol and PIC BASIC I’m too lazy to program an IR reading code in Assembly, so I used PIC Basic from MELABs.  If you’ve got the cash, though, PIC BASIC PRO, from the same company is much more complete and definitely worth getting.

October 16, 2009


Filed under: Uncategorized — dtengineering @ 10:05 am

Many years ago a company called Innovatus published a neat little program called PICBots.  PICBots allowed people to program a virtual robot inside their computer.  The virtual robot used a PIC 16c74 chip as its brain, and was able to move, stop, turn left, turn right, scan and shoot.  It was a very simple machine in a very simple environment, performing very simple tasks.  As such, it was a great way to teach beginners PIC Assembly Language.  A link to a demo version of PICBots is here.

October 13, 2009

Vancouver, BC and Washington VEX Competition Dates 2009-2010

Filed under: Uncategorized — dtengineering @ 8:38 pm

The competitions are set:

November 7, 2009:  Washington Jump Start Tournament in Redmond Washington (bus trip being planned)
December 12, 2009: BC Season Opener at Gladstone Secondary in Vancouver
January 30, 2010:  Vancouver Island VEX Robotics Competition in Courtenay, BC (bus and ferry trip being planned)
February 27, 2010: Washington State VEX Robotics Championship, Seattle Washington (bus being planned)
March 20, 2010: BC VEX Robotics Championship, BCIT, Burnaby
March 27, 2010: TSA VEX Competition, Seattle

also on the weekend of March 25-27 in Seattle is the Microsoft FIRST Robotics Competition at Key Arena.  Come on out and see the big bots play!

And that’s just the Pacific Northwest.  To register for these events (or others) click here.

Typical bus costs for Vancouver to Seattle, return, are about $50 CDN.  The Vancouver Island trip is an overnighter, and a wee bit more…. unless you’re from Vancouver Island of course!  Should you happen to do particularly well at these tournaments, you might want to keep April 22 to 24th open for the VEX World Championships in Dallas, Texas.

Want more international competition… check out the tournaments in Australia, Brazil, Hong Kong, Singapore, China… even Ontario!  All online at

Blog at