Hi
Irgendwie klappt das hier alles nicht.
Was passieren soll?
Wenn ein Taster am DigiPort1 geschaltet wird, soll Relais1 geschaltet werden.
Wenn ein Taster am DigiPort2 geschaltet wird, soll Relais2 geschaltet werden.
usw.
Außerdem werden die Zustände die die Relais haben sollen gespeichert, damit immer alle ansind die an sein sollen.
Aber er schaltet nicht.
Hier mal der Code, etwas abgekürzt.
Hat jemand ne Idee, von mir aus aus wie mans komplett neu und besser macht.Code:define LIGHT as port[16] define BPORT1 as byteport[1] import "...\LIB\SHOW_BINARY.BAS" import "...\LIB\PULLUP1_ENABLE.BAS" define ADC8 ad[8] define SDA as port[9] define SCL as port[10] define EXTPORT as byteport[4] define STATION_IO as byte[3] define REL1 as bit [21] define REL2 as bit [22] define REL3 as bit [23] define REL4 as bit [24] define _REL1 as word define _REL2 as word define _REL3 as word define _REL4 as word PULLUP1_ENABLE() LIGHT=off LCD.INIT SDA=on SCL=on _REL1=-1 _REL2=-1 _REL3=-1 _REL4=-1 #HAUPTSCHLEIFE if _REL1 = 1 then REL1=ON else REL1=OFF end if if _REL2 = 1 then REL2=ON else REL2=OFF end if if _REL3 = 1 then REL3=ON else REL3=OFF end if if _REL4 = 1 then REL4=ON else REL4=OFF end if STATION_IO=OFF EXTPORT=STATION_IO LCD.POS 1,1 LCD.PRINT "BINARY: " SHOW_BINARY(BPORT1) '---------------- if (BPORT1 = 11111110b) then goto r1 end if if (BPORT1 = 11111101b) then goto r2 end if if (BPORT1 = 11111011b) then goto r3 end if if (BPORT1 = 11110111b) then goto r4 end if if (BPORT1 = 11101111b) then goto r1 end if if (BPORT1 = 11011111b) then goto r2 end if if (BPORT1 = 10111111b) then goto r3 end if if (BPORT1 = 01111111b) then goto r4 end if goto HAUPTSCHLEIFE #r1 Do Loop Until BPORT1 <> 11111110b PAUSE 25 LCD.POS 2,1 LCD.PRINT "REL1" if _REL1=1 then REL1=ON end if if _REL1=-1 then REL1=OFF end if _REL1= _REL1 * -1 goto HAUPTSCHLEIFE







Zitieren

Lesezeichen