轉信站: GIBBS!news2.ncku!ccnews.ncku!news.ccns.ncku!news.mksh.phc!news.nsysu!Sp Origin: mobbs.stut.edu.tw ※ HaWay wrote: > ※ RENA7 (PANDA-Z) wrote: > > 要能夠透過rs232自己傳資料..再自己收到.. > > 傳送端和接收端有接在一起了 > > 設定 > > 在form_load裡 > > MSComm1.CommPort = 1; > > MSComm1.Settings = "9600,N,8,1"; > > MSComm1.InputLen = 0; (這行的意思有點不懂) > > MSComm1.PortOpen = true; > > [ > > 傳送 > > MSComm1.Output ="12345" > 通常會寫在一個 button 裡面。 > > 接收 > > MSComm1.Input=text.text1 > 你接收寫錯了吧! ?? > text1.text=MSComm1.Input 吧! > MSComm1 有一個事件是當有資料送進來的時候會執行的, > 事件名稱我忘了。去 MSDN 查查~ > or > 放一個 Timer 去每 0.5 秒就抓一次 MSComm1.Input > > ]這二段也不知要加在那裡 > > 這樣子有對嗎... > > 有高手可以說一下錯在哪裡嗎... > > 或著須要加些什麼東西..幫忙解說..一下~謝謝 我傳送用按鈕這樣寫 Private Sub Command1_Click() MSComm1.Output = "123" End Sub 接收這樣寫 Private Sub Timer1_Timer() Timer.Interval = 500 Print MSComm1.Input If MSComm1.Port = True Then Text1.Text = MSComm1.Input End If If MSComm1.InBufferCount > 0 Then Text2.Text = MSComm1.Output End If End Sub 但還是沒收到..有沒有寫錯..可以幫看一下嗎 都沒有顯示出收到的..不知是傳送寫錯還是接收寫錯了.. -- ◣ ███ ███ ☆ Post by RENA7 ◢█ ▉▉█ █▇█ ★ From 61-64-235-220-adsl-kao.dynamic.so-n ◥█◤ ﹉ ﹍ ﹋ 月光海洋BBS 《mobbs.stut.edu.tw》 163.26.220.130