The Propeller processor chip is the most unique micro-controller on the market today.
Β Itβs not just a single microprocessor, but EIGHT independent processors that share
resources like memory and I/O pins.Β Β And it can do some pretty amazing things that
the rest of the microcontrollers like the Ardino and PICs just plain canβt do!Β Β
(But today, all we want to do it blink an LED)
Each of the processors (called a Cog) has 512 LONGS (32 bits each) (or 2048 bytes) of RAM
memory for itβs own use. In addition, all eight processors share an additional 64K bytes
(16K LONGS) of shared HUB memory. Hub memory is divided into 32K bytes of ROM
(from address 0 to 7FFF, or low memory) and 32K bytes (8092 LONGS) of RAM from 8000 to
FFFF hex).
The ROM section contains the boot loader code, math tables, and character fonts.
RAM is for program storage, variables and stack space.
The hub controls COG access to Propeller resources like memory or I/O pins in βround robinβ
fashion. For more exciting details of the COG and HUB tune into chapter 5 of the manual and
check it out!
The programming language is called Spin, and it too is rather unique.
Today Iβd like to introduce the Parallax βQuickStartβ board.
This is probably the best board to buy to get started with the Propeller chip from Parallax
since it has more useful toys to play with β built in. No need to learn to wire up microelectronic
circuits just to blink an LED!
The normal (necessary) chips are on board, of courseβ¦
P8x32MM Propeller processor chip, 64 KB EEPROM, USB interface chip and voltage regulator
are all there. But this board also has, across the bottom edge, eight βtouch padsβ and eight LEDs
that you can play with immediately.
The Touchpads are used as input buttons. They take a bit more programming support than a regular
switch, but they cost a whole lot less (they are βprintedβ on the circuit board) and work pretty well.
But thatβs a bit more advanced topic (the required Touchpad drivers are available on-line at the
Propeller Object Exchange)
So first off, lets, hook up and get startedβ¦
Step 1: SetUp the QuickStart Board
Physically connecting the QuickStart board to your PC is simplicity itself,
but there IS a catch.
Since this is a USB device, you MUST load the USB drivers before plugging the boardβs
USB cableΒ into your computer.
Driver and editor are downloaded from Parallax at their web siteβ¦
Β Β Β Β Β Β Β Β Β Β http://www.parallax.com/tabid/442/Default.aspx#Software
There is quite a bit of stuff there for free, but all we really need to get started is the
Propeller/Spin Tool Software.
Β Β Β Β Β Β Β Β Β Propeller/Spin Tool Software v1.2.7 (R2) β (Supports Windows 2K/XP/Vista/7.
Β Β Β Β Β Β Β Β Β Requires IE7 or newer Or FireFox 3.0 or newer)
Β Β Β Β Β Β Β Β Β Β Includes software, USB driver, Propeller Manual, PE Kit Labs text and example
Β Β Β Β Β Β Β Β Β Β code, schematics,Β quick reference, Propeller Help and tutorial examples.
Click the download tab, save the file to your hard drive.Β
Before running the setup-Propeller-Tool file, close all other programs that may be
running on your computer.
Then click on the setup program and follow the instructions.Β Pretty normal stuff.
Personally, I install to a custom folderΒ β C:\Prop β instead of the default in the
Program Files folder. Itβs a lot easier to get to and spell(!)
When the setup program finishes, you are all ready to get going.
Step 2: Connecting the QuickStart Board to Your Computer
Itβs USB.Β Just plug it in.
Listen for the two-tone sound that indicates Windows found the device and
watch for the notice that it has located and identified the board.
Also the red and blue LEDS on the QS board (that show communication
Read/Write) will blink as the QS and your computer meet and shake hands.
Thatβs it.
If there are problems,
(usually because somebody plugged in the board before the drivers were loaded)
check Control Panel/system/hardware/device manager page for unrecognized USB devices.Β
Remove any Xed out devices and reinstall the drivers..
T H E N plug the QuickStart USB cable into your computer.Β Β π
Step 3: Programming!
Start the Spin Tool.
Start/All programs/Parallax/Spin Tool should be there now.
(But itβs even easier if you have the shortcut icon on your desktop)
On the left are several important parts β
a browser to let you locate folders on your computer,
and a list of what files are in the selected folder.
Blinking an L.E.D. is the micro controller equivalent of βHello Worldβ.
So thatβs where we startβ¦
I have selected Blinky.Spin as an example, which is loaded into the work area
on the right.
The top line (light yellow) is a comment,
The yellow section is CONSTANT DECLARATIONS.
The first blue section is out main program,
The rest are PRIVATE functions to support that program.
(the colors appear as you declare each section)
CON β CONstants
Sets the system clock speed and mode, and declares several constants.
The values assigned to these words can not be changed by your program.
VAR β VARiables
We donβt have any variables defined for this program, so there is no VAR section.
PUB β PUBlic code block
Spin uses the first code block as the starting point.
This one is named βGoβ
The program blinks an LED attached to pin 7
So Pin 7 direction is set as output (dira [pin] :=1),
and a zero written to that pin (outa [pin] := 1).
A zero means low voltage appears on the output pin.
Writing a one to that pin makes the voltage on the output pin go βhighβ
repeat starts an infinite loop β runs forever β or until the program is changed.
In other words, a loop.
Notice the indentation!
This is the way that you tell Spin how the program is βstructuredβ.
Itβs VERY IMPORTANT.
This program will repeatedly (and in order) calls the PRIvate functions β
TurnOff, Wait, TurnOn, and wait.
Step 4: Running QS-Blinky1.Spin
If you were to type this program in (absolutely as shown here) and RUN it,
(Run/Compile Current/Load Ram β or just press F10)
you would be rewarded by seeing the LED on pin 16 (right most LED on the
QuickStart board)
BLINK!
On and off and on and off andβ¦
Well, maybe that doesnβt sound like the most exciting program ever written.
itβs certainly not a monster robot ready to invade Earth (yet).
But itβs where it all startsβ¦