Getting Started With
The PICAXE-08M Chip
by Ron Hackett
The PICAXE-18X Chip
In Part 1 of this series, we introduced the PICAXE-18X
microcontroller, provided a brief introduction to PICAXE
programming, and constructed a simple “Hello World”
project to demonstrate the simplicity of the PICAXE system.
As promised, in Part 2 we will focus on interfacing the
PICAXE-18X with a Hitachi HD44780-based LCD display.
Finally, in Part 3, we will add a 12 or 16 key matrix keyboard
and a piezo beeper to complete our I/O terminal.
At the end of Part 1, we added an
input switch to our “Hello” circuit and
posed a challenge to write a program
to control the blinking of the two LEDs
with the switch without using the
PICAXE “Button” command; each time
the switch is pressed, the LED that is
currently lit should turn off and the
FIGURE 1. One possible solution to the programming challenge.
This program runs on a PICAXE-18X at 4 MHz.
It toggles LEDs on outputs 6 & 7 in response to a switch-press.
The PICAXE-28X Chip
' Constant Definitions
symbol LED6 = output6
symbol LED7 = output7
symbol pbsw = input2
symbol up = 0
symbol down = 1
' LED on output6 (pin 12)
' LED on output7 (pin 13)
' push-button switch on input2 (pin 1)
' input2 held to Ground when switch up
' input2 goes high when switch pressed
' Main Program
The PICAXE-40X Chip
' start with LED6 turned on
' (& LED7 turned off by default)
main: if pbsw is up then main
' loop here until switch press
' note: "is" is equivalent to "="
' switch pressed, so toggle LEDs
' delay 25mS to avoid switch-bounce
tarry: if pbsw is down then tarry ' loop here until switch release
' do it again, forever