哪位大神能详细解释一下# 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


友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
9条回答
zhiguangqi
2020-02-07 23:27
yklstudent 发表于 2014-3-29 19:40
这个用的人应该不是很多吧
看CCS帮助手册应该多少也能懂点
#use spi(DI=PIN_B1, DO=PIN_B0, CLK=PIN_B2, EN ...

我用的5.010
你写的那个我试了,怎么都不行。我看了下汇编,它走的还是硬件通道

一周热门 更多>