
|
INFO - FAQ - CC2-Forum - CCPro-Forum |
|
> > solla = winkelangabe*85 'Berechnung der Toleranz > sollb = solla -200 > sollc = solla -400 > > sollz = winkelangabe*85 > solly = sollz + 200 > sollx = sollz + 400 > > > #loop ' Schleife > > if sollz > PotiWert*100 THEN K2 = off > if sollx > PotiWert*100 THEN K2 = off > if solly > PotiWert*100 THEN K2 = off > if sollz > PotiWert*100 then K1 = on > if solly > PotiWert*100 then K1 = on > if sollx > PotiWert*100 then K1 = on > > if solla < PotiWert*100 then K1 = off ' folgende 6 Zeilen: Winkel kleiner als Poti > if sollb < PotiWert*100 then K1 = off > if sollc < PotiWert*100 then K1 = off > if solla < PotiWert*100 then K2 = on > if sollb < PotiWert*100 then K2 = on > if sollc < PotiWert*100 then K2 = on > > if sollc = PotiWert*100 then K2 = off 'Annäherung von unten > if sollb = PotiWert*100 then K2 = off > if solla = PotiWert*100 then K2 = off > if sollc = PotiWert*100 then K1 = off 'Annäherung von unten > if sollb = PotiWert*100 then K1 = off > if solla = PotiWert*100 then K1 = off > > > if sollz = PotiWert*100 then K1 = off 'Annäherung von oben > if solly = PotiWert*100 then K1 = off > if sollx = PotiWert*100 then K1 = off > if sollz = PotiWert*100 then K2 = off 'Annäherung von oben > if solly = PotiWert*100 then K2 = off > if sollx = PotiWert*100 then K2 = off > > if winkelangabe*85 = PotiWert*100 then K1 = off > if winkelangabe*85 = PotiWert*100 then end > > goto loop Hallo, die if-Abfragen kannst Du einfacher und übersichtlicher machen. if soll.. > Potiwert... then goto RichtungLinks if soll.. < Potiwert... then goto RichtungRechts ' nun bleibt nur noch gleich übrig, also ohne if-Abfrage Drehen aus K1 = OFF : K2 = OFF : goto Ende #RichtungLinks K1 = ON : K2 = OFF : goto Ende #RichtungRechts K1 = OFF : K2 = ON : goto Ende Das Prinzip dieser Struktur besteht darin, dass das Relais nur an einer Stelle eingeschaltet wird. So vermeidet man wesentlich "Relais klappern" bei Programmfehlern. Interessant wird für Dich mein Programm Ventil AUF-Halt-ZU auf meiner homepage sein. MfG ManfredW Meine Homepage: http://manfred.wilzeck.de |
| Antwort schreiben |