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: Probleme if ... then Kategorie: Programmierung Basic (von setup_exe - 25.09.2004 10:45)
 Als Antwort auf Re: Probleme if ... then von ManfredW - 24.09.2004 19:52
Hallo Manfred,
thx für Antwort.
nach gosub ist A=1 -> ok, aber der Taster am A_PORT
ist nicht mehr aktiv, somit ist die Bedingung if not A_PORT
nicht erfüllt. Ich habe es auch schon mit pause probiert,
um den Taster zu "entprellen". Ohne Erfolg.
Hast Du evtl. noch einen Tip?
Cu Dominique

> Hallo,
> in dem Programm habe ich dort eingefügt, wo m.E. der Fehler liegt.
> Viel Erfolg wünscht Dir
> ManfredW
>  
> > Hallo Forum,
> > ich habe ein Problem mit folgenden Code (die if ... then Abfrage im "aktiven Display"
> > funzt nicht und ich komme da einfach nicht weiter (Display ständig "C" und nicht auf "U").
> > Umgebung:
> > A_byte = 0 nach Einschalten (Reset)
> > port[4] = A_PORT -> Taster -> L-aktiv
> > Zustand des Tasters soll "zwischengespeichert" sein -> also A_byte = 0 -> Taster auf L ->
> > A_byte = 1 -> Taster auf L -> A_byte = 0 usw.
> > Zusätzlich wird der Zustand im Display angezeigt: 0 = "C" -> 1 = "U".
> > Vielen Dank für einen Tip!
> > Cu Dominique
> >
> > Codeausschnitt:
> >
> > '******************************
> > '*     PS-MC1-Steuerung       *
> > '*     V 1.1 -> 24.09.2004    *
> > '*     Test: 1                *
> > '******************************
> > '------ I/O PORTS ---------
> > define RL_PORT  port[1] 'Port Rechts-/Linkslauf
> > define H2O_PORT port[2] 'Port Wasserkühlung
> > define A_PORT   port[4] 'Port Antriebsauswahl (Controller or Unit)
> > define AD7      AD[7]   'AD-Eingang Poti -> Leistung -> wird später DA[1]
> > '---- LCD PARMAMETERS -----
> > define  LINE     byte[1]
> > define  CHAR     byte[1]
> > define  POS      byte[1]
> > define  BARS     byte[1]
> > define  BIN      byte[1]
> > define  DEZ      byte[1]
> > '-- LCD SYSTEM ADDR -----
> > define LCD_INIT   &H101
> > define LCD_CLR    &H11D
> > define LCD_LINE1  &H125
> > define LCD_LINE2  &H12A
> > define LCD_POSL1  &H12F
> > define LCD_POSL2  &H133
> > define LCD_SCRL   &H13B
> > define LCD_SCRR   &H140
> > define LCD_BAR    &H145
> > define LCD_BIN    &H154
> > define LCD_DEZ    &H1C3
> > define LCD_WRT    &H1A4
> > define LCD_PRINT  &H179
> > '----- Variablen -----
> > define NULL      &H30 'Hex für 0
> > define A_byte    byte 'Byte Antrieb zur Zwischenspeicherung
> > define P         byte 'P = Leistung
> > '----- PROGRAMM -----
> > A_byte = 0
> > '----- INIT LCD -----
> > SYS &H101
> > '------ START-TEXT mit Display 4 x 16 ------
> > POS=1:SYS LCD_POSL1:sys LCD_PRINT:print"LEISTUNG:"
> > POS=1:SYS LCD_POSL2:sys LCD_PRINT:print"ANTRIEB :"
> > POS=17:SYS LCD_POSL1:sys LCD_PRINT:print"SPRAY   :"
> > POS=17:SYS LCD_POSL2:sys LCD_PRINT:print"R/L-LAUF:"
> > POS=16:SYS LCD_POSL1:sys LCD_PRINT:print"%"
> > POS=16:SYS LCD_POSL2:sys LCD_PRINT:print"C"
> > POS=30:SYS LCD_POSL1:sys LCD_PRINT:print"OFF"
> > POS=30:SYS LCD_POSL2:sys LCD_PRINT:print"OFF"
> > pause 100
> > '------ aktives DISPLAY --------
> > #LOOP
> > P = AD7 * 100 / 255 'Umrechnung AD7 -> 0 - 100 %
> > POS=13:SYS LCD_POSL1:CHAR=NULL+P/100:SYS LCD_WRT 'Anzeige 100-er
> > POS=14:SYS LCD_POSL1:CHAR=NULL+P MOD 100/10:SYS LCD_WRT 'Anzeige 10-er
> > POS=15:SYS LCD_POSL1:CHAR=NULL+P MOD 10:SYS LCD_WRT 'Anzeige 1-er
> > if (not A_PORT) and (A_byte=0) then gosub A_TEXT_1 'Abfrage ob Port=L und A_byte=0
>
> Nach gosub steht A auf 1 und die Bedingung für den folgenden gosub ist auch erfüllt,
> dadurch wird immer Text C ausgegeben.
>
> > if (not A_PORT) and (A_byte=1) then gosub A_TEXT_0 'Abfrage ob Port=L und A_byte=1
> > goto LOOP
> > end
> > '***************************************************************************************
> > '------ HIER IST DAS PROBLEM -> das Display will nicht umschalten!!!!!!!!!!!!!! --------
> > '***************************************************************************************
> > '------ Umschaltung Anzeige "C" und A_byte=0 ------
> > #A_TEXT_0
> > A_byte = 0
> > POS=16:SYS LCD_POSL2:sys LCD_PRINT:print"C"
> > return
> > '------ Umschaltung Anzeige "U" und A_byte=1 ------
> > #A_TEXT_1
> > A_byte = 1
> > POS=16:SYS LCD_POSL2:sys LCD_PRINT:print"U"
> > return
> > '--------------- DISPLAY TREIBER ----------------------
> > syscode "lcddrv11.s19"
> >
>

 Antwort schreiben

Bisherige Antworten:

Re: Probleme if ... then (von ManfredW - 25.09.2004 11:26)
    Re: Probleme if ... then (von setup_exe - 25.09.2004 13:00)
        Re: Probleme if ... then (von ManfredW - 25.09.2004 19:52)