SPI specs

Hi,

Where can I get the details on the SPI library? I have looked at the code of others but do not understand the structure of the spi_transfer (data) command.

In the IDE select Reference from the Help menu.

At the top of the Reference page, click on the Libraries link.

On the Libraries page, click on the SPI link.

Thanks for the answer, that is helpful. I am a real novice at this, really a died-in-the wool hardware guy.

What is confusing me is in the examples I have found. For instance in the SPIEEPROM example there is this:

spi_transfer ((char) ( address >> 8 ));

What is (char)?

Moderator edit: 8 "fixed".

For instance in the SPIEEPROM example there is this:

I looked. There is no smiley face in the example.

What is (char)?

It's a cast. The function expects one type of input. You have another, similar but not exactly the same, type. The cast tells the compiler that it CAN use your type to satisfy the requirements of the function. Casts must be used with care.

Think of SPI as two 8-bit shift registers. The serial output of one is the serial input of the other and vice-versa. The "Slave Select" line goes to the output latch of the shift register. The "Master" loads a value into its shift register and clocks out 8 bits. While those 8 go out, 8 bits come in from the shift register in the peripheral. On the rising edge of the latch, the peripheral acts on the data.

I don't know where that smiley came from. I thought that I put in an "8" like in the example.

You probably did, only without a space between the '8' and the ')'. The forum software interprets that as a smiley, unless it's wrapped in code tags.

unless it's wrapped in code tags.

Or you explicitly select not to use smileys for the post.

JayBee: Where can I get the details on the SPI library? I have looked at the code of others but do not understand the structure of the spi_transfer (data) command.

Try:

http://gammon.com.au/spi