questfish 发表于 2012-11-8 09:28:11

求助 Leonardo的SPI如何用啊 看官网看的一头雾水

求助 Leonardo的SPI如何用啊 看官网看的一头雾水 不知道接到SPI上的3个针如何定义 如何用

弘毅 发表于 2012-11-8 10:53:03

额,可以参考官方以太库中相关的源码,网络扩展板还有SD卡,都是用SPI通信。

ttyp 发表于 2012-11-8 13:35:58

SPI: on the ICSP header. These pins support SPI communication using the SPI library. Note that the SPI pins are not connected to any of the digital I/O pins as they are on the Uno, They are only available on the ICSP connector. This means that if you have a shield that uses SPI, but does NOT have a 6-pin ICSP connector that connects to the Leonardo's 6-pin ICSP header, the shield will not work.

ttyp 发表于 2012-11-8 13:38:12



只能练ICSP上了,具体针脚看上图

questfish 发表于 2012-11-8 13:52:42

官方说明我看了 具体链接到哪个针我也找到了 只不过不知道 如何在程序里面定义那几个针 直接饮用SPI库 不行啊

ttyp 发表于 2012-11-8 14:57:48

看了SPI库和pins_arduino.h里的定义
// Map SPI port to 'new' pins D14..D17
static const uint8_t SS   = 17;
static const uint8_t MOSI = 16;
static const uint8_t MISO = 14;
static const uint8_t SCK= 15;

应该没问题啊,是否选择正确了板子,再检查线序

questfish 发表于 2012-11-8 15:02:28

嗯 试过了 放弃了 老老实实用ATmega328
页: [1]
查看完整版本: 求助 Leonardo的SPI如何用啊 看官网看的一头雾水