EPSON 代码程序
1.EPSON SPEL+ 语言代码示例:
String RCdata$
, InData$
, toks$
(0), data1$
, data2$
, data3$
Integer N
, x
Double
VX(500), VY(500), VZ(500)
#define delay_Time 0.1
Function main
SetNet #
201, "192.168.60.5", 8000, CRLF
, NONE
OpenNet #
201 As Server
Print
"wait Connect ok..."
WaitNet #
201
Print
"Connect#201 ok."
Print #
201, "RC.OK"
loop1
:
Call communication
ParseStr RCdata$
, toks$
(), ","
Print
"指令=", toks$
(0)
If toks$
(0) = "CLOSE" Then
Print
"接收到控制类型数据."
Call close
ElseIf
UBound(toks$
()) >= 1 Then
Call ParsePoint
Call moveP
GoTo loop1
Else
Print
"数据无效请重新输入:"
GoTo loop1
EndIf
Fend
Function communication
succRC
:
If
ChkNet(201) > 0 Then
Read #
201, RCdata$
, ChkNet(201)
Print
"RCdata$=", RCdata$
Else
WaitNet #
201
Print
"等待数据接受"
GoTo succRC
EndIf
Fend
Function ParsePoint
N
= Val(toks$
(0))
Print
"坐标点数N=", N
Integer i
VX(0) = VY(0) = VZ(0) = 0
For i
= 1 To N Step
1
VX(i
) = Val(toks$
(i
))
VY(i
) = Val(toks$
(N
+ i
))
VZ(i
) = Val(toks$
(2 * N
+ i
))
P(i
) = XY(VX(i
), VY(i
), VZ(i
), 0)
Print
" X(i) =", VX(i
), "Y(i) =", VY(i
), "Z(i) =", VZ(i
)
Next
Fend
Function WaiteP
If Motor
= Off Then
Motor On
Power Low
Speed
50
Accel
30, 30
EndIf
Tool
0
Go waitP
Fend
Function moveP
If Motor
= Off Then
Motor On
Power Low
SpeedS
50
AccelS
50
EndIf
Call WaiteP
Tool
2
Integer i
Curve
"mycurve", O
, 0, 4, P(1:N
)
Jump P1
-Z(-10)
CVMove
"mycurve"
Go
P(N
) -Z(-10)
Call WaiteP
Fend
Function close
CloseNet #
201
If Motor
= On Then
Motor Off
EndIf
Fend
2.关键函数:
Curve,CVMove 函数
3.代码截图