[FONT=courier new]ORGANIZATION_BLOCK MAIN:OB1[/FONT][FONT=courier new]TITLE=[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]BEGIN[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]Network 1 // Maximale Fahrzeit[/FONT]
[FONT=courier new]LD SM0.1[/FONT]
[FONT=courier new]MOVW 20, VW98[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]Network 2 // Rollladen 1[/FONT]
[FONT=courier new]LD SM0.0[/FONT]
[FONT=courier new]= L60.0[/FONT]
[FONT=courier new]LD E0.0[/FONT]
[FONT=courier new]EU[/FONT]
[FONT=courier new]= L63.7[/FONT]
[FONT=courier new]LD L60.0[/FONT]
[FONT=courier new]CALL SBR0, L63.7, VW98, A0.0, A0.1, V0.0, VD100[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]Network 3 // Rollladen 2[/FONT]
[FONT=courier new]LD SM0.0[/FONT]
[FONT=courier new]= L60.0[/FONT]
[FONT=courier new]LD E0.1[/FONT]
[FONT=courier new]EU[/FONT]
[FONT=courier new]= L63.7[/FONT]
[FONT=courier new]LD L60.0[/FONT]
[FONT=courier new]CALL SBR0, L63.7, VW98, A0.2, A0.3, V0.1, VD104[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]END_ORGANIZATION_BLOCK[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]SUBROUTINE_BLOCK Rollladen:SBR0[/FONT]
[FONT=courier new]TITLE=[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]VAR_INPUT[/FONT]
[FONT=courier new]Taster:BOOL; // Starttaster (als Flanke übergeben)[/FONT]
[FONT=courier new]Dauer:INT; // Max. Fahrzeit in Sekunden[/FONT]
[FONT=courier new]END_VAR[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]VAR_IN_OUT[/FONT]
[FONT=courier new]Auf:BOOL; // Ausgang auf[/FONT]
[FONT=courier new]Ab:BOOL; // Ausgang ab[/FONT]
[FONT=courier new]Richtung:BOOL; // Speicher letzte Fahrtrichtung (0=Ab, 1=Auf)[/FONT]
[FONT=courier new]Memory:DINT; // Speicher Fahrzeit[/FONT]
[FONT=courier new]END_VAR[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]VAR[/FONT]
[FONT=courier new]Fahren:BOOL; // Fahrbefehl[/FONT]
[FONT=courier new]Zeithalt:BOOL; // Halt nach Fahrzeit[/FONT]
[FONT=courier new]Halt:BOOL; // Stopbefehl[/FONT]
[FONT=courier new]Fahrdauer:INT; // Aktuelle Fahrdauer[/FONT]
[FONT=courier new]END_VAR[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]BEGIN[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]Network 1 // Starten[/FONT]
[FONT=courier new]LD L0.0[/FONT]
[FONT=courier new]UN L3.0[/FONT]
[FONT=courier new]UN L3.1[/FONT]
[FONT=courier new]= L8.0[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]Network 2 // Fahrzeitbegrenzung[/FONT]
[FONT=courier new]LD SM0.0[/FONT]
[FONT=courier new]= L60.0[/FONT]
[FONT=courier new]LD L3.0[/FONT]
[FONT=courier new]O L3.1[/FONT]
[FONT=courier new]= L63.7[/FONT]
[FONT=courier new]LD L60.0[/FONT]
[FONT=courier new]CALL SBR61, L63.7, LW1, LD4, L8.1[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]Network 3 // Anhalten[/FONT]
[FONT=courier new]LD L0.0[/FONT]
[FONT=courier new]UN L8.0[/FONT]
[FONT=courier new]O L8.1[/FONT]
[FONT=courier new]= L8.2[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]Network 4 // Auffahren[/FONT]
[FONT=courier new]LD L8.0[/FONT]
[FONT=courier new]UN L3.2[/FONT]
[FONT=courier new]LD L3.0[/FONT]
[FONT=courier new]UN L8.2[/FONT]
[FONT=courier new]OLD[/FONT]
[FONT=courier new]= L3.0[/FONT]
[FONT=courier new]R L3.2, 1[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]Network 5 // Abfahren[/FONT]
[FONT=courier new]LD L8.0[/FONT]
[FONT=courier new]U L3.2[/FONT]
[FONT=courier new]LD L3.1[/FONT]
[FONT=courier new]UN L8.2[/FONT]
[FONT=courier new]OLD[/FONT]
[FONT=courier new]= L3.1[/FONT]
[FONT=courier new]S L3.2, 1[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]END_SUBROUTINE_BLOCK[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]SUBROUTINE_BLOCK SBR_TON:SBR61[/FONT]
[FONT=courier new]TITLE=[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]VAR_INPUT[/FONT]
[FONT=courier new]Start:BOOL; // L0.0[/FONT]
[FONT=courier new]PT:INT; // LW1[/FONT]
[FONT=courier new]END_VAR[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]VAR_IN_OUT[/FONT]
[FONT=courier new]Memory:DINT; // LD3[/FONT]
[FONT=courier new]END_VAR[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]VAR_OUTPUT[/FONT]
[FONT=courier new]Ausgang:BOOL; // L7.0[/FONT]
[FONT=courier new]END_VAR[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]VAR[/FONT]
[FONT=courier new]Diff:DINT; // LD10[/FONT]
[FONT=courier new]CV:INT; // LW12[/FONT]
[FONT=courier new]END_VAR[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]BEGIN[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]Network 1 // Start = Low[/FONT]
[FONT=courier new]// Bei inaktivem Start-Eingang den Speicher mit 0 beschreiben[/FONT]
[FONT=courier new]LDN L0.0[/FONT]
[FONT=courier new]UD<> LD3, 0[/FONT]
[FONT=courier new]MOVD 0, LD3[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]Network 2 // Start = High[/FONT]
[FONT=courier new]// Bei Aktivierung des Start-Eingang den Speicher mit der aktuellen Systemzeit beschreiben.[/FONT]
[FONT=courier new]LD L0.0[/FONT]
[FONT=courier new]UD= LD3, 0[/FONT]
[FONT=courier new]BITIM LD3[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]Network 3 // Gespeicherte Zeit erkennbar machen[/FONT]
[FONT=courier new]// Ist die so gespeicherte Systemzeit zufällig gerade = 0, dann im Speicher um 1 ms erhöhen, damit die Speicherung erkannt wird[/FONT]
[FONT=courier new]LD L0.0[/FONT]
[FONT=courier new]UD= LD3, 0[/FONT]
[FONT=courier new]INCD LD3[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]Network 4 // Timer[/FONT]
[FONT=courier new]// Ist die gespeicherte Systemzeit <>0, dann mit der aktuellen Systemzeit vergleichen und die Differenz als Timerwert ausgeben[/FONT]
[FONT=courier new]LDD<> LD3, 0[/FONT]
[FONT=courier new]CITIM LD3, LD8[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]Network 5 // Timer in Sekunden[/FONT]
[FONT=courier new]LD SM0.0[/FONT]
[FONT=courier new]/D 1000, LD8[/FONT]
[FONT=courier new]UENO[/FONT]
[FONT=courier new]DTI LD8, LW12[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]Network 6 // Ausgang[/FONT]
[FONT=courier new]// Das Timerbit setzen, wenn der Timerwert >= dem Vorgabewert.[/FONT]
[FONT=courier new]LD L0.0[/FONT]
[FONT=courier new]UW> LW1, 0[/FONT]
[FONT=courier new]UW>= LW12, LW1[/FONT]
[FONT=courier new]= L7.0[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]END_SUBROUTINE_BLOCK[/FONT]