
|
INFO - FAQ - CC2-Forum - CCPro-Forum |
|
||
|
Hallo ihr lieben, ich habe mir gerade die c-control 1 Station 2 zugelegt und scheitere jetzt schon an dem ersten Versuch. Ich würde gerne die 4 Relais der Station und auch einige Externe Relais bei Änderung des Pegels von 1 auf 0 an den Digitalports 1-8 ( Relais 1 bei Änderung am Port 1 usw.) schalten. Es wäre wirklich super von euch wenn jemand das Beispiel Listing mal für das Relais 1 und Port 1 ergänzt. '-------------------------- '------ I/O PORTS --------- '-------------------------- define ACHTPORTS byteport[1] 'entspricht PORT[1] bis PORT[8] define LIGHT port[16] '-------------------------- '---- SYSTEM MEMORY ------- '-------------------------- define MASK byte[1] define EXTPORT byteport[4] define REL1 port[29] define REL2 port[30] define REL3 port[31] define REL4 port[32] #INIT '---- PULL UPS ACTIVE ---- CONFIG.INIT CONFIG.PUT 00001000b CONFIG.OFF 'EXTPORT=OFF '------------------------- LIGHT=off LCD.INIT LCD.CLEAR '-------------------------------------------------------------------- ' Beispielprogramm Abfrage BYTEPORT '-------------------------------------------------------------------- #LOOP LCD.POS 1,1 MASK=10000000b #ABFRAGE '-------- PORT BIT mit MASKEN BIT VERGLEICHEN ------ if (ACHTPORTS and MASK) =0 then LCD.PRINT "0" else LCD.PRINT "1" END IF '-------- MASKEN BIT VERSCHIEBEN ------------------- MASK=MASK shr 1 '-------- ALLE BITS ABGEFRAGT WENN MASKE NULL IST -- if MASK=0 then goto LOOP else goto ABFRAGE END IF '------------------Relais----------------------------- |
| Antwort schreiben |