This is only a preview of the October 2004 issue of Silicon Chip. You can view 22 of the 104 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Articles in this series:
Items relevant to "SMS Controller, Pt.1":
Items relevant to "RGB To Component Video Converter":
Items relevant to "USB Power Injector":
Articles in this series:
Purchase a printed copy of this issue for $10.00. |
Stan’s fallen in love again . . .
This new PICAXE-08M
is a wee ripper!
by Stan Swan*
As featured in the September 2004 “SILICON CHIP” “Rudolph” project,
UK maestros Revolution Education have launched a new addition to
their low-cost PICAXE range; the 8-pin PICAXE-08M (M for Music?).
I
t’s perhaps indicative of the white-hot rate of change
in electronics that the PIC12F683 engine on which the
PICAXE-08M is based was itself only announced by
MicroChip earlier this year. From planning to market in
only a few months!
Twice the power – but at only a small cost increase? If
only petrol were as obliging. This new DIP8 sized chip is
a deceptively tiny powerhouse that’s now quite capable of
very serious application.
Note: The 08M will need the latest Programming Editor
(Ver 4.1.2 or higher)– it’s a free 23Mb download from www.
picaxe.com – a patch to Ver 4.1.4 is available too .
PICAXE-08M features include:
• Drop-in replacement for PICAXE-08
• 8MHz or 4MHz operation
• Twice as much program/data memory (256 bytes,
about 80 lines of source )
• Interrupts supported (SETINT)
• PEEK and POKE to 48 bytes “RAM” (SFR)
• Three 8-bit/10-bit analog inputs
• IR receive and transmit (enhanced SIRC protocol)
• Up to 4800 baud serial using SERIN/SEROUT
• Up to 9600 baud serial transmit using SERTXD
• Continuous PWM out (1 channel)
• Continuous Servo outputs (4 channels?)
• DS18B20 temperature sensor support
• One-Wire Serial Number support
• TUNE and PLAY command
• 2.5V to 5.5V operation
To put this new fire breather in perspective, below is an
updated summary of the Picaxe family, along with their
associated PIC “engines”.
All enjoy the usual wide supply voltages (<3-5½V), 4MHz
clock and direct ~20mA output drive but larger versions
have dedicated input or output pins rather than the versatile I/Os of the ’08/08M, can be wound up to 8 (or even
16) MHz and recognise more enhanced commands. For
many purposes it seems the 08M is now the chip of choice
but power users will probably find the greater memory of
the18X more appealing.
Perhaps the easiest way to get to initial grips with the
08M is to just swap it out in a past 08 circuit, with code
tweaked to suit enhanced features.
We’ve altered the ’08 NTC data logger (SILICON CHIP,
September 2003) to exploit the greater EEPROM space,
larger code memory and 8-bit ADC.
The ’08M is of course further capable of reading DS18B20s for direct Celsius temperatures but the ~$10 bill of
materials for the thermistor version will no doubt appeal for
simple applications and tight budgets. Here’s the revised
program, available for download via www.picaxe.orcon.
net.nz/data08m.bas
Thanks to SERTXD, stored data will be fed back out
(for F8 terminal display etc) via the normal three-wire
programming cable and values will also be displayed as
collected in real time.
A simple lookup table could relate NTC readings to temperature but for more ambitious applications you would
probably use the DS18B20.
PICAXE FAMILY COMPARISON
Name Mem
I/O
(Pins) lines
Out
pins
Inputs
ADC
(Low)
Data
mem.
08
08M
18
18A
18X
28A
28X
40X
1-4
1-4
8
8
9
8
9-17
9-17
1-4
1-4
5
5
5
8
0-12
8-20
1L
3H
3L
3
3
4
0-4
3-7
128-prog
256-prog
128-prog
256
256+I2C
64+256
128+I2C
128+I2C
40
80
40
80
600
80
600
600
44 Silicon Chip
5
5
13
13
14
20
21
32
Polled
Interrupt
Yes
Yes
Yes
Yes
Yes
Yes
PIC
type
12F629/675
12F683
16F627
16F819
16F88
16F872
16F873A
16F874
Cost $AU)
(approx)
$4
$5
$10
$14
$15
$20
$28
siliconchip.com.au
PICAXE 08M BASIC LISTING - DATA08M.BAS
(Also downloadable from:
www.picaxe.orcon.net.nz/data08m.bas)
‘DATA08M.BAS = NTC temp.datalogger-Picaxe-08M version Ver 1.0 30/08/04 Stan. SWAN
‘Program a “hi res” enhancement of lo res datalog8.bas shown Sept.’03 SiChip article
‘NB-this further enhances orig.08 version with 08M “SERTXD” cmd feeding serial data
‘out via normal 3 wire progr.lead <at> 4800bps & displays via editor F8 inbuilt terminal
‘============================================================================================
‘When “08M” powered up, any prior stored EEPROM values sent SERTXD pin 0 serial data
‘-also suit 4800bps display via any term. program -LCD,F8,StampPlot- or.csv Excel too.
‘NB-Gives you 30secs to turn unit OFF before fresh storage begins & thus progressively
‘wiping existing values ! For security however this data can’t easily be bulk erased
‘***BUT CARE - BE PROMPT ! REPROGRAMMING/RELOADING “08M” TOTALLY WIPES DATA TOO ****.
‘As set up logs NTC temp every 60 secs for ~2 hrs. Alter WAIT value (or SLEEP)to suit?
‘--------------------------------------------------------------------------------------------------------------------------------------------------------------------‘PICAXE08M has hi-res data values 0-255(via “readadc” command),but also READTEMP for
‘direct DS18B20 Celsius readings! Both 08 & 08M values stored in program space. Care !
‘If power saving needed use SLEEP instead of WAIT ex. 26x2.3secs ~1min delay (+/- 1% )
‘Alter to suit.Ex. Sleep 391 =128 x 1/4 hr =32 hrs.Some interpreter o’head/drift noted
‘128 readings,so <at> 1/min ~2 hrs, /5 min ~10 hrs, /30 min ~2.5 days,& /60 min ~5 days
‘NB- sensor thermal lag means there’s little point sampling faster than every minute !
‘Solderless “PICNIK” mini breadboard setup pix => www.picaxe.orcon.net.nz/pcsx08m.jpg
‘Program hosted=> www.picaxe.orcon.net.nz/data08m.bas. ASCII art schematic below
‘--------------------------------------------------------------------------------------------------------------------------------------------------------------------‘ SERTXD
Typical temp. readings/readadc values
‘ & piezo
- - - - - -ve rail
0 Celsius
11
‘ Ch.0 _____ Ch. | |
4
21
‘ - | ___ | 2 LED 47k
8
32
‘ ------ | |_______| |
12
43
‘ |Picaxe| |_______________|
16
53
‘ | 08M | Ch.1 ADC
|
20
64
‘ -----100k
24
75
‘ +
NTC
28
86 etc
‘|||
3-5 V
‘Usual 3 wire
+ + + + + + +ve supply
NOTE - Temp values approximate
‘prog.input
& may need calibration your NTC
‘--------------------------------------------------------------------------------------------------------------------------------------------------------------------‘READ/PLAYBACK ROUTINE
pause 100
‘sertxd wakeup to avoid initial junk?
sertxd(“PICAXE-08M NTC Temp.Datalogger “)
‘ Title header
for b0=0 to 127
‘stored data values readout to terminal or LCD
read b0,b1
‘polls & reads out stored EEPROM values ( .csv)
sertxd (#b0,44,#b1,” “)
‘Values <at> prog.pin,+ ASCII comma(44) for Excel .csv
high 2
‘LED at output 2 on to confirm data readout
next b0
‘read next stored EEPROM value as SERTXD serial out
wait 30
‘30 secs “reading” delay -modify if too short etc
low 2
‘LED off shows reading over, & new data run starting
‘--------------------------------------------------------------------------------------------------------------------------------------------------------------------‘WRITE/DATA LOGGING ROUTINE
for b0= 0 to 127
‘begin 128 data readings <at> time set by SLEEP/WAIT
sound 0,(75,10)
‘Beep to alert data logging commencing
pulsout 2,500
‘brief flash from pin 2 LED indicates datalogging
readadc 1,b1
‘Hi Res (8 bit) read NTC at Pin 1 Voltage divider
sertxd (“ “)
‘gap as usual 10=CR,12=FF(=cls),13=LF nogo with F8?
sertxd(#b0,44,#b1)
‘Now allows data display (via F8 ?) as gathered too!
write b0,b1
‘sequentially write values to 08M EEPROM locations
wait 60
‘Checks every 60 secs -alter to suit or use SLEEP etc
next b0
‘Gathering automatically stops after 128 samples
high 4
‘Ch.4 green LED on to show data run ended (optional)
‘--------------------------------------------------------------------------------------------------------------------------------------------------------------------Next month: The 08M attacks Picaxe interrupts.
(ASCII art above may be scrambled in print but is neatly aligned on website) *s.t.swan<at>massey.ac.nz
SC
siliconchip.com.au
October 2004 45
|