Thursday, July 19, 2007

SPI using picaxe

Tonight is the first time that i have successfully used the SPI protocol with a Picaxe chip (not on a 28X1 or a 40X1 that have it as part of their software library). To be honest, i hadn't tried before today - just didn't get around to it. But this is really a useful thing. In the example code below, i controlled the resistance of one of the pots on an MCP42100 IC.

The picture above shows outputs 0, 1 and 2 of the Picaxe 08-M being used as the CS (chip select), SCK (spi clock) and MOSI (master out, slave in) lines. There is no MISO (master in, slave out) line because the Picaxe chip can only write to the digital pot (as opposed to being able to read from it).

It really has been a productive evening. This would not have been possible without P. H. Anderson's page on using SPI with the Picaxe chips (a true master!). Thanks.

[expand / collapse code]


digital potentiometer said...

The 8-pin PICAXE-08M is priced below GB£2 and is often chosen as an entry-level option as it lends itself to easy prototyping.