Re: 關於 C30範例 [I2C slave端傳2 bytes] & [Master端收 2 bytes] 的問題
|
||||
---|---|---|---|---|
版主
|
http://www.microchip.com.tw/modules/w ... glefile.php?cid=4&lid=229
dsPIC30F Peripheral Module Training 裡面有一I2C的教材及用 dsPIC30F4011 寫的 I2C Master & I2C Slave 的程式。
發表於: 2008/10/31 10:00
|
|||
|
Re: 關於 C30範例 [I2C slave端傳2 bytes] & [Master端收 2 bytes] 的問題
|
||||
---|---|---|---|---|
新會員
|
我也在做两设备间I2C通讯,一起交流一下吧,我的email:
thunder.wang@emersonnetwork.com.cn
發表於: 2008/10/30 23:21
|
|||
|
Re: 關於 C30範例 [I2C slave端傳2 bytes] & [Master端收 2 bytes] 的問題
|
||||
---|---|---|---|---|
新會員
|
請問一下 Master - Slave
如果 Slave 連續多筆資料發送 給Master 讀取 請問I2C機制 上還需要注意哪些.例如控制.狀態暫存器..等
發表於: 2008/10/23 11:13
|
|||
|
Re: 關於 C30範例 [I2C slave端傳2 bytes] & [Master端收 2 bytes] 的問題
|
||||
---|---|---|---|---|
新會員
|
這幾天還是摸索不出來..整理如下
*Master端 操作 *Master接收端從Slave端傳送端無法連續讀取.多筆資料. *Slaver端 送2Bytes
發表於: 2008/10/23 11:09
|
|||
|
關於 C30範例 [I2C slave端傳2 bytes] & [Master端收 2 bytes] 的問題
|
||||
---|---|---|---|---|
新會員
|
關於 C30範例 [I2C slave端傳2 bytes] & [Master端收 2 bytes] 的問題
Dear 先進 請教一下 參考 C30_Modules 範例 欲將程式修改功能如下 1.slave 傳送 16bits ADC_value 值 to Master 2.Master 正確讀取 slave 傳來16bits slave ADC_value 3.目前程式 只可以 1bytes slave傳 與 Master讀 4.無法一次連續傳送 2bytes 的資料以上 , 試了好幾天,還是不行,請問先進 該如何做 才能順利 連續傳送 2bytes 的資料以上 與 連續接收 2bytes 的資料以上.完整程式如附件..謝謝 ***************************************** void _ISR _SI2CInterrupt(void) { IFS0bits.SI2CIF = 0 ; DummyByte = I2CRCV ; I2CSTATbits.I2COV = 0; if (!I2CSTATbits.D_A && I2CSTATbits.S ) // address & stop bit { I2CState = 0 ; // Reset I2C State !! if (I2CSTATbits.R_W ) // Read Command { if(tmp_1==0){ I2CTRN = ADC_Value; I2CBuf[0]=I2CTRN; tmp_1++; } if(tmp_1==1){ //I2CTRN = ADC_Value>>8 ; I2CBuf[1]=I2CTRN; tmp_1++; } if(tmp_1>=2){ tmp_1=0; I2CCONbits.SCLREL = 1; /* Release the clock } } else // Write Command { I2CState = 1 ; Nop( ); //I2CBuf[I2CIndexAddress]=I2CRCV; } } else if ( I2CSTATbits.P ) //如果是 STOP , 直接將 I2CState 清除後結束 { Nop(); I2CState = 0 ; }//while (WaitLoop < 1000) ; else // Write Command { if ( I2CState == 1 ) // Internal address byte { I2CState = 2 ; I2CIndexAddress = DummyByte ; if ( I2CIndexAddress >= 63 ) I2CIndexAddress = 63 ; } else if ( I2CState >= 2 ) { I2CBuf[i++] = DummyByte ; if (i>6)i=0; } else Nop(); } } 完整程式如附件 Attach file: Link only for registered users Link only for registered users
發表於: 2008/10/22 16:33
|
|||
|