Re: 在 33f 上使用 spi
|
||||
---|---|---|---|---|
版主
|
在使用 dsPIC33F128MC804 的 SPI 界面之前,你一定要先看一下 dsPIC33FJ Reference Manual 裡的 Section 18. Serial Peripheral Interface (SPI) (上官網找一下就有)。
裡面有一暫存器 SPI1CON1 一定要看輕一定要看清楚他的設定方式。 其中 MSTEN: Master Mode Enable bit是設定: 1 = Master mode 0 = Slave mode 還有兩個位元 : SMP & CKE 是設定 SPI 的 Mode 的: SMP: SPIx Data Input Sample Phase bit Master mode: 1 = Input data sampled at end of data output time 0 = Input data sampled at middle of data output time Slave mode: SMP must be cleared when SPIx is used in Slave mode CKE: SPIx Clock Edge Select bit(1) 1 = Serial output data changes on transition from active clock state to Idle clock state (refer to bit 6) 0 = Serial output data changes on transition from Idle clock state to active clock state (refer to bit 6) 有關 SPI 的參考範例可以參考底下的教育訓練裡的 SPI 章節,至少你要清楚你的 SPI Slave 是設定再哪一種 Mode 下,否則 Mode 設錯會出一些意想不到的問題的: http://www.microchip.com.tw/modules/w ... glefile.php?cid=4&lid=229
發表於: 2010/1/28 9:51
|
|||
|
在 33f 上使用 spi
|
||||
---|---|---|---|---|
新會員
|
小弟想用 dsPIC33FJ128MC804 經 spi 介面去獲取 加速度传感器 ADIS16209 的數據, port RB12 為 SDI1, port RB11 為 SDO1, port RB13 為 SCK1, mcu 為 spi master, adis16209 為 spi slave
可是, 如何設定 adis16209 為 slave 呢? 希望各位幫忙!
發表於: 2010/1/25 19:30
|
|||
|