各位好小弟我因為學校關係有接觸到一個軟體
然後這軟體中貼著這段程式碼
可以幫小弟我看一下是不是Java嗎 ?
因為看起來不太像是C語言
如果願意的話可以幫我大概看一下它的功能嗎?
謝謝 以下是源碼
Peripheral mySer As ServoRunnerA @ 0
#DEFINE ID0 0
#DEFINE ID1 1
#DEFINE ID2 2
#DEFINE ID3 3
#DEFINE ID4 4
Dim x,y,z,xx,zz,yy As Byte
Dim ID As Byte
Dim Pos As Word
Sub MAIN()
RunFrame(0)
Pause 800
Do
renew()
Select Case x
Case 0
RunFrame(0)
Pause 800
Case 1
RunFrame(1)
Pause 800
Case 2
RunFrame(2)
Pause 800
Case 3
RunFrame(3)
Pause 800
Pause 800
Case 4
RunFrame(4)
Pause 800
Case 5
RunFrame(5)
Pause 800
Pause 800
Case 6
RunFrame(6)
Pause 800
Case 7
RunFrame(7)
Pause 800
Case 8
RunFrame(8)
Pause 800
Case 9
RunFrame(9)
Pause 800
Case 10
RunFrame(10)
Pause 800
Case 11
RunFrame(11)
Pause 800
Case 12
RunFrame(12)
Pause 800
Case 13
RunFrame(13)
Pause 800
Case 14
RunFrame(14)
Pause 800
Case 15
Debug "MM",CR
MM()
End Select
Pause 500
Debug CLS
Loop
End Sub
Sub MM()
Debug "手動模式",CR
ID = 0
Debug "ID=0",CR
MA:
renew()
Select Case x
Case 1
Debug "向前或夾",CR
forward()
Case 2
Debug "向後或鬆",CR
Rever()
Case 8
ID=0
Debug "ID=0",CR
Case 9
ID=1
Debug "ID=1",CR
Case 10
ID=2
Debug "ID=2",CR
Case 11
ID=3
Debug "ID=3",CR
End Select
If x<>15 Then
Goto MA
End If
Debug "自動模式",CR
End Sub
Sub forward()
FR:
Select Case ID
Case 0
Myser.GetNowPos(ID0,Pos) '
Pos = Pos - 100
myser.SetPosTimeAndRun(ID0,Pos,800) '
Pause 800
Case 1
Myser.GetNowPos(ID1,Pos) '
Pos = Pos - 100
myser.SetPosTimeAndRun(ID1,Pos,800) '
Pause 800
Case 2
Myser.GetNowPos(ID2,Pos) '
Pos = Pos + 100
myser.SetPosTimeAndRun(ID2,Pos,800) '
Pause 800
Case 3
Myser.GetNowPos(ID3,Pos) '
Pos = Pos + 100
myser.SetPosTimeAndRun(ID3,Pos,800) '
Myser.GetNowPos(ID4,Pos) '
Pos = Pos - 100
myser.SetPosTimeAndRun(ID4,Pos,800) '
Pause 800
End Select
Debug "ID=",ID,CR
Debug "Pos=",pOS,CR
renew2()
If xx=1 Then
Goto FR
End If
End Sub
Sub Rever()
RE:
Select Case ID
Case 0
Myser.GetNowPos(ID0,Pos)
Pos = Pos + 100
myser.SetPosTimeAndRun(ID0,Pos,800) '
Pause 800
Case 1
Myser.GetNowPos(ID1,Pos)
Pos = Pos + 100
myser.SetPosTimeAndRun(ID1,Pos,800) '
Pause 800
Case 2
Myser.GetNowPos(ID2,Pos)
Pos = Pos - 100
myser.SetPosTimeAndRun(ID2,Pos,800) '
Pause 800
Case 3
Myser.GetNowPos(ID3,Pos)
Pos = Pos - 100
myser.SetPosTimeAndRun(ID3,Pos,800) '
Myser.GetNowPos(ID4,Pos) '
Pos = Pos + 100
myser.SetPosTimeAndRun(ID4,Pos,800) '
Pause 800
End Select
Debug "ID=",ID,CR
Debug "Pos=",pOS,CR
renew2()
If xx=2 Then
Goto RE
End If
End Sub
Sub RunFrame(ID As Byte)
Myser.LoadFrame(ID)
Myser.Runallservo()
End Sub
Sub renew()
A0:
z=2
A1:
x = Readport0
x = x And 15
Debug CSRXY(1,1), %BIN8 x
If y=x Then
Goto A0
End If
Pause 100
z=z-1
If z<>0 Then
Goto A1
End If
y = x
End Sub
Sub renew2()
B0:
zz=0
B1:
xx = Readport0
xx = xx And 15
Debug CSRXY(1,2), %BIN8 xx
If zz=2 Then
Goto B2
End If
If yy=xx Then
zz=zz+1
Pause 10
Goto B1
End If
yy=xx
Goto B0
B2:
End Sub