Circuits and modules for GCSE Electronic Products
PICAXE Blocks Zip File ©Christopher Leigh
PICAXE microcontrollers are special versions of PIC chips by Microchip.  They are capable of in-system programming thus avoiding the dangerous procedure of repeated removing and re-inserting of the chip for programming in a special burner.  My experience is that the legs soon fall victim and drop off.  A simple serial to stereo jack cable is required for programming.  Software is available free from Revolution Education. Here are two documents to help you learn about using PICAXE: What is a Microcontroller and Using the PICAXE microcontroller.
PICAXE 18 Core
This block provides all outputs on the right and all inputs on the left.  Also on the left of the block are three outputs available for polling matrix keyboards.  The stereo jack socket (Rapid code 20-0137) is used for programming the Picaxe.  Note that you must not use more than 6volt to power this circuit.  The block can be used with all variations of the Picaxe18 chip. Here's a simple program which will flash an LED connected to output 7:
main:	high 7		'make output 7 high
	pause 1000	'wait 1 second
	low 7		'make output 7 low
	pause 1000 
	goto main
PICAXE 08
The PICAXE08 microcontroller is a special version of the 12F629 by Microchip.  It is capable of in-system programming; a simple serial to stereo jack cable is all that is required.  This block provides 4 outputs on the right and 4 inputs on the left.  Three of these are shared and can be set either as inputs or outputs.  Note that you must not use more than 6volt to power this circuit.
8 LEDs in a Line
All 8 outputs from the PICAXE 18 are linked to Light Emitting Diodes.  180R is ok as the LED resistor if you are using 4.5v or 5v.  On 6 volts you should use a higher value, say 220R.  These resistors allow quite high LED currents in order to produce a bright display when it is rapidly changing – prototyping Christmas Lights or what have you. Here's a program to flash all the LEDs in sequence:
symbol	led = b0		'define variable "led"

main:	for led=0 to 7	'start a for ... next loop 
	high led		'switch output high
	pause 300		'wait for 0.3 second
	low led		'switch output low
	pause 300		'wait for 0.3 second
	next led		'end of for ... next loop
	goto main
8 LEDs in a Circle
This time the LEDs are in a circle – otherwise there is no change from the block given above.  Note that output 7 is connected to the central output of the block so that you could add another output block or a driver block followed by an output block.  You could connect other output blocks to the PICAXE if you wanted, such as a piezo output device to use the sound command.  See the Sound page. This program turns the leds on one after the other, and then turns them off again:
symbol	led = b0		'define variable "led"

main:	for led=0 to 7	'start a for ... next loop 
	high led		'switch output high
	pause 100		'wait for 0.2 second
	next led		'end of for ... next loop
	for led=0 to 7 
	low led		'switch output low
	pause 100		'wait for 0.2 second
	next led
	goto main
7 Segment Display
All 8 outputs are connected to a 7 segment display.  It is a common cathode type so that the segments are lit if the PICAXE outputs are high.  This makes it easier to work out which segments make which number.  Output 0 of the PICAXE is connected to the decimal point and on to the output of the block.  Outputs 1 to 7 match segments a to g of the 7 segment display.  If you use a high efficiency display then you can use much higher resistor values – say 1.8k.  A dual 7-segment display is shown on page 3. The following program uses a seven segment display block to show a counter. As it stands it only goes from 0 to 3.
main:	let pins = %01111110	'digit 0
	pause 250			'wait 0.25 second
	let pins = %00001100	'digit 1
	pause 250			'wait 0.25 second
	let pins = %10110110	'digit 2
	pause 250			'wait 0.25 second
Piezo Output
The PICAXE system can automatically create noises of different frequencies by use of the sound command. The first number provides the pin number. The next number is the tone, followed by the duration.  The piezo sounder used is Rapid part no 35-0215.  You could also use a 64R loudspeaker, though you may need a driver.  More output blocks are shown on page 3.
main:	sound 4,(50,100)	'make sound on 4,freq 50,length 100
	sound 4,(100,100)	'make sound on 4,freq 100,length 100
	sound 4,(120,100)	'make sound on 4,freq 120,length 100
	pause 1000	'wait 1 second
	goto main		'loop back to start
Single Key Input
This block is a simple bottom push-to-make switch (Rapid part no 78-0260).  Other input blocks are shown on page 2.  It is connected to input 1.  With the PICAXE core unit as shown you can only use inputs 0,1,2,6,7.  Here's the program:
main:	if input1=0 then flash1	'jump if input is low
	high 7			'output 7 on
	goto flash7
flash1:	high 1			'switch pressed
flash7:	pause 200			'wait 0.2 seconds
	let pins=%00000000		'all outputs off
	pause 200			'wait 0.2 seconds
	goto main			'jump back to start






This site is a member of WebRing.
To browse visit Here.