使用VB 控制多軸TSM步進伺服馬達


使用VB 控制多軸TSM步進伺服馬達


***RS485 站號(Node ID) 設定:


    *  透過AMP   ” Step-Servo Quick Tunner ”軟體內設定馬達ID,如下:




*** 開啟VB軟體 :

步驟一: 專案>設定使用元件>勾選”Microsoft Comm Control 6.0”



步驟二: 先製作介面


步驟三: 編寫程式碼
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 Command3_Click()
MSComm1.Output = "1FL20000" + Chr(13)
End Sub

Private Sub Command4_Click()
MSComm1.Output = "2FL20000" + Chr(13)
End Sub
Private Sub Command5_Click()
MSComm1.Output = "1FL20000" + Chr(13)
MSComm1.Output = "2FL20000" + Chr(13)
End Sub