Can someone point me to an SPI example for the avr?

I found this one, but it doesn’t seem correct:


It defines the pins as:

#define DD_MOSI     PINB3

#define DD_SCK     PINB5

#define DDR_SPI    PORTB


While the roboaudio defines the pins as:

MISO      Port B.3                SPI - Master In Slave Out

MOSI     Port B.2                SPI - Master Out Slave In

SCK        Port B.1                SPI - Clock

SS           Port B.0                SPI - Slave Select


By the way, is it possible to access the SPI interface on a regular robostix?

Has anyone tried or can point to an example of emulated SPI (or another solution in case robostix PINs are not accessible)


I’m trying to interface a parallax compass:

The examples use the PBasic SHIFTIN and SHIFTOUT commands to emulate SPI (so it appears).



Brian Gregory