Learning to program

Back to home page.

Learning to program in BASIC

The first step for students entering our club is to develop some mastery of the programming language "P-BASIC" which we use to control our Parallax microcontrollers. The student begins by setting up a circuit of 6 LED's (light emitting diodes) on an electronic breadboard, each LED controlled by an in/out port of the microcontroller. With LED's the student is able to get immediate visual feedback as he* learns the programming concepts of "commands", "addresses", "subroutines", and "loops".

The student's logical reasoning skills are developed as he* attempts to develop codes which make the LED's flash in specific sequences and patterns described in a series of "blinking puzzles" in a self-paced workbook we've developed.

*(About half of our club members planning to major in engineering are "she's".)

Here is what is needed to begin. A Parallax BS1 rev-D microcontroller (www.parallax.com) is shown which costs about $35. We've used the same ones for years. A breadboard (try www.allelectronics.com for a $4 breadboard) is attached to a piece of hardboard which has some velcro to keep the battery and microcontroller from slipping around. The tools are $2-$3 apiece from Harbor Freight tools (www.harborfreight.com), and everything can be kept in a 12-inch toolbox ($7) from the same place. LED's, resistors and wire have trivial costs.

Circuits with LED's and resistors are wired up. A short ribbon cable connects a header on the board to the microcontroller. Learning how to make the various cable connectors, such as the short ribbon cable shown, is a very, very valuable skill for the engineering student. By far the primary cause of failure of prototype electronic systems is bad connections, not bad design.

With a parallel cable connecting the laptop to the microcontroller (Parallax makes a USB-to-parallel cable if your laptop needs this), this puppy is ready to program. The editor/compiler software is free from Parallax.

Back to home page.