Interfacing with max187

Beware that this kind of thing could be headache-inducing for someone new to electronics. REad the bottom part of this post on SPI to get started on that migraine. Or it might be really easy, who knows?

Heh. That's my post. Once I got past the little problem with the board, SPI wasn't too bad.

I'm not exactly new to electronics, but I am new to SPI. Here is the thing that caused me problems:

SPI has four modes determined by two parameters, clock polarity (CPOL) and clock phase (CPHA). The standard doesn't really specify which to use, so different vendors come up with different ways of doing it. Of course #4 was the one that finally worked for my device.

The tutorials page http://www.arduino.cc/en/Tutorial/HomePage has intros to using SPI on a couple of peripherals. That's what I used to get started. Once I get the code cleaned up a bit I plan to post my code for the DS1722 to the playground, since it's a bit different than the other two devices in the tutorials.

Oh yeah, and if you have an Arduino NG you'll either need to remove the LED or relocate R13 before the standard SPI pins will work (specifically the clock). You should be able to use SCK from the ICSP header, but I haven't tested that one (and I've already modified my board so I can't test it).

I suspect that if you used a different pin for the SCK you'd have to bit-bang SPI instead of using the ATmega's built in hardware, and that might not be fun.

I got interested in the Arduino because of SPI - there are lots of peripherals out there with SPI interfaces. I've seen digital pots, temp sensors, FAT filesystem controllers with SD/MMC interfaces, UARTs, thermocouple interfaces, digital IO interfaces (add an extra 28 IO lines to your project), etc. My personal goal is to talk to a direct digital synthesis chip (Analog AD9954) to directly generate RF signals on the 2m ham band.

Don't forget, you can put the ATmega into slave mode and talk to it with another ATmega via SPI.

It's a bit complex, but it's too cool not to try. (:

-j