使用VB控制TSM
可自行鍵入數值控制
步驟一: 先製作介面
步驟二: 編寫程式碼
Private Sub Form_Load()
If (MSComm1.PortOpen = True) Then MSComm1.PortOpen = False
MSComm1.CommPort = 3
MSComm1.PortOpen = True
MSComm1.Settings = "9600,N,8,1"
End Sub
Private Sub Command1_Click()
MSComm1.Output = "VE" &
Text1.Text & Chr(13)
MSComm1.Output = "AC" &
Text2.Text & Chr(13)
MSComm1.Output = "DE" &
Text3.Text & Chr(13)
MSComm1.Output = "FL" &
Text4.Text & Chr(13)
End Sub
說明步驟二:
檢視>屬性視窗
點左邊的Text1 (可以改變): 元件名稱(Name)
點右邊的Text (不可改變): 元件屬性(在此指Text屬性,可呼叫使用者鍵入的值)