Das Open-Control-Projekt - Die Alternative zur C-Control-I


Das Forum zur C-Control-1
Welche C-Control-Varianten existieren?
Übersicht - Suchen - Neueste 50 Beiträge - Neuer Beitrag - Login - Registrieren
INFO - FAQ - CC2-Forum - CCPro-Forum 

 Re: Vergleich/Gleichsetzung von Variablen Kategorie: Programmierung Basic (von Butcher - 29.12.2005 17:57)
 Als Antwort auf Re: Vergleich/Gleichsetzung von Variablen von ManfredW - 28.12.2005 21:38
Butcher nutzt:  CC1-Station V1.1
> >
> > 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

schönen Dank für den Hinweis, werde es auf jeden Fall probieren, den das "relais-Klappern" muss weg, jetzt versuch ich erstmal den Ansatz von Achim
mfg Butcher

 Antwort schreiben

Bisherige Antworten: