FB30 MAIN P01 Main control program

[hit  <- on your browser to return]

 

 

 

Netzwerk 1: P01 Initialisation

 

IF "M01 Init" OR NOT "M00 OB1 FirstCycle" THEN

    "M01 MW38" := #STEP_BITS := 0;

    IF "M01 Init" THEN

        "M01 MD30" :=

        "M01 MD34" := 0;

        "M01 RunHomPos" := TRUE;

        "DatOfMod".P01.CrntModule := 101;

    END_IF;

END_IF;

 

 

 

Netzwerk 2: P01 SET execute home position

 

IF "M01 RunHomPos" AND #SET.SET.S.step0 THEN

    #SET.SET.S.steps := TRUE;

END_IF;

 

IF NOT "M01 RunHomPos" OR "HMI KEY".SYS.GLB.F8_Stop OR "HMI KEY".P01.GLB.F8_Stop THEN

    #SET.SET.S.steps := "M01 RunHomPos" := FALSE;

END_IF;

 

#SET.SET.S.steph := "M01 FLT ModuStp";

 

#SET(ACT_STEP => #SET.STEP_NO);

 

 

 

Netzwerk 3: P01 SEQ1 start, stop, hold

 

#SEQ1.SEQ1.S.steph := "M01 SEQ1 Start" AND NOT "M00 AutoCmpltMa run";

#SEQ1.SEQ1.S.steps := NOT "M01 RunHomPos" AND "M01 SEQ1 Start";

 

#SEQ1(ACT_STEP => #SEQ1.STEP_NO);

 

 

 

Netzwerk 4: P01 FLT faults monitoring

 

#FLT(FLT_MODULE := "M01 FLT ModuStp");

 

 

 

Netzwerk 5: P01 STEP.SEQ1_Start

 

IF "M00 TrnsSysRun Imp" AND "M00 AutoCmpltMa run" THEN

    #STEP.SEQ1_Start := TRUE;

    RETURN;

ELSIF #STEP.SEQ1_Start THEN

    IF NOT "M01 RunHomPos" AND NOT "M01 SEQ1 Active" THEN

        "M01 SEQ1 Start" := TRUE;

    ELSIF "M01 SEQ1 Active" THEN

        #STEP_BITS := 0;

        #STEP.SEQ1_Running := TRUE;

    END_IF;

END_IF;

 

 

 

Netzwerk 6: P01 STEP.SEQ1_Running

 

IF #STEP.SEQ1_Running THEN

    IF "M01 SEQ1 Done" THEN

        "M01 SEQ1 Active" := "M01 SEQ1 Start" := FALSE;

        #STEP_BITS := 0;

        #STEP.SEQ1_Done := TRUE;

        RETURN;

    END_IF;

END_IF;

 

 

 

Netzwerk 7: P01 STEP.Done

 

IF #STEP.SEQ1_Done THEN

    "M01 SEQ1 Done" := FALSE;

    #STEP_BITS := 0;

    #STEP.SEQ1_Write := TRUE;

    // Save actual data   

    "DatOfMod".P01.STS.RunTimeCntr_seq1 := #MaDa.RunTimeCntr_seq1;

    "DatOfMod".P01.STS.WPC_ok := "M01 SEQ1 DoWP1" AND "M01 SEQ1 WP1 DnOK";

    "DatOfMod".P01.STS.CrntWP_ok := "M01 SEQ1 WP1 DnOK" AND NOT "M01 SEQ1 WP1 DnNOK";

   

    "DatOfMod".P01.TrgtModule := 102;

    // If necessary, changing drive direction to module 103   

    IF NOT "DatOfMod".P01.STS.CrntWP_ok THEN

        "DatOfMod".P01.TrgtModule := 103;

    END_IF;

    "DatOfPLC".P01 := "DatOfMod".P01;

END_IF;

 

 

 

Netzwerk 8: P01 STEP.Write

 

IF #STEP.SEQ1_Write THEN

    "M01 SEQ1 WP1 DnOK" := "M01 SEQ1 DoWP1" := FALSE;

    "M01 TCP/IP Wrt start" := TRUE;

   

    IF "M01 TCP/IP Wrt done" OR TRUE THEN

        "M01 TCP/IP Wrt start" := "M01 TCP/IP Wrt done" := FALSE;

        #STEP_BITS := 0;

        RETURN;

    END_IF;

END_IF;

 

 

 

Netzwerk 9: P01 Run-Time

 

IF #STEP.SEQ1_Running THEN

    IF "M00 Imp 10Hz" AND "M01 Enabled" THEN

        #MaDa.RunTimeCntr_seq1 := #MaDa.RunTimeCntr_seq1 + 1;

    END_IF;

ELSE

    #MaDa.RunTimeCntr_seq1 := 0;

    IF NOT "M01 Active" AND ("M00 ManuCmpltMa run" AND "HMI KEY".P01.GLB.F19_GoToStep OR "M00 AutoCmpltMa run") THEN

        #STEP.SEQ1_Start := TRUE;

    END_IF;

END_IF;

 

 

 

Netzwerk 10: P01 SEQ1 active

 

"M01 Active" :=

#STEP.SEQ1_Start AND "M01 SEQ1 Active"

OR #STEP.SEQ1_Running

OR #STEP.SEQ1_Done

OR #STEP.SEQ1_Write;

 

 

 

Netzwerk 11: P01 Assign signal

 

IF "M01 FLT ModuStp" THEN

    "M01 FLT ModuStp SR" := true;

END_IF;

 

IF "M01 FLT ModuStp SR" AND NOT "M01 FLT ModuStp ACK" THEN

    IF "M01 FLT ModuStp SR" AND "M00 ACK Imp" THEN

        "M01 FLT ModuStp ACK" := true;

    END_IF;

ELSIF NOT "M01 FLT ModuStp" AND "M01 FLT ModuStp ACK" THEN

    "M01 FLT ModuStp SR" := "M01 FLT ModuStp ACK" := FALSE;

END_IF;

 

"A01 H06 SigTower RD" := "A01 H01 fault LED" := "M01 FLT ModuStp SR" AND NOT "M01 FLT ModuStp ACK" AND "Clock_1Hz" OR "M01 FLT ModuStp SR" AND "M01 FLT ModuStp ACK";

"A01 H04 SigTower GN" := NOT "M00 FltCmpltMaSR" AND ("M00 AutoCmpltMa run" AND "M01 SEQ1 Active" OR "Clock_1Hz" AND NOT "M00 AutoCmpltMa run" AND "M01 SEQ1 Active");

"A01 H05 SigTower YE" := "M00 AutoCmpltMa run" AND NOT "E01 2A3 LightCurtain active" AND "Clock_1Hz" OR "M00 ManuCmpltMa run" AND "E01 2A3 LightCurtain active";

 

 

 

Netzwerk 12: P01 Reset part counters

 

#ResetCntr_SE(IN := "HMI KEY".P01.GLB.F23_Execute,PT := t#2s);

IF #ResetCntr_SE.Q THEN

    "DatOfMod".P01.STS.CounterBadParts := "DatOfMod".P01.STS.CounterGoodParts := "DatOfMod".P01.STS.CounterTotalParts := 0;

END_IF;