Speichernde Einschaltverzögerung für S7-200 MicroWin

johannes83

Level-1
Beiträge
6
Reaktionspunkte
0
Zuviel Werbung?
-> Hier kostenlos registrieren
Hi,
bin gerade am Programmieren einer Rollosteuerung für die S7-200, habe das Programm mit TrySim geschrieben und simuliert, jetzt versuche ich gerade alles in MicroWin für die spätere SPS "umzuschreiben"

In TrySim hatte ich eine Speichernde Einschaltverzögerung, d.h. wenn am Eingang ein Impuls oder Dauersignal anliegt und die eingestellte Zeit abgelaufen ist, wird der Ausgang geschaltet. Solange bis am Reset ein Signal anliegt.
So einen Baustein habe ich aber in MicroWin nicht. Gibts da eine Möglichkeit oder muss ich dass Ganze "umgestalten"?
 
...
Gibts da eine Möglichkeit ...
Ja, gibt es.

Einfach ein Unterprogramm schreiben, das die Funktion emuliert und mehrfach verwendet werden kann.
Wie, hängt davon ab, welche CPU Du genau einsetzt und ob die Funktion nachtriggerbar sein soll oder nicht.

Hier ein Beispiel mit Einstellung in ms, der Genauigkeit von 1 Zyklus und nicht nachtriggernd:
Code:
[FONT=courier new]SUBROUTINE_BLOCK S_SEVERZ1:SBR63
[/FONT][FONT=courier new]TITLE=[/FONT]

[FONT=courier new]VAR_INPUT[/FONT]
[FONT=courier new]Start:BOOL;    // Start[/FONT]
[FONT=courier new]Reset:BOOL;    // Reset[/FONT]
[FONT=courier new]PT:DINT;    // Preset value in msec[/FONT]
[FONT=courier new]END_VAR[/FONT]

[FONT=courier new]VAR_IN_OUT[/FONT]
[FONT=courier new]CV:DINT;    // Current value in msec[/FONT]
[FONT=courier new]END_VAR[/FONT]

[FONT=courier new]VAR_OUTPUT[/FONT]
[FONT=courier new]Output:BOOL;    // CV=PT[/FONT]
[FONT=courier new]END_VAR[/FONT]
[FONT=courier new]
[/FONT][FONT=courier new]VAR[/FONT]
[FONT=courier new]Tmp_DI:DINT;[/FONT]
[FONT=courier new]Start_Tmr:BOOL;[/FONT]
[FONT=courier new]END_VAR[/FONT]
[FONT=courier new]
[/FONT]
[FONT=courier new]BEGIN[/FONT]
[FONT=courier new]
[/FONT][FONT=courier new]Network 1 // Start[/FONT]
[FONT=courier new]LD     L0.0[/FONT]
[FONT=courier new]UD=    LD5, 0[/FONT]
[FONT=courier new]MOVD   1, LD5[/FONT]
[FONT=courier new]=      L14.0[/FONT]
[FONT=courier new]
[/FONT][FONT=courier new]Network 2 // Reset[/FONT]
[FONT=courier new]LD     L0.1[/FONT]
[FONT=courier new]MOVD   0, LD5[/FONT]
[FONT=courier new]
[/FONT][FONT=courier new]Network 3 // Add[/FONT]
[FONT=courier new]LDD>   LD5, 0[/FONT]
[FONT=courier new]UN     L14.0[/FONT]
[FONT=courier new]ITD    SMW22, LD10[/FONT]
[FONT=courier new]+D     LD10, LD5[/FONT]

[FONT=courier new]Network 4 // Output[/FONT]
[FONT=courier new]LDD>=  LD5, LD1[/FONT]
[FONT=courier new]MOVD   LD1, LD5[/FONT]
[FONT=courier new]=      L9.0[/FONT]
[FONT=courier new]
[/FONT][FONT=courier new]END_SUBROUTINE_BLOCK[/FONT]
Mit den CPUen 22x kann man anstatt mit der Zykluszeit mit den Befehlen BGN_ITIME und CAL_ITIME arbeiten und erhält dann eine noch höhere Genauigkeit.
 
Zuviel Werbung?
-> Hier kostenlos registrieren
Nachtriggernd (Neustart der Zeit) solange Output=0, aber ungetestet:
Code:
[FONT=courier new]SUBROUTINE_BLOCK S_SEVERZ2:SBR63
[/FONT][FONT=courier new]TITLE=[/FONT]

[FONT=courier new]VAR_INPUT[/FONT]
[FONT=courier new]Start:BOOL;    // Start[/FONT]
[FONT=courier new]Reset:BOOL;    // Reset[/FONT]
[FONT=courier new]PT:DINT;    // Preset value in msec[/FONT]
[FONT=courier new]END_VAR[/FONT]

[FONT=courier new]VAR_IN_OUT[/FONT]
[FONT=courier new]Output:BOOL;    // CV=PT[/FONT]
[FONT=courier new]Memory:BOOL;    // Last value of start[/FONT]
[FONT=courier new]CV:DINT;    // Current value in msec[/FONT]
[FONT=courier new]END_VAR[/FONT]

[FONT=courier new]VAR[/FONT]
[FONT=courier new]Tmp_DI:DINT;[/FONT]
[FONT=courier new]END_VAR[/FONT]
[FONT=courier new]
[/FONT][FONT=courier new]
[/FONT][FONT=courier new]BEGIN[/FONT]

[FONT=courier new]Network 1 // Start[/FONT]
[FONT=courier new]LD     L0.0[/FONT]
[FONT=courier new]UN     L5.1[/FONT]
[FONT=courier new]UN     L5.0[/FONT]
[FONT=courier new]MOVD   1, LD6[/FONT]
[FONT=courier new]
[/FONT][FONT=courier new]Network 2 // Reset[/FONT]
[FONT=courier new]LD     L0.1[/FONT]
[FONT=courier new]MOVD   0, LD6[/FONT]
[FONT=courier new]
[/FONT][FONT=courier new]Network 3 // Add[/FONT]
[FONT=courier new]LD     L5.1[/FONT]
[FONT=courier new]OD>    LD6, 1[/FONT]
[FONT=courier new]ITD    SMW22, LD10[/FONT]
[FONT=courier new]+D     LD10, LD6[/FONT]

[FONT=courier new]Network 4 // Memory[/FONT]
[FONT=courier new]LD     L0.0[/FONT]
[FONT=courier new]UN     L0.1[/FONT]
[FONT=courier new]=      L5.1[/FONT]
[FONT=courier new]
[/FONT][FONT=courier new]Network 5 // Output[/FONT]
[FONT=courier new]LDD>=  LD6, LD1[/FONT]
[FONT=courier new]MOVD   LD1, LD6[/FONT]
[FONT=courier new]=      L5.0[/FONT]
[FONT=courier new]
[/FONT][FONT=courier new]END_SUBROUTINE_BLOCK[/FONT]

Hast Du Dir eigentlich das Programm, oder was sonst so im Forum 'rumschwirrt, schon angesehen, ob Du's vlt. als Grundlage verwenden kannst, anstatt das Fahrrad neu zu erfinden?
 
Nee, noch nicht.
Hab vor längerer Zeit schon mal gesucht aber nix passendes im Internet gefunden, werd ich heut aber nochmal machen.
Will jeden Rollo mit einem eigenen Taster für Auf und Ab steuern und zusätzlich bei zweimaligen Tasten eine Gruppenschaltung, bei dreimaligen Tasten eine Etagenschaltung und bei viermaligen Tasten das komplette Haus auf oder Ab lassen können, und das quasi von jedem Taster aus.
Wie gesagt, hatte das Programm nach einigen Abenden in TrySim auch schon lauffähig bekommen, aber jetzt beim umschreiben ins MicroWin funktioniert gar nix mehr.
Und das ganze ist nicht gerade wenig und übersichtlich...
 
Zuviel Werbung?
-> Hier kostenlos registrieren
Sorry, bin noch nicht dazu gekommen, werd mir dein Programm am Wochenende mal anschauen und meines hochladen. Hab auf diesem Rechner hier kein MicroWin drauf, auf dem anderen dafür kein Internet. Aber vielen Dank schonmal für die Mühe, bin mal gespannt wie es bei diesem Programm gelöst ist. Meld mich dann wieder...
 
Zurück
Oben