![]() |
Help with Arduino and SPI
I'm slowly learning Arduino, and I'd like some help interfacing to an SPI device. The device is connected to the proper pins on an Arduino Uno. I understand in concept how it works. I need to send it 16 bits: 8 bits to specify the register, and 8 to make it do something based on the tables in the reference document. And the most significant bit comes first. However, I'm a little hung up on the exact code to make it start doing something. I've only gotten as far as defining all the registers as constants by their hex values. Is that correct? Can anyone who is familiar with such things perhaps provide a simple code example? I searched and couldn't find anything similar that made sense to me.
|
Re: Help with Arduino and SPI
Here's some code from my optical mouse project. mDataPin and mClockPin are just integers that refer to the specific pins being manipulated.
Code:
/** |
Re: Help with Arduino and SPI
I sort of understand the above with the exception of exactly what you're doing with the bit shift.
Has anyone here used the SPI library with Arduino? |
Re: Help with Arduino and SPI
Try getting a copy of "Arduino Cookbook" [O'Reilly Books] by Michael Margolis
[ISBN978-0-596-80247-9] page 418 ..Chap 13 / problem 13.8 Driving Multidigit, 7-segment Displays Using SPI ... this might be helpful to understand and also for code ... |
Re: Help with Arduino and SPI
FYI - "Arduino Cookbook" chapter 13 has multiple examples of Communicating Using I2C and SPI with multidigit segmented displays
|
Re: Help with Arduino and SPI
Quote:
|
| All times are GMT -5. The time now is 23:27. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi