Re: 關於i2c
|
||||
---|---|---|---|---|
中級會員
|
這是我照說明操作寫的,Debugger正常,但是寫入IC卻無動作
請問是哪裡有出問題 #define OSC_CLOCK 10 void DelayUs(long A); void Dir_DQ_L(void){ Dir_DQ=0; } void Dir_DQ_H(void){ Dir_DQ=0; DelayUs(1); Dir_DQ=1; } void DQ_W (void){ Dir_DQ=0x0C; // Dir_DQ_L; Dir_DQ_H; DelayUs(120); } void main(){ int j; Dir_DQ = 1; DQ = 1; DelayUs(1); DQ = 0; DelayUs(480); do{ DQ = 1; while(!DQ); DelayUs(60); DQ = 0; DQ = 0; DelayUs(240); }while(DQ==1); DelayUs(420); DQ=0xAA; for(j=0;j<8;j++){ int j; Dir_DQ_L; Dir_DQ_H; DelayUs(120); DQ=1; } for(j=0;j<8;j++){ DQ=0; DelayUs(1); DQ=1; DelayUs(15); DelayUs(120); }
發表於: 2009/8/14 3:54
|
|||
|
Re: 關於i2c
|
||||
---|---|---|---|---|
資深會員
|
整個的操作大概就是
發表於: 2009/8/14 1:07
|
|||
|
Re: 關於i2c
|
||||
---|---|---|---|---|
資深會員
|
;需要 3 byte ram
發表於: 2009/8/14 1:06
|
|||
|
Re: 關於i2c
|
||||
---|---|---|---|---|
資深會員
|
;mcu 開機後 wire_bus 是 input ,pull high
發表於: 2009/8/14 1:05
|
|||
|
Re: 關於i2c
|
||||
---|---|---|---|---|
資深會員
|
1821 datasheet 的 figure 7 figure 8 figure 9 看完,及那段說明看種就會操作了
這是 一線的溫度 ic ,線上mcu 及 ic 都是是 pull high 也就是說兩邊常態都是 input ,bus 上一直是 high 。 mcu 或 ic 將 bus 拉 low 之後,bus 上就會一直為 low ,直到拉low 的那一端放開。 當看到 low 時就能知道另一方有事要處理。
發表於: 2009/8/14 1:02
|
|||
|
Re: 關於i2c
|
||||
---|---|---|---|---|
中級會員
|
不知道我還可以寄DS1821你嗎?
因為我研究了一大段時間都沒辦法搞定 可以麻煩你幫我一下嗎
發表於: 2009/8/13 21:49
|
|||
|
Re: 關於i2c
|
||||
---|---|---|---|---|
管理員
|
你好,
就我的認知 , 應該是利用軟體控制 I/O 的 Timing 來讀取 DS1821 的溫度就可以了. 你可以自己試試看 ! 如果網站的各位英雄都沒人可以給你範例而你又無法完成 , 那麼你可以寄一顆 DS1821 給我 , 有空我可以 Try Try 看啦 :) Address : 北市民權東路 3 段 4 號 12 樓 , 何仁杰收 ...
發表於: 2009/8/9 9:45
|
|||
|
Re: 關於i2c
|
||||
---|---|---|---|---|
中級會員
|
嗯嗯
我懂 calvin 大哥的意思 也知道不能使用I2C做連接 難道要自己建一個模組來呼叫DS1821嗎?? 可是該如何設計呢???
發表於: 2009/8/7 21:26
|
|||
|
Re: 關於i2c
|
||||
---|---|---|---|---|
管理員
|
你好,
DS1821 應該是個 1-Wire interface 的溫度 Sensor 吧 ! 他是沒辦法用 I2C 直接和它 interface 並且通信的 . 一般都使用 I/O 直接經由程式 control 的方式來與其介面與控制 . 最好用 Open Drain 的接腳. 一般 PIC16F / PIC18F 的 RA4 是個不齰的選擇 . 至於範例 , 目前手中沒有 ! 就看其他的熱心朋友門是否能提供啦 :) Regards,
發表於: 2009/8/7 21:17
|
|||
|