Private Sub chabu_l(obj As Object, x0%, y0%, xe%, ye%) '直线插补
Dim x!, y!
Dim byRA As Byte
Dim lPulseX As Long 'X Axis pulse number
Dim lPulseY As Long 'Y Axis pulse number
Dim lPulseZ As Long 'Z Axis pulse number
Dim lPulseU As Long 'U Axis pulse number
Dim SelAxis As Byte
Dim CheckAxis As Byte
f = 0
x = x0: y = y0
SelAxis = &H4 Or &H8
CheckAxis = 12
lPulseX = 10000 'CW
lPulseY = 10000 'CW
obj.Line (x0, y0)-(xe, ye), vbBlue
obj.CurrentX = x
obj.CurrentY = y
n = (Abs(xe - x0) + Abs(ye - y0)) / p '总步数
While n <> 0
If f >= 0 Then
If xe <> x0 Then
x = x + (xe - x0) / Abs(xe - x0) * p
lPulseZ = x ''''''''''''''''''''''''''''''''
lPulseU = 0 '''''''''''''''''''''''''''''''''''''''''
ErrCode = P1240MotLine(CurrentBoard, _
SelAxis, _
byRA, _
lPulseX, _
lPulseY, _
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余2页未读,立即下载