You are on page 1of 9

Projekt: EpsonRob

EPSON RC+ v5.4.3 SP1


Datei: Main.prg
Letzte nderung: 11.11.2016 11:50:49

Seite 1

Function main
Init()
Xqt main_UserInterface
' Benutzeroberflche Teach Pendant TP
Xqt main_Error_Status
' Fehlerroutine
Do
'Halt main_UserInterface
'Resume main_UserInterface
Speed Vel
Accel Acc, Dec
If (bTeilImGreifer = False) And (Sw(eVakuVorh) = True) And (Sw(eStart) = True) Then
TmReset (0)
TeilHolen()
EndIf
If (bTeilImGreifer = True) And (Sw(eVakuVorh) = True) And (Sw(eAbwurf) = False) Then
TeilAblegen()
TmrTaktzeit = Tmr(0)
Print "t_cycle=", TmrTaktzeit, " s"
EndIf
If (bTeilImGreifer = True) And (Sw(eVakuVorh) = True) And (Sw(eAbwurf) = True) Then
TeilAbwerfen()
TmrTaktzeit = Tmr(0)
Print "t_cycle=", TmrTaktzeit, " s"
EndIf
Loop
Fend
Function TeilHolen
'Hole Teil
If (Sw(eVacuumGripper) = False) Then '0..Vakuum 1..Gripper
Go DolnyPktPob ! D1; Off aVakuZykl !
Else
Go DolnyPktPob ! D50; On aVakuumEin !
EndIf
Wait WarteAufVaku 'kurze Wartezeit bis Vakuum aufgebaut ist
Go GornyPktPob CP
bTeilImGreifer = True
Fend
Function TeilAblegen
'Lege Teil ab
If (Sw(eVacuumGripper) = False) Then '0..Vakuum 1..Gripper
Go GornyPktOdd CP
Go DolnyPktOdd
On aVakuZykl
Else
Go GornyPktOdd CP '! D90; Off aVakuumEin !
Go DolnyPktOdd
Off aVakuumEin
EndIf
Wait WarteVakuAus 'kurze Wartezeit bis Vakuum rechtzeitig abgebaut ist
Go GornyPktOdd CP
Go GornyPktPob
bTeilImGreifer = False
Fend
Function TeilAbwerfen
'Werfe Teil ab
Go GornyPktOdrz CP
Go DolnyPktOdrz
If (Sw(eVacuumGripper) = False) Then '0..Vakuum 1..Gripper
On aVakuZykl
Else
Off aVakuumEin
EndIf
Wait WarteVakuAus 'kurze Wartezeit bis Vakuum rechtzeitig abgebaut ist
Go GornyPktOdrz CP
Go GornyPktPob

Projekt: EpsonRob
EPSON RC+ v5.4.3 SP1
Datei: Main.prg
Letzte nderung: 11.11.2016 11:50:49

Seite 2

bTeilImGreifer = False
Fend
Function ToHome
Home
Fend
Function Init
'Wartezeiten
'WarteAufVaku = 0.1
'WarteVakuAus = 0.1
If (Sw(eVacuumGripper) = False) Then '0..Vakuum 1..Gripper
On aVakuumEin 'if vacuum always on / if gripper on/off
Else
Off aVakuumEin
EndIf
bSPSSimul = True
Motor On
Power High
'Fine 10000, 10000, 10000, 10000
'Speed 100
'Accel 100, 100
'Vel = 50
'Acc = 120
'Dec = 120
Fend
Function main_Error_Status
' error handling and status
Do
' input state of watercooling
If Sw(eWasserVorh) Then
Else
' Error F_No_Watercoolin
' when water cooling is off robot can
EndIf
' input state of climatisation
If Sw(eKlimatisierung) Then
Else
' Error F_No_Climate
EndIf
' input state of compressed air
If Sw(eVakuVorh) Then
Else
' Error F_No_Air
EndIf

' when climatisation is off robot can

' when no compressed air robot can be

' error state


If (Sw(eWasserVorh) = False) Or (Sw(eKlimatisierung) = False) Or (Sw(eVakuVorh) = Fal
On aErrorAktiv
Else
Off aErrorAktiv
EndIf
' button state
If Sw(eVakuTippen) And Oport(aVakuZykl) Then
Off aVakuZykl 'inverse
Wait 0.3
EndIf
' button state
If Sw(eVakuTippen) And Not Oport(aVakuZykl) Then
On aVakuZykl 'inverse
Wait 0.3
EndIf
Loop
Fend

Projekt: EpsonRob
EPSON RC+ v5.4.3 SP1
Datei: Main.prg
Letzte nderung: 11.11.2016 11:50:49

Seite 3

Function main_UserInterface
String a$
Do
Cls #24
Print #24, "- TREND GROUP Robot 1 -- Auto-Menu --" 'Port-Nummer 24 definiert Touch Pendan
Print #24, "1= Ustawienia pozycji"
Print #24, "2= Ustawienia predkosci"
Print #24, "3= Ustawienia czasow pob/odd"
Print #24, "4= Wyswietl aktualne wartosci"
Print #24, "5= Zapisz pozycje"
Print #24, "-------- wartosci aktualne ------- "
Print #24, "t_cycle=", TmrTaktzeit, " s"
'
Print #24, "BlowOut=", Oport(BlowOut)
'
Print #24, "VacuumOn=", Oport(VacuumOn)
'Wichtig: Noch Bewegungsgrenzen definieren und berprfen ->
' z.B: +-10mm um Aufnahmepunkt fr Z-Achsen
Input #24, a$
If a$ = "1" Then
Cls #24
Print #24, "menu ustawienia pozycji"
Print #24, "1= zmien pozycje pobierania"
Print #24, "2= zmien pozycje oddawania"
Print #24, "3= zmien LimZ"
Print #24, "0= wyjdz"
Input #24, a$
If a$ = "1" Then
L_P_start: Cls #24
Print #24, "zmien pozycje pobierania"
Print #24, "1= x+1mm ", "2=x-1mm "
Print #24, "3= y+1mm ", "4=y-1mm "
Print #24, "5= z+1mm ", "6=z-1mm "
Print #24, "7= u+5grad ", "8=u-5grad "
Print #24, "0= wyjdz"
Input #24, a$
If a$ = "1" Then
DolnyPktPob = DolnyPktPob +X(1) 'X-Achse
ElseIf a$ = "2" Then
DolnyPktPob = DolnyPktPob -X(1) 'X-Achse
ElseIf a$ = "3" Then
DolnyPktPob = DolnyPktPob +Y(1) 'Y-Achse
ElseIf a$ = "4" Then
DolnyPktPob = DolnyPktPob -Y(1) 'Y-Achse
ElseIf a$ = "5" Then
DolnyPktPob = DolnyPktPob +Z(1) 'Z-Achse
ElseIf a$ = "6" Then
DolnyPktPob = DolnyPktPob -Z(1) 'Z-Achse
ElseIf a$ = "7" Then
DolnyPktPob = DolnyPktPob +U(5) 'U-Achse
ElseIf a$ = "8" Then
DolnyPktPob = DolnyPktPob -U(5) 'U-Achse
ElseIf a$ = "0" Then
GoTo L_end
Else
Print #24, "Zla wartosc!"
EndIf
Cls #24
Print #24, "aktualna pozycja pobierania:"
Print #24, "x = ", CX(DolnyPktPob)
Print #24, "y = ", CY(DolnyPktPob)
Print #24, "z = ", CZ(DolnyPktPob)
Print #24, "u = ", CU(DolnyPktPob)
Wait 2
GoTo L_P_start
ElseIf a$ = "2" Then

+ x mm
- x mm
+ x mm
- x mm
+ x mm
- x mm
+ x grad
- x grad

Projekt: EpsonRob
EPSON RC+ v5.4.3 SP1
Datei: Main.prg
Letzte nderung: 11.11.2016 11:50:49
L_P_stop: Cls #24
Print #24, "zmien pozycje oddawania"
Print #24, "1= x+1mm ", "2=x-1mm "
Print #24, "3= y+1mm ", "4=y-1mm "
Print #24, "5= z+1mm ", "6=z-1mm "
Print #24, "7= u+5grad ", "8=u-5grad "
Print #24, "0= wyjdz"
Input #24, a$
If a$ = "1" Then
DolnyPktOdd = DolnyPktOdd +X(1) 'X-Achse
ElseIf a$ = "2" Then
DolnyPktOdd = DolnyPktOdd -X(1) 'X-Achse
ElseIf a$ = "3" Then
DolnyPktOdd = DolnyPktOdd +Y(1) 'Y-Achse
ElseIf a$ = "4" Then
DolnyPktOdd = DolnyPktOdd -Y(1) 'Y-Achse
ElseIf a$ = "5" Then
DolnyPktOdd = DolnyPktOdd +Z(1) 'Z-Achse
ElseIf a$ = "6" Then
DolnyPktOdd = DolnyPktOdd -Z(1) 'Z-Achse
ElseIf a$ = "7" Then
DolnyPktOdd = DolnyPktOdd +U(5) 'U-Achse
ElseIf a$ = "8" Then
DolnyPktOdd = DolnyPktOdd -U(5) 'U-Achse
ElseIf a$ = "0" Then
GoTo L_end
Else
Print #24, "Zla wartosc!"
EndIf
Print #24, "aktualna pozycje oddawania:"
Print #24, "x = ", CX(DolnyPktOdd)
Print #24, "y = ", CY(DolnyPktOdd)
Print #24, "z = ", CZ(DolnyPktOdd)
Print #24, "u = ", CU(DolnyPktOdd)
Wait 2
GoTo L_P_stop
ElseIf a$ = "3" Then
L_P_LimZ: Cls #24
Print #24, "zmien pozycja LimZ"
Print #24, "1= LimZ+1mm ", "2= LimZ-1mm "
Print #24, "0= wyjdz"
Input #24, a$
If a$ = "1" Then
LimZAxis = LimZAxis + 1 'LimZ + x mm
If LimZAxis >= -1 Then LimZAxis = -1
ElseIf a$ = "2" Then
LimZAxis = LimZAxis - 1 'LimZ - x mm
If LimZAxis <= -400 Then LimZAxis = -400
ElseIf a$ = "0" Then
GoTo L_end
Else
Print #24, "Zla wartosc!"
EndIf
Print #24, "aktualna pozycje LimZ"
Print #24, "LimZ = ", LimZAxis
Wait 2
GoTo L_P_LimZ
Else
Print #24, "Zla wartosc!"
EndIf
ElseIf a$ = "2" Then
Cls #24
Print #24, "menu ustawienia predkosci"
Print #24, "1= zmien predkosc "
Print #24, "2= zmien przyspieszenie"
Print #24, "3= zmien zwalnianie"

Seite 4

+ x mm
- x mm
+ x mm
- x mm
+ x mm
- x mm
+ x grad
- x grad

Projekt: EpsonRob
EPSON RC+ v5.4.3 SP1
Datei: Main.prg
Letzte nderung: 11.11.2016 11:50:49
Print #24, "0= wyjdz"
Input #24, a$
If a$ = "1" Then
L_speed: Cls #24
Print #24, "zmien predkosc"
Print #24, "1= predkosc + 5% ", "2= predkosc - 5%"
Print #24, "0= wyjdz"
Input #24, a$
If a$ = "1" Then
Vel = Vel + 5
If Vel <= 1 Then Vel = 1
If Vel >= 100 Then Vel = 100
ElseIf a$ = "2" Then
Vel = Vel - 5
If Vel <= 1 Then Vel = 1
If Vel >= 100 Then Vel = 100
ElseIf a$ = "0" Then
GoTo L_end
Else
Print #24, "Zla wartosc!"
EndIf
Print #24, "aktualna predkosc"
Print #24, "predkosc = ", Vel
GoTo L_speed
ElseIf a$ = "2" Then
L_acc: Cls #24
Print #24, "zmien przyspieszenie"
Print #24, "1= przy + 1% ", "2= przy - 1%"
Print #24, "0= wyjdz"
Input #24, a$
If a$ = "1" Then
Acc = Acc + 1
If Acc <= 1 Then Acc = 1
If Acc >= 100 Then Acc = 100
ElseIf a$ = "2" Then
Acc = Acc - 1
If Acc <= 1 Then Acc = 1
If Acc >= 100 Then Acc = 100
ElseIf a$ = "0" Then
GoTo L_end
Else
Print #24, "Zla wartosc!"
EndIf
Print #24, "aktualna przyspieszenie"
Print #24, "przyspieszenie = ", Acc
GoTo L_acc
ElseIf a$ = "3" Then
L_dec: Cls #24
Print #24, "zmien zwalnianie"
Print #24, "1= zwalnianie + 1% ", "2= zwalnianie - 1%"
Print #24, "0= wyjdz"
Input #24, a$
If a$ = "1" Then
Dec = Dec + 1
If Dec <= 1 Then Dec = 1
If Dec >= 100 Then Dec = 100
ElseIf a$ = "2" Then
Dec = Dec - 1
If Dec <= 1 Then Dec = 1
If Dec >= 100 Then Dec = 100
ElseIf a$ = "0" Then
GoTo L_end
Else
Print #24, "Zla wartosc!"
EndIf
Print #24, "actual zwalnianie"

Seite 5

Projekt: EpsonRob
EPSON RC+ v5.4.3 SP1
Datei: Main.prg
Letzte nderung: 11.11.2016 11:50:49

Seite 6

Print #24, "zwalnianie = ", Dec


GoTo L_dec
Else
Print #24, "Zla wartosc!"
EndIf
ElseIf a$ = "3" Then
Cls #24
Print #24, "ustawienia predkosci pob/odd"
Print #24, "1= zmien czas pobierania"
Print #24, "2= zmien czas oddawania"
Print #24, "3= zmien czas opoznienia przedmuchu"
Print #24, "4= zmien czas przedmuchu"
Print #24, "0= wyjdz"
Input #24, a$
If a$ = "1" Then
L_pickup: Cls #24
Print #24, "zmien czas pobierania"
Print #24, "1= czas pobierania + 0.05s "
Print #24, "2= czas pobierania - 0.05s "
Print #24, "0= wyjdz"
Input #24, a$
If a$ = "1" Then
If WarteAufVaku < 1 Then
'Zeitgrenzen prfen
WarteAufVaku = WarteAufVaku + 0.05
Else
WarteAufVaku = 1
Print #24, "T_pickup upper limit = 1 s !"
EndIf
ElseIf a$ = "2" Then
If WarteAufVaku < 0.01 Then
'Zeitgrenzen prfen
WarteAufVaku = 0.01 'Aufnahmezeit nicht kleiner als 0.01 s zulassen
Print #24, "T_pickup lower limit = 0.01 s !"
Else
WarteAufVaku = WarteAufVaku - 0.05
EndIf
ElseIf a$ = "0" Then
GoTo L_end
Else
Print #24, "Zla wartosc!"
EndIf
Print #24, "aktualna czas pobierania"
Print #24, "PickUpTime = ", WarteAufVaku
GoTo L_pickup
ElseIf a$ = "2" Then
L_place: Cls #24
Print #24, "zmien czas oddawania"
Print #24, "1= czas oddawania + 0.05s "
Print #24, "2= czas oddawania - 0.05s "
Print #24, "0= wyjdz"
Input #24, a$
If a$ = "1" Then
If WarteVakuAus < 1 Then
'Zeitgrenzen prfen
WarteVakuAus = WarteVakuAus + 0.05
Else
WarteVakuAus = 1
Print #24, "place time upper limit = 1 s !"
EndIf
ElseIf a$ = "2" Then
If WarteVakuAus < 0.01 Then
'Zeitgrenzen prfen
WarteVakuAus = 0.01 'Aufnahmezeit nicht kleiner als 0.01 s zulassen
Print #24, "place time lower limit = 0.01 s !"
Else
WarteVakuAus = WarteVakuAus - 0.05
EndIf
ElseIf a$ = "0" Then
GoTo L_end

Projekt: EpsonRob
EPSON RC+ v5.4.3 SP1
Datei: Main.prg
Letzte nderung: 11.11.2016 11:50:49

Seite 7

Else
Print #24, "Zla wartosc!"
EndIf
Print #24, "aktualna czas oddawania"
Print #24, "czas oddawania = ", WarteVakuAus
GoTo L_place
ElseIf a$ = "3" Then
L_blowoutdelay: Cls #24
Print #24, "zmien czas opoznienia przedmuchu"
Print #24, "1= czas opoznienia przedmuchu + 0.05s "
Print #24, "2= czas opoznienia przedmuchu - 0.05s "
Print #24, "0= wyjdz"
Input #24, a$
If a$ = "1" Then
If BlowOutDelayTime < 0.01 Then
'Zeitgrenzen prfen
BlowOutDelayTime = BlowOutDelayTime + 0.05
Else
BlowOutDelayTime = 0.01
Print #24, "blowout delay time upper limit = 0.01 s !"
EndIf
ElseIf a$ = "2" Then
If BlowOutDelayTime < 0.01 Then
'Zeitgrenzen prfen
BlowOutDelayTime = 0.01 'Zeit nicht kleiner als 0.01 s zulassen
Print #24, "blowout delay time lower limit = 0.01 s !"
Else
BlowOutDelayTime = BlowOutDelayTime - 0.05
EndIf
ElseIf a$ = "0" Then
GoTo L_end
Else
Print #24, "Zla wartosc!"
EndIf
Print #24, "aktualna zmien czas opoznienia przedmuchu"
Print #24, "zmien czas opoznienia przedmuchu = ", BlowOutDelayTime
GoTo L_blowoutdelay
ElseIf a$ = "4" Then
L_blowout: Cls #24
Print #24, "zmien czas przedmuchu"
Print #24, "1= czas przedmuchu + 0.05s "
Print #24, "2= czas przedmuchu - 0.05s "
Print #24, "0= wyjdz"
Input #24, a$
If a$ = "1" Then
If BlowOutTime < 0.01 Then
'Zeitgrenzen prfen
BlowOutTime = BlowOutTime + 0.05
Else
BlowOutTime = 0.01
Print #24, "blowout time upper limit = 0.01 s !"
EndIf
ElseIf a$ = "2" Then
If BlowOutTime < 0.01 Then
'Zeitgrenzen prfen
BlowOutTime = 0.01 'Zeit nicht kleiner als 0.10 s zulassen
Print #24, "blowout time lower limit = 0.01 s !"
Else
BlowOutTime = BlowOutTime - 0.05
EndIf
ElseIf a$ = "0" Then
GoTo L_end
Else
Print #24, "Zla wartosc!"
EndIf
Print #24, "aktualna czas przedmuchu"
Print #24, "czas przedmuchu = ", BlowOutTime
GoTo L_blowout
Else
Print #24, "Zla wartosc!"

Projekt: EpsonRob
EPSON RC+ v5.4.3 SP1
Datei: Main.prg
Letzte nderung: 11.11.2016 11:50:49
EndIf
ElseIf a$ = "4" Then
Cls #24
Print #24, "menu wartosci aktualne"
Print #24, "1= wyswietl pozycje"
Print #24, "2= wyswietl predkosc, przysp."
Print #24, "3= wyswietl czasy"
Input #24, a$
If a$ = "1" Then
Cls #24
Print #24, "aktualna pozycja pobierania:"
Print #24, "x = ", CX(DolnyPktPob), " mm"
Print #24, "y = ", CY(DolnyPktPob), " mm"
Print #24, "z = ", CZ(DolnyPktPob), " mm"
Print #24, "u = ", CU(DolnyPktPob), " grad"
Print #24, "aktualna pozycja oddawania:"
Print #24, "x = ", CX(DolnyPktOdd), " mm"
Print #24, "y = ", CY(DolnyPktOdd), " mm"
Print #24, "z = ", CZ(DolnyPktOdd), " mm"
Print #24, "u = ", CU(DolnyPktOdd), " grad"
ElseIf a$ = "2" Then
Cls #24
Print #24, "aktualna predkosc"
Print #24, "predkosc = ", Vel
Print #24, "przyspieszenie = ", Acc, " %"
Print #24, "zwalnianie = ", Dec, " %"
ElseIf a$ = "3" Then
Cls #24
Print #24, "aktualne czasy"
Print #24, "czas pobierania = ", WarteAufVaku, " s"
Print #24, "czas oddawania = ", WarteVakuAus, " s"
Print #24, "dlugosc cyklu = ", CycleTime, " s"
Print #24, "opoznienie przedmuchu = ", BlowOutDelayTime, " s"
Print #24, "czas przedmuchu = ", BlowOutTime, " s"
Else
Print #24, "Zla wartosc!"
EndIf
Wait 5
ElseIf a$ = "5" Then
Print #24, "zapisz punkty do pliku"
SavePoints "Points.pts"
Else
Print #24, "Zla wartosc!"
EndIf
L_end: a$ = ""
Loop
Fend

Seite 8

Projekt: EpsonRob
EPSON RC+ v5.4.3 SP1
Datei: Global.prg
Letzte nderung: 05.10.2016 15:49:56
'Boolsche Variable
Global Preserve Boolean bTeilImGreifer
Global Preserve Boolean bSPSSimul
'Wartezeiten
Global Preserve Real WarteAufVaku
Global Preserve Real WarteVakuAus
Global Preserve Real BlowOutDelayTime
Global Preserve Real BlowOutTime
Global Preserve Real CycleTime
'Taktzeit
Global Real TmrTaktzeit
Global Preserve Integer Vel, LimZAxis, Acc, Dec

Seite 1

You might also like