哪位大神能详细解释一下# USE SPI()的用法啊?

2020-02-07 09:39发布

哪位大神能详细解释一下# USE SPI()的用法啊?


Syntax:
#use spi  (options)



Elements:
Options are separated by commas and may be:

MASTER
Set the device as the master.

SLAVE
Set the device as the slave.

BAUD=n
Target bits per second, default is as fast as possible.

CLOCK_HIGH=n
High time of clock in us (not needed of BAUD= is used).

CLOCK_LOW=n
Low time of clock in us (not needed of BAUD= is used).

DI=pin
Optional pin for incoming data.

DO=pin
Optional pin for outgoing data.

CLK=pin
Clock pin.

MODE=n
The mode to put the SPI bus.

ENABLE=pin
Optional pin to be active during data transfer.

LOAD=pin
Optional pin to be pulsed active after data is transferred.

DIAGNOSTIC=pin
Optional pin to the set high when data is sampled.

SAMPLE_RISE
Sample on rising edge.

SAMPLE_FALL
Sample on falling edge (default).

BITS=n
Max number of bits in a transfer.

SAMPLE_COUNT=n
Number of samples to take (uses majority vote).

LOAD_ACTIVE=n
Active state for LOAD pin (0, 1).

ENABLE_ACTIVE=n
Active state for ENABLE pin (0, 1).

IDLE=n
Inactive state for CLK pin (0, 1).

ENABLE_DELAY=n
Time in us to delay after ENABLE is activated.

LSB_FIRST
LSB is sent first.

MSB_FIRST
MSB is sent first.

STREAM=id
Specify a stream name for this protocol.

SPI1
Use the hardware pins for SPI Port 1

SPI2
Use the hardware pins for SPI Port 2


友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
8条回答
zhiguangqi
1楼-- · 2020-02-08 15:11
error_dan 发表于 2014-3-30 22:26
亲,这不是CCS的问题,是C的问题~

给个建议,如果是宏的问题,可以让编译器输出预编译文件,这里面宏都已经展开 ...

谢谢回电
zhiguangqi
2楼-- · 2020-02-08 17:50
yklstudent 发表于 2014-3-30 21:50
看手册上提示 可以用内部硬件SPI模块 也可以是模拟SPI
关键看你怎么设置使用了
最上面显然是软件模拟SPI ...

好的,谢谢了

一周热门 更多>