sacosaco 發表於 2007-9-6 13:07:44

有關srf02 輸了入了2bytes的資料

請問一下我利用單晶片 傳輸為9600bps 送01 與80 的資料,之後又送01 與94的資料,可是這樣 我的srf02 並不會動
,不然就是偶爾送出一些資料,請問一下 要如何送資料 srf02才會動,而他送出的結果,要如何去解讀,謝謝

sacosaco 發表於 2007-9-6 13:09:42

我使用的是盛群的晶片,我在01和81之間 有加delay,讓資料傳輸值正確

sacosaco 發表於 2007-9-6 13:11:08

在送出01與81後,做一個超過67ms的delay 在送後面的資料

wallace_tsou 發表於 2007-9-6 13:28:46

是用RS-232吧?

9600bps傳送1個byte需時1ms,所以第二個byte要在1ms之後才能送。除非有硬體的buffer,但buffer滿了仍有1ms的工作時間。
而您所說的67ms應是指接收器需要反應的最小時間吧。並不是可以傳送的最短時間。

[ 本帖最後由 wallace_tsou 於 2007-9-6 13:34 編輯 ]

sacosaco 發表於 2007-9-6 13:31:55

傳出資料 經由hin232 在送出rs232

wallace_tsou 發表於 2007-9-6 13:38:45

可以利用PC的超極終端機來看接收字是否正常。
最好用示波器看看傳輸的信號是否有正確。

sacosaco 發表於 2007-9-6 13:40:17

訊號正確,不經由SFR02送出的話, 他輸出的資料 確定是 01 81 與 01 94

imas 發表於 2007-9-8 01:00:44

原帖由 sacosaco 於 2007-9-6 13:07 發表 http://www.robofun.net/forum/images/common/back.gif
請問一下我利用單晶片 傳輸為9600bps 送01 與80 的資料,之後又送01 與94的資料,可是這樣 我的srf02 並不會動
,不然就是偶爾送出一些資料,請問一下 要如何送資料 srf02才會動,而他送出的結果,要如何去解 ...

Serial Communication
To use the SRF02 in Serial mode, make sure the Mode pin is connected to 0v Ground.
Serial data is fixed at 9600 baud 1 start, 2 stop and no parity bits. Serial data is a TTL level signal - It is NOT RS232. Do not connect the SRF02 to an RS232 port - you will destroy the module! If you would like to connect the SRF02 to your PC's RS232 port, you must use a MAX232 or similar device. It can also be used (in I2C mode) with the USBI2C module to make a self powered USB ranger, see the examples page for details. Many small controllers such as the OOPic, Stamp BS2p, PicAxe etc. as well as a wide variety of micro-controllers have serial ports. To communicate with the SRF02, you simply need to send two bytes, the address of the SRF02 (factory default is 0) and the command. The default shipped address can be changed by the user to any of 16 addresses 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, or 15, therefore up to 16 sonar's can be used.
基本上,SRF02 的預設值應該是0,也就是說傳送的資料應該是 00、80,如果需要馬上取出值的話,建議您使用00、83,
關於兩個命令的時間,基本上完全不用延遲也可以取得資料。

sacosaco 發表於 2007-9-10 10:49:25

謝謝,我解決我的問題了,我延遲的原因是因為,如果你一次傳2bytes的資料,在單晶片測出的結果 有錯誤,有delay才能保證資料的正確性
頁: [1]
查看完整版本: 有關srf02 輸了入了2bytes的資料