Sie sind auf Seite 1von 9

' Projekt ShortWave InfraRed Oven mit Robot ber Profibus ' (auch angepasst fr UOG Suzhou China)

Global Global Global Global Global Global Preserve Integer Vel, LimZAxis, Acc, Dec Real CycleTime Preserve Real PickUpTime Preserve Real GiveOffTime Preserve Real GiveOffTime2 Boolean In_Save_Pos, In_Wait_Pos

'!!!!!!!!!!!!!!!!!!!!!!!!!!! 'Using the Pls function, specify the current position of the arm as the Home pos ition. 'homeset Pls(1), Pls(2), Pls(3), Pls(4) for Inbetriebnahme noch durchfhren und Be wegungsgrenzen definieren '!!!!!!!!!!!!!!!!!!!!!!!!!!! Function main 'Hauptprogramm: Sel_Prog1 = 0 Sel_Prog_2 = 0 Sel_Prog_4 = 0 ' Benutzeroberflche Touch Pendant TP ' Falls Fehler auftritt ' Send / Receive ber Profibus

Xqt main_UserInterface Xqt main_Error Xqt main_Communication Integer u Power High Motor On Arch 0, 30, 30 Arch 1, 30, 30 Weight 2.8, 147.4 Acc = 100 ng Dec = 100 Vel = 100 LimZAxis = 0 PickUpTime = 0.2 GiveOffTime = 0.2 Do

' Leistung maximal ' definiert Verschleifen ' definiert Verschleifen ' Tool ca. 2.8kg Last und 147.4m ' Variableninitialisieru

' m

Halt main_UserInterface Resume main_UserInterface TmReset 0 If Sw(I_Start) = 0 Then GoTo End tartimpuls dann abbrechen For u = 0 To 9 LimZ LimZAxis ' Hhenbegrenzung je nach Artikel Accel Acc, Dec ' Beschleunigung max. 120 Speed Vel ' Geschwindigkeit Override TmReset 0 ' Reset Timer 0 fr Zykluszeitmessung

' Multi-Tasking UI

' kein S

Go P_Oven Wait PickUpTime ' Aufnahmezeit Go P_toughen Wait GiveOffTime ' Abgabezeit CycleTime = Tmr(0) zeit Next End: Loop Fend Function main_Error Do If Oport(3) = 1 Then ' noch erweitern ' Error aufgetreten ' Diese ' Zyklus

EndIf If Not (Oport(0) = 1 Or Oport(1) = 1) Then beiden Bits mssen immer ein sein, falls nicht ist Controller evtl. EndIf Loop

Fend Function main_Communication ' Receive Send ber Profibus Schnittstelle Do ' Ausgabe OutReal Q_x, CX(Here) ' gibt leider Istwert aus erst nachdem P unkt angefahren wurde, zum teachen aber geeignet OutReal Q_y, CY(Here) OutReal Q_z, CZ(Here) OutReal Q_u, CU(Here) ' OutReal istwert, CX(Here) ' gi bt Istwert im Real Format aus (Ieee 754) OutW Q_v_ist, Vel ' gibt Geschwindigkeit i n Int Format aus OutW Q_a_ist, Acc ' gibt Beschleunigung im Int Format aus Wait 0.5 ' ohne Wait trit t Multitasking-Error auf -> EPSON-Problem ' Eingabe (fr Teachen ber Profibus usw. bzw. UOG Suzhou Synch. mit Verschieberahmen) If Sw(I_LoadPar) Then ' SPS will Daten schicken !!!! e vtl. noch .. And Oport(Q_TeachMode) um nderungen nur sicher zuzulassen Select InW(I_Par_Nr) Case 1 ' Lade Punkt1 ko mplett in WKS!!! Case 2 ' Lade Punkt2 ko mplett Case 3 ' Lade Punkt3 ko mplett Case 10 dinate Case 11 dinate ' Lade P1.y Koor ' Lade P1.x Koor

Case 12 dinate Case 13 dinate Case 14 hwindigkeit Case 15 ng Case 20 dinate Case 21 dinate Case 22 dinate Case 23 dinate Case 24 hwindigkeit Case 25 ng Case 30 dinate Case 31 dinate Case 32 dinate Case 33 dinate Case 34 hwindigkeit ng Case 35 .....usw. weitere Parameter festlegen Default On Q_ReadReady esen Wait 0.1 Off Q_ReadReady Send EndIf Loop Fend

' Lade P1.z Koor ' Lade P1.u Koor ' Lade P1.v Gesc ' Lade P1.t Timi ' Lade P2.x Koor ' Lade P2.y Koor ' Lade P2.z Koor ' Lade P2.u Koor ' Lade P2.v Gesc ' Lade P2.t Timi ' Lade P3.x Koor ' Lade P3.y Koor ' Lade P3.z Koor ' Lade P3.u Koor ' Lade P3.v Gesc ' Lade P3.t Timi

' Quittung Robot hat gel

Function main_UserInterface String a$ Integer a Do Cls #24 Print #24, "- WALTEC Robot -- Auto-Menu -----" 'Port-Nummer 24 definier t Touch Pendant Print #24, "1= position setup" Print #24, "2= speed setup" Print #24, "3= timing setup" Print #24, "4= display actual values" Print #24, "5= save positions"

Print #24, "6= set values" Print #24, "-------- actual values ----------- " Print #24, "t_cycle=", CycleTime, " s" '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 position setup" Print #24, "1= change P_start" Print #24, "2= change P_stop" Print #24, "3= change LimZ" Input #24, a$ If a$ = "1" Then L_P_start: Cls #24 Print #24, "change position P_start" Print #24, "1= x+0.2mm ", "2=x-0.2mm " Print #24, "3= y+0.2mm ", "4=y-0.2mm " Print #24, "5= z+0.2mm ", "6=z-0.2mm " Print #24, "7= u+1grad ", "8=u-1grad " Input #24, a$ If a$ = "1" Then P_start = P_start +X(0.2) 'X-Achse ElseIf a$ = "2" Then P_start = P_start -X(0.2) 'X-Achse ElseIf a$ = "3" Then P_start = P_start +Y(0.2) 'Y-Achse ElseIf a$ = "4" Then P_start = P_start -Y(0.2) 'Y-Achse ElseIf a$ = "5" Then P_start = P_start +Z(0.2) 'Z-Achse ElseIf a$ = "6" Then P_start = P_start -Z(0.2) 'Z-Achse ElseIf a$ = "7" Then P_start = P_start +U(1) 'U-Achse + ElseIf a$ = "8" Then P_start = P_start -U(1) 'U-Achse ElseIf a$ = "0" Then GoTo L_end Else Print #24, "Wrong Input!" EndIf Cls #24 Print #24, "actual position P_start:" Print #24, "x = ", CX(P_start) Print #24, "y = ", CY(P_start) Print #24, "z = ", CZ(P_start) Print #24, "u = ", CU(P_start) GoTo L_P_start ElseIf a$ = "2" Then L_P_stop: Cls #24 Print #24, "change position P_stop" Print #24, "1= x+0.2mm ", "2=x-0.2mm " Print #24, "3= y+0.2mm ", "4=y-0.2mm " Print #24, "5= z+0.2mm ", "6=z-0.2mm " Print #24, "7= u+1grad ", "8=u-1grad " Print #24, "0= quit" Input #24, a$

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

If a$ = "1" Then P_stop = P_stop +X(0.2) 'X-Achse + x mm ElseIf a$ = "2" Then P_stop = P_stop -X(0.2) 'X-Achse - x mm ElseIf a$ = "3" Then P_stop = P_stop +Y(0.2) 'Y-Achse + x mm ElseIf a$ = "4" Then P_stop = P_stop -Y(0.2) 'Y-Achse - x mm ElseIf a$ = "5" Then P_stop = P_stop +Z(0.2) 'Z-Achse + x mm ElseIf a$ = "6" Then P_stop = P_stop -Z(0.2) 'Z-Achse - x mm ElseIf a$ = "7" Then P_stop = P_stop +U(1) 'U-Achse + x grad ElseIf a$ = "8" Then P_stop = P_stop -U(1) 'U-Achse - x grad ElseIf a$ = "0" Then GoTo L_end Else Print #24, "Wrong Input!" EndIf Print #24, "actual position P_stop:" Print #24, "x = ", CX(P_stop) Print #24, "y = ", CY(P_stop) Print #24, "z = ", CZ(P_stop) Print #24, "u = ", CU(P_stop) GoTo L_P_stop ElseIf a$ = "3" Then L_P_LimZ: Cls #24 Print #24, "change LimZ position " Print #24, "1= LimZ+1mm ", "2= LimZ-1mm " Print #24, "0= quit" Input #24, a$ If a$ = "1" Then LimZAxis = LimZAxis + 1 'LimZ + x mm ElseIf a$ = "2" Then LimZAxis = LimZAxis - 1 'LimZ - x mm ElseIf a$ = "0" Then GoTo L_end Else Print #24, "Wrong Input!" EndIf Print #24, "actual LimZ position" Print #24, "LimZ = ", LimZAxis GoTo L_P_LimZ Else Print #24, "Wrong Input!" EndIf ElseIf a$ = "2" Then Cls #24 Print #24, "menu speed setup" Print #24, "1= change speed" Print #24, "2= change acceleration" Print #24, "3= change deceleration" Input #24, a$ If a$ = "1" Then L_speed: Cls #24 Print #24, "change speed" Print #24, "1= speed + 1% ", "2= speed - 1%" Input #24, a$

If a$ = "1" Then Vel = Vel + 1 If Vel <= 1 Then Vel = 1 If Vel >= 100 Then Vel = 100 ElseIf a$ = "2" Then Vel = Vel - 1 If Vel <= 1 Then Vel = 1 If Vel >= 100 Then Vel = 100 ElseIf a$ = "0" Then GoTo L_end Else Print #24, "Wrong Input!" EndIf Print #24, "actual speed" Print #24, "speed = ", Vel GoTo L_speed ElseIf a$ = "2" Then L_acc: Cls #24 #24, "change acceleration" #24, "1= Acc + 1% ", "2= Acc - 1%" #24, 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, "Wrong Input!" EndIf Print #24, "actual acceleration" Print #24, "Acc = ", Acc GoTo L_acc ElseIf a$ = "3" Then L_dec: Cls #24 Print Print Input If a$ #24, "change deceleration" #24, "1= Dec + 1% ", "2= Dec - 1%" #24, 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, "Wrong Input!" EndIf Print #24, "actual deceleration" Print #24, "Dec = ", Dec GoTo L_dec Else Print #24, "Wrong Input!" Print Print Input If a$

EndIf ElseIf a$ = "3" Then Cls #24 Print #24, "menu timing setup" Print #24, "1= change pickup time" Print #24, "2= change place time" Input #24, a$ If a$ = "1" Then L_pickup: Cls #24 Print #24, "change pickup time" Print #24, "1= pickup time + 0.01s " Print #24, "2= pickup time - 0.01s " Input #24, a$ If a$ = "1" Then If PickUpTime < 1 Then 'Zeitgrenzen prfen PickUpTime = PickUpTime + 0.01 Else PickUpTime = 1 Print #24, "T_pickup upper limit = 1 s ! " EndIf ElseIf a$ = "2" Then If PickUpTime < 0.1 Then 'Zeitgrenzen prfe n PickUpTime = 0.05 'Aufnahmezeit nicht kl einer als 0.1 s zulassen Print #24, "T_pickup lower limit = 0.05 s !" Else PickUpTime = PickUpTime - 0.01 EndIf ElseIf a$ = "0" Then GoTo L_end Else Print #24, "Wrong Input!" EndIf Print #24, "actual pickup time" Print #24, "PickUpTime = ", PickUpTime GoTo L_pickup ElseIf a$ = "2" Then L_place: Cls #24 Print #24, "change place time" Print #24, "1= place time + 0.01s " Print #24, "2= place time - 0.01s " Input #24, a$ If a$ = "1" Then If GiveOffTime < 1 Then 'Zeitgrenzen prfen GiveOffTime = GiveOffTime + 0.01 Else GiveOffTime = 1 Print #24, "place time upper limit = 1 s !" EndIf ElseIf a$ = "2" Then If GiveOffTime < 0.1 Then 'Zeitgrenzen prfe n GiveOffTime = 0.05 'Aufnahmezeit nicht k leiner als 0.1 s zulassen Print #24, "place time lower limit = 0.0 5 s !"

Else GiveOffTime = GiveOffTime - 0.01 EndIf ElseIf a$ = "0" Then GoTo L_end Else Print #24, "Wrong Input!" EndIf Print #24, "actual place time" Print #24, "GiveOffTime = ", GiveOffTime GoTo L_place Else Print #24, "Wrong Input!" EndIf ElseIf a$ = "4" Then Cls #24 Print #24, "menu actual values" Print #24, "1= display positions" Print #24, "2= display speed, acc" Print #24, "3= display timing" Input #24, a$ If a$ = "1" Then Cls #24 Print #24, "actual position P_start:" Print #24, "x = ", CX(P_start), " mm" Print #24, "y = ", CY(P_start), " mm" Print #24, "z = ", CZ(P_start), " mm" Print #24, "u = ", CU(P_start), " grad" Print #24, "actual position P_stop:" Print #24, "x = ", CX(P_stop), " mm" Print #24, "y = ", CY(P_stop), " mm" Print #24, "z = ", CZ(P_stop), " mm" Print #24, "u = ", CU(P_stop), " grad" ElseIf a$ = "2" Then Cls #24 Print #24, "actual speed" Print #24, "speed = ", Vel Print #24, "acceleration = ", Acc, " %" Print #24, "deceleration = ", Dec, " %" ElseIf a$ = "3" Then Cls #24 Print #24, "actual timing" Print #24, "pickup time = ", PickUpTime, " s" Print #24, "place time = ", GiveOffTime, " s" Print #24, "cylce time = ", CycleTime, " s" Else Print #24, "Wrong Input!" EndIf Wait 5 ElseIf a$ = "5" Then Print #24, "Save Points to File" SavePoints "Points.pts" ElseIf a$ = "6" Then Cls #24 Print #24, "menu setup values" Print #24, "1= speed" Print #24, "2= acceleration" Print #24, "3= deceleration" Print #24, "4= LimZ" Input #24, a$

If a$ = "1" Then Cls #24 Print #24, "set speed [0,100]" Input #24, a If a >= 100 Or a <= 0 Then Print #24, "Wrong Input!" Else Vel = a EndIf ElseIf a$ = "2" Then Cls #24 Print #24, "set acceleration [0,100]" Input #24, a If a >= 100 Or a <= 0 Then Print #24, "Wrong Input!" Else Acc = a EndIf ElseIf a$ = "3" Then Cls #24 Print #24, "set deceleration [0,100]" Input #24, a If a >= 100 Or a <= 0 Then Print #24, "Wrong Input!" Else Dec = a EndIf ElseIf a$ = "4" Then Cls #24 Print #24, "set LimZ [-180mm,0mm]" Input #24, a If a >= 0 Or a <= -180 Then Print #24, "Wrong Input!" Else LimZAxis = a EndIf Else Print #24, "Wrong Input!" EndIf Else Print #24, "Wrong Input!" EndIf L_end: a$ = "" Loop Fend