I am using AL5A robot arm. This arm is controlled using VB6. The problem that i am facing now is the robot arm reacts very slow with the coding and i think there is some problem in my coding. here is my coding :
[code]Dim RobotPos(5) As Integer
Dim RobotPoint(5, 20) As Integer
Dim RobotStatus(5) As Integer
Private Sub Command1_Click()
load
End Sub
Private Sub Command2_Click()
fail
End Sub
Private Sub Command3_Click()
pass
End Sub
Private Sub Form_Load()
MSComm1.CommPort = 7
MSComm1.Settings = “115200,N,8,1”
MSComm1.PortOpen = True
RobotPos(0) = 127
RobotPos(1) = 127
RobotPos(2) = 127
RobotPos(3) = 127
RobotPos(4) = 127
RobotPos(5) = 127
End Sub
Private Sub fail()
Static N As Integer
Static M As Integer
RobotPoint(0, 0) = 127
RobotPoint(1, 0) = 180
RobotPoint(2, 0) = 180
RobotPoint(3, 0) = 210
RobotPoint(4, 0) = 140
RobotPoint(5, 0) = 10
RobotPoint(0, 1) = 120
RobotPoint(1, 1) = 56
RobotPoint(2, 1) = 91
RobotPoint(3, 1) = 180
RobotPoint(4, 1) = 160
RobotPoint(5, 1) = 10
RobotPoint(0, 2) = 120
RobotPoint(1, 2) = 30
RobotPoint(2, 2) = 53
RobotPoint(3, 2) = 171
RobotPoint(4, 2) = 160
RobotPoint(5, 2) = 100
RobotPoint(0, 3) = 120
RobotPoint(1, 3) = 30
RobotPoint(2, 3) = 53
RobotPoint(3, 3) = 161
RobotPoint(4, 3) = 110
RobotPoint(5, 3) = 100
RobotPoint(0, 4) = 120
RobotPoint(1, 4) = 60
RobotPoint(2, 4) = 63
RobotPoint(3, 4) = 140
RobotPoint(4, 4) = 110
RobotPoint(5, 4) = 10
RobotPoint(0, 5) = 120
RobotPoint(1, 5) = 150
RobotPoint(2, 5) = 150
RobotPoint(3, 5) = 140
RobotPoint(4, 5) = 110
RobotPoint(5, 5) = 10
RobotPoint(0, 6) = 210
RobotPoint(1, 6) = 180
RobotPoint(2, 6) = 180
RobotPoint(3, 6) = 140
RobotPoint(4, 6) = 110
RobotPoint(5, 6) = 1
RobotPoint(0, 7) = 210
RobotPoint(1, 7) = 68
RobotPoint(2, 7) = 180
RobotPoint(3, 7) = 247
RobotPoint(4, 7) = 110
RobotPoint(5, 7) = 1
RobotPoint(0, 8) = 210
RobotPoint(1, 8) = 68
RobotPoint(2, 8) = 180
RobotPoint(3, 8) = 238
RobotPoint(4, 8) = 160
RobotPoint(5, 8) = 10
RobotPoint(0, 9) = 210
RobotPoint(1, 9) = 170
RobotPoint(2, 9) = 180
RobotPoint(3, 9) = 140
RobotPoint(4, 9) = 160
RobotPoint(5, 9) = 10
RobotPoint(0, 10) = 131
RobotPoint(1, 10) = 180
RobotPoint(2, 10) = 180
RobotPoint(3, 10) = 105
RobotPoint(4, 10) = 160
RobotPoint(5, 10) = 10
RobotPoint(0, 11) = 130
RobotPoint(1, 11) = 180
RobotPoint(2, 11) = 180
RobotPoint(3, 11) = 100
RobotPoint(4, 11) = 160
RobotPoint(5, 11) = 10
M = 0
Do While (M < 12)
DoEvents
Label1.Caption = N
Label2.Caption = M
LbPos(N).Caption = RobotPos(N)
For g = 1 To RobotPoint(5, M)
DoEvents
Next g
If RobotPos(N) > RobotPoint(N, M) Then
RobotPos(N) = RobotPos(N) - 1
RobotStatus(N) = False
MSComm1.Output = Chr$(255)
MSComm1.Output = Chr$(N)
MSComm1.Output = Chr$(RobotPos(N))
ElseIf RobotPos(N) < RobotPoint(N, M) Then
RobotPos(N) = RobotPos(N) + 1
RobotStatus(N) = False
MSComm1.Output = Chr$(255)
MSComm1.Output = Chr$(N)
MSComm1.Output = Chr$(RobotPos(N))
ElseIf RobotPos(N) = RobotPoint(N, M) Then
RobotStatus(N) = True
End If
N = N + 1
If N > 5 Then
If (RobotStatus(0)) And (RobotStatus(1)) And (RobotStatus(2)) And (RobotStatus(3)) And (RobotStatus(4)) And (RobotStatus(5)) Then
M = M + 1
’ If M > 11 Then Exit Sub
End If
N = 0
End If
Loop
End Sub
Private Sub load()
Static N As Integer
Static M As Integer
RobotPoint(0, 0) = 120
RobotPoint(1, 0) = 100
RobotPoint(2, 0) = 180
RobotPoint(3, 0) = 200
RobotPoint(4, 0) = 150
RobotPoint(5, 0) = 50
RobotPoint(0, 1) = 120
RobotPoint(1, 1) = 76
RobotPoint(2, 1) = 91
RobotPoint(3, 1) = 180
RobotPoint(4, 1) = 170
RobotPoint(5, 1) = 70
RobotPoint(0, 2) = 120
RobotPoint(1, 2) = 30
RobotPoint(2, 2) = 53
RobotPoint(3, 2) = 171
RobotPoint(4, 2) = 160
RobotPoint(5, 2) = 100
RobotPoint(0, 3) = 120
RobotPoint(1, 3) = 30
RobotPoint(2, 3) = 53
RobotPoint(3, 3) = 161
RobotPoint(4, 3) = 110
RobotPoint(5, 3) = 100
RobotPoint(0, 4) = 120
RobotPoint(1, 4) = 60
RobotPoint(2, 4) = 63
RobotPoint(3, 4) = 140
RobotPoint(4, 4) = 110
RobotPoint(5, 4) = 10
RobotPoint(0, 5) = 130
RobotPoint(1, 5) = 150
RobotPoint(2, 5) = 150
RobotPoint(3, 5) = 160
RobotPoint(4, 5) = 110
RobotPoint(5, 5) = 10
RobotPoint(0, 6) = 210
RobotPoint(1, 6) = 180
RobotPoint(2, 6) = 180
RobotPoint(3, 6) = 150
RobotPoint(4, 6) = 110
RobotPoint(5, 6) = 100
RobotPoint(0, 7) = 210
RobotPoint(1, 7) = 68
RobotPoint(2, 7) = 180
RobotPoint(3, 7) = 247
RobotPoint(4, 7) = 110
RobotPoint(5, 7) = 100
RobotPoint(0, 8) = 210
RobotPoint(1, 8) = 68
RobotPoint(2, 8) = 180
RobotPoint(3, 8) = 238
RobotPoint(4, 8) = 160
RobotPoint(5, 8) = 100
RobotPoint(0, 9) = 210
RobotPoint(1, 9) = 170
RobotPoint(2, 9) = 180
RobotPoint(3, 9) = 140
RobotPoint(4, 9) = 160
RobotPoint(5, 9) = 100
RobotPoint(0, 10) = 131
RobotPoint(1, 10) = 180
RobotPoint(2, 10) = 180
RobotPoint(3, 10) = 155
RobotPoint(4, 10) = 160
RobotPoint(5, 10) = 100
RobotPoint(0, 11) = 130
RobotPoint(1, 11) = 180
RobotPoint(2, 11) = 180
RobotPoint(3, 11) = 100
RobotPoint(4, 11) = 160
RobotPoint(5, 11) = 100
M = 0
Do While (M < 12)
DoEvents
Label1.Caption = N
Label2.Caption = M
LbPos(N).Caption = RobotPos(N)
For g = 1 To RobotPoint(5, M)
DoEvents
Next g
If RobotPos(N) > RobotPoint(N, M) Then
RobotPos(N) = RobotPos(N) - 1
RobotStatus(N) = False
MSComm1.Output = Chr$(255)
MSComm1.Output = Chr$(N)
MSComm1.Output = Chr$(RobotPos(N))
ElseIf RobotPos(N) < RobotPoint(N, M) Then
RobotPos(N) = RobotPos(N) + 1
RobotStatus(N) = False
MSComm1.Output = Chr$(255)
MSComm1.Output = Chr$(N)
MSComm1.Output = Chr$(RobotPos(N))
ElseIf RobotPos(N) = RobotPoint(N, M) Then
RobotStatus(N) = True
End If
N = N + 1
If N > 5 Then
If (RobotStatus(0)) And (RobotStatus(1)) And (RobotStatus(2)) And (RobotStatus(3)) And (RobotStatus(4)) And (RobotStatus(5)) Then
M = M + 1
’ If M > 11 Then Exit Sub
End If
N = 0
End If
Loop
End Sub
Private Sub pass()
Static N As Integer
Static M As Integer
RobotPoint(0, 0) = 127
RobotPoint(1, 0) = 180
RobotPoint(2, 0) = 180
RobotPoint(3, 0) = 210
RobotPoint(4, 0) = 140
RobotPoint(5, 0) = 100
RobotPoint(0, 1) = 120
RobotPoint(1, 1) = 56
RobotPoint(2, 1) = 91
RobotPoint(3, 1) = 180
RobotPoint(4, 1) = 160
RobotPoint(5, 1) = 100
RobotPoint(0, 2) = 120
RobotPoint(1, 2) = 30
RobotPoint(2, 2) = 53
RobotPoint(3, 2) = 171
RobotPoint(4, 2) = 160
RobotPoint(5, 2) = 100
RobotPoint(0, 3) = 120
RobotPoint(1, 3) = 30
RobotPoint(2, 3) = 53
RobotPoint(3, 3) = 161
RobotPoint(4, 3) = 110
RobotPoint(5, 3) = 90
RobotPoint(0, 4) = 120
RobotPoint(1, 4) = 60
RobotPoint(2, 4) = 63
RobotPoint(3, 4) = 140
RobotPoint(4, 4) = 110
RobotPoint(5, 4) = 85
RobotPoint(0, 5) = 120
RobotPoint(1, 5) = 150
RobotPoint(2, 5) = 150
RobotPoint(3, 5) = 140
RobotPoint(4, 5) = 110
RobotPoint(5, 5) = 60
RobotPoint(0, 6) = 210
RobotPoint(1, 6) = 180
RobotPoint(2, 6) = 180
RobotPoint(3, 6) = 140
RobotPoint(4, 6) = 110
RobotPoint(5, 6) = 100
RobotPoint(0, 7) = 210
RobotPoint(1, 7) = 68
RobotPoint(2, 7) = 180
RobotPoint(3, 7) = 247
RobotPoint(4, 7) = 110
RobotPoint(5, 7) = 100
RobotPoint(0, 8) = 210
RobotPoint(1, 8) = 68
RobotPoint(2, 8) = 180
RobotPoint(3, 8) = 238
RobotPoint(4, 8) = 160
RobotPoint(5, 8) = 100
RobotPoint(0, 9) = 210
RobotPoint(1, 9) = 170
RobotPoint(2, 9) = 180
RobotPoint(3, 9) = 140
RobotPoint(4, 9) = 160
RobotPoint(5, 9) = 100
RobotPoint(0, 10) = 131
RobotPoint(1, 10) = 180
RobotPoint(2, 10) = 180
RobotPoint(3, 10) = 105
RobotPoint(4, 10) = 160
RobotPoint(5, 10) = 80
RobotPoint(0, 11) = 130
RobotPoint(1, 11) = 180
RobotPoint(2, 11) = 180
RobotPoint(3, 11) = 100
RobotPoint(4, 11) = 160
RobotPoint(5, 11) = 120
M = 0
Do While (M < 12)
DoEvents
Label1.Caption = N
Label2.Caption = M
LbPos(N).Caption = RobotPos(N)
For g = 1 To RobotPoint(5, M)
DoEvents
Next g
If RobotPos(N) > RobotPoint(N, M) Then
RobotPos(N) = RobotPos(N) - 1
RobotStatus(N) = False
MSComm1.Output = Chr$(255)
MSComm1.Output = Chr$(N)
MSComm1.Output = Chr$(RobotPos(N))
ElseIf RobotPos(N) < RobotPoint(N, M) Then
RobotPos(N) = RobotPos(N) + 1
RobotStatus(N) = False
MSComm1.Output = Chr$(255)
MSComm1.Output = Chr$(N)
MSComm1.Output = Chr$(RobotPos(N))
ElseIf RobotPos(N) = RobotPoint(N, M) Then
RobotStatus(N) = True
End If
N = N + 1
If N > 5 Then
If (RobotStatus(0)) And (RobotStatus(1)) And (RobotStatus(2)) And (RobotStatus(3)) And (RobotStatus(4)) And (RobotStatus(5)) Then
M = M + 1
’ If M > 11 Then Exit Sub
End If
N = 0
End If
Loop
End Sub
[/code]
Can you tell me how to increase the movement speed of the robot arm??? Thanks…

In that case you can do the same logic in VB as my 3) in the first post