-
-
Hallo Olli,
vielleicht kannst Du ja hiermit etwas anfangen.
'************************************************* *******************
'
' letztes Update: 29.3.2005
'
' C-Control/BASIC
'
' Systemvoraussetzungen:
'
' - Application Board mit angeschlossenem Display
'
' Schwerpunkt:Lichtsteuerung Funksteckdose
'
' Ver: Date: Bemerkung:
' 0.01 08.09.2003 Time und Temp wird auf dem Display angezeigt
' 0.02 08.09.2003 Zeitanzeige ist nach rechts gerückt
' 0.03 13.09.2003 Temp wird abgefragt (noch zu langsam)wieder deaktiviert (30.10.2003)
' 0.04 14.09.2003 Text im Display wird korrekt angezeigt
' 0.05 25.09.2003 Piep Ton beim Start des Programmes
' 0.06 30.10.2003 Tastatur funktioniert endlich
'************************************************* *******************
'Relais
define Relais1 port[1]
define Relais2 port[2]
define Relais3 port[3]
define Relais4 port[4]
define Relais5 port[5]
define Relais6 port[6]
define Relais7 port[7]
define Relais8 port[8]
define relais byteport[1]
define temp AD[1] ' nimmt die Temperaturwerte auf
define tastatur ad[8] ' Tastatur wird definiert auf Port 8
' *** Daten-Definition ***
define value word
define output word
define vario word
define lcd_buf byte
define lcd_param byte
define lastsec byte
define key_nr byte
define key_rel byte
define compare byte
define xy byte
define i byte
' *** Definition LCD-Ports ***
define lcd_port byteport[2]
define lcd_rs port[14]
define lcd_rw port[13]
define lcd_e port[15]
BEEP 625,12,1 : BEEP 500,12,1 : BEEP 425,12,1 : BEEP 312,24,1 'Tonausgabe beim Start des Programms
'*********************************** ASCII-Codes für die Displayausgabe ********************************************
define A_ &H41
define B_ &H42
define C_ &H43
define D_ &H44
define E_ &H45
define F_ &H46
define G_ &H47
define H_ &H48
define I_ &H49
define J_ &H4A
define K_ &H4B
define L_ &H4C
define M_ &H4D
define N_ &H4E
define O_ &H4F
define P_ &H50
define Q_ &H51
define R_ &H52
define S_ &H53
define T_ &H54
define U_ &H55
define V_ &H56
define W_ &H57
define X_ &H58
define Y_ &H59
define Z_ &H5A
define LEERZ &H20
define MINUS &H2D
define NULL &H30
define GLEICH &H3D
define DOPPELPUNKT &H3A
'*************************************** Programmoperationen ************************************************
gosub LCD_INIT
#LOOP
if second=0 then gosub writeminute
if second= lastsec then goto loop
lastsec = second
gosub writesecond
gosub schalten
goto LOOP
#writeminute
xy=28:gosub cursor '1te Zeile 1 Position
lcd_param = NULL + hour / 10 : gosub LCD_WRITECHAR
lcd_param = NULL + hour mod 10 : gosub LCD_WRITECHAR
lcd_param = DOPPELPUNKT : gosub LCD_WRITECHAR
lcd_param = NULL + minute / 10 : gosub LCD_WRITECHAR
lcd_param = NULL + minute mod 10 : gosub LCD_WRITECHAR
lcd_param = DOPPELPUNKT : gosub LCD_WRITECHAR
#writesecond
xy=34:gosub cursor '1te Zeile 7te Position
lcd_param = NULL + second / 10 : gosub LCD_WRITECHAR
lcd_param = NULL + second mod 10 : gosub LCD_WRITECHAR
'schreibt TIME auf das Display in die 2. Zeile
xy=20:gosub cursor
lcd_param = &H54
gosub LCD_WRITECHAR
xy=21:gosub cursor
lcd_param = &H49
gosub LCD_WRITECHAR
xy=22:gosub cursor
lcd_param = &H4D
gosub LCD_WRITECHAR
xy=23:gosub cursor
lcd_param = &H45
gosub LCD_WRITECHAR
xy=24:gosub cursor
lcd_param = &H3A
gosub LCD_WRITECHAR
'************************************************* ************************************************** ***************
xy=49:gosub cursor
' Aktualisieren der Temperatur
looktab Grad , temp , vario
output = abs(vario)
if vario < 0 then lcd_param = MINUS else lcd_param = LEERZ
gosub LCD_WRITECHAR
' Tausender-Dezimalstelle oder Leerzeichen
if abs(vario) >= 1000 then lcd_param = NULL + output/1000 else lcd_param = LEERZ
gosub LCD_WRITECHAR
output = output mod 1000
' Hunderter-Dezimalstelle oder Leerzeichen
if abs(vario) >= 100 then lcd_param = NULL + output/100 else lcd_param = LEERZ
gosub LCD_WRITECHAR
output = output mod 100
' Zehner-Dezimalstelle oder Leerzeichen
if abs(vario) >= 10 then lcd_param = NULL + output/10 else lcd_param = LEERZ
gosub LCD_WRITECHAR
' einer Dezimalstelle oder Leerzeichen
lcd_param = NULL + output mod 10
gosub LCD_WRITECHAR
lcd_param = LEERZ : gosub LCD_Writechar
lcd_param = &Hdf : gosub LCD_Writechar
lcd_param = C_ : gosub LCD_Writechar
'schreibt TEMP auf das Display in die 3 Zeile
' xy=40:gosub cursor
' lcd_param = &H54
' gosub LCD_WRITECHAR
' xy=41:gosub cursor
' lcd_param = &H45
' gosub LCD_WRITECHAR
' xy=42:gosub cursor
' lcd_param = &H4D
' gosub LCD_WRITECHAR
' xy=43:gosub cursor
' lcd_param = &H50
' gosub LCD_WRITECHAR
' xy=44:gosub cursor
' lcd_param = &H3A
' gosub LCD_WRITECHAR
'schreibt Lichtsteuerung auf das Display in der 1. Zeile
xy=0:gosub cursor
lcd_param = &H20
gosub LCD_WRITECHAR
xy=1:gosub cursor
lcd_param = &H4C
gosub LCD_WRITECHAR
xy=2:gosub cursor
lcd_param = &H49
gosub LCD_WRITECHAR
xy=3:gosub cursor
lcd_param = &H43
gosub LCD_WRITECHAR
xy=4:gosub cursor
lcd_param = &H48
gosub LCD_WRITECHAR
xy=5:gosub cursor
lcd_param = &H54
gosub LCD_WRITECHAR
xy=6:gosub cursor
lcd_param = &H53
gosub LCD_WRITECHAR
xy=7:gosub cursor
lcd_param = &H54
gosub LCD_WRITECHAR
xy=8:gosub cursor
lcd_param = &H45
gosub LCD_WRITECHAR
xy=9:gosub cursor
lcd_param = &H55
gosub LCD_WRITECHAR
xy=10:gosub cursor
lcd_param = &H45
gosub LCD_WRITECHAR
xy=11:gosub cursor
lcd_param = &H52
gosub LCD_WRITECHAR
xy=12:gosub cursor
lcd_param = &H55
gosub LCD_WRITECHAR
xy=13:gosub cursor
lcd_param = &H4E
gosub LCD_WRITECHAR
xy=14:gosub cursor
lcd_param = &H47
gosub LCD_WRITECHAR
xy=15:gosub cursor
lcd_param = &H20
gosub LCD_WRITECHAR
'*************************************** LCD_Interface ************************************************** *********
'( muss in jedes Programm mit LCD-Ausgabe eingefuegt werden)
'die Zahl XY ermittelt die nächste Position am LCD.
'(0+ 1.zeile , 20+ 2.zeile, 40+ 3.ziele, 60+ 4.zeile.
'Also 44 ist daher 3.Zeile Postition 5.
#cursor
lcd_param=xy
if xy>=20 then lcd_param=xy+44
if xy>=40 then lcd_param=xy-24
if xy>=60 then lcd_param=xy+20
lcd_param=lcd_param+128
gosub lcd_writecmd
return
'Blinkender cursor am LCD ein (on) oder aus (off) schalten.
#curon
lcd_param=15:gosub lcd_writecmd
return
#curoff
lcd_param=12:gosub lcd_writecmd
return
#LCD_INIT
' alle ports 0
lcd_port = OFF
' 8-Bit-Modus aktivieren
lcd_param=&H38 : gosub LCD_WRITECMD
' mit 8-Bit-Command in 4-Bit-Modus umschalten
lcd_port=&B00000010
tog lcd_e
tog lcd_e
' ab jetzt 4-Bit-Modus
lcd_param = &H28 : gosub LCD_WRITECMD
lcd_param = &H0C : gosub LCD_WRITECMD
' Display loeschen
#LCD_CLS
lcd_param = &H02 : gosub LCD_WRITECMD
lcd_param = &H01 : gosub LCD_WRITECMD
return
' LCD-Kommando
#LCD_WRITECMD
lcd_buf = OFF
goto LCD_WRITE
' Zeichenausgabe
#LCD_WRITECHAR
lcd_buf = &B00100000
' Kommando oder Zeichen an Display senden
#LCD_WRITE
lcd_port = lcd_buf or (lcd_param shr 4) ' Hi-Nibble
tog lcd_e
tog lcd_e
lcd_port = lcd_buf or (lcd_param and &H0F) ' Lo-Nibble
tog lcd_e
tog lcd_e
return
'tastatur routine
#waitkey
key_nr=0
compare=tastatur
if compare>238 then goto rskey
compare=compare/21
looktab asciicodes,compare,xy
if key_rel=xy then return
key_nr=xy
key_rel=key_nr
return
#rskey
key_nr=0
key_rel=99
return
table asciicodes
11 7 4 1
10 8 5 2
12 9 6 3
tabend
#schalten
gosub waitkey
if key_nr=11 then relais=0 'alle Relais aus!
'if key_nr>=9 then return 'überprüfe ob nur noch Taste 1 bis 8
if key_nr=12 then goto LCD_CLS
if key_nr=1 then gosub meldung
xy=1
for i=1 to 8
if i=key_nr then relais=(relais xor xy)
xy=xy shl 1
next
gosub steuerung
return
#steuerung
'+++++++++++++++++++++++++++++++++++++++++++ DOW Abfrage ++++++++++++++++++++++++++++++++++++++++++++++++++ ++++
'Sonntag = 0, Montag = 1, Dienstag = 2, Mittwoch = 3, Donnerstag = 4 Freitag = 5, Samstag = 6
'+++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++
if DOW > 6 then DOW = 0 'Fehler der DOW Berechnung korrigieren
'+++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++
if (hour = 23) and (minute = 59) then gosub Reset ' Reset aller Relais um 23.59 Uhr
'--------------------------------------------------------------------------------------------------------------
'********************** Tastaturabfrage ************************************************** ************************
if (hour = 21) and (minute = 35) and (dow => 0 and dow =< 6) then Relais1 = ON 'Gummibaer Blau ON
if (hour = 21) and (minute = 36) and (dow => 0 and dow =< 6) then Relais1 = OFF
'************************************************* **************************************
if (hour = 22) and (minute = 55) and (dow => 0 and dow =< 6) then Relais2 = ON 'Gummibaer Blau OFF
if (hour = 22) and (minute = 56) and (dow => 0 and dow =< 6) then Relais2 = OFF
'************************************************* **************************************
'if (hour = 05) and (minute = 45) and (dow => 1 and dow =< 5) then Relais1 = ON 'Gummibaer Blau ON
'if (hour = 05) and (minute = 46) and (dow => 1 and dow =< 5) then Relais1 = OFF
'************************************************* **************************************
'if (hour = 07) and (minute = 00) and (dow => 1 and dow =< 5) then Relais2 = ON 'Gummibaer Blau OFF
'if (hour = 07) and (minute = 01) and (dow => 1 and dow =< 5) then Relais2 = OFF
'************************************************* **************************************
if (hour = 20) and (minute = 30) and (dow => 0 and dow =< 6) then Relais3 = ON 'Gummibaer Rot ON
if (hour = 20) and (minute = 31) and (dow => 0 and dow =< 6) then Relais3 = OFF
'************************************************* **************************************
if (hour = 22) and (minute = 00) and (dow => 0 and dow =< 6) then Relais4 = ON 'Gummibaer Rot OFF
if (hour = 22) and (minute = 01) and (dow => 0 and dow =< 6) then Relais4 = OFF
'************************************************* **************************************
' if (hour = 05) and (minute = 47) and (dow => 1 and dow =< 5) then Relais3 = ON 'Gummibaer Rot ON
' if (hour = 05) and (minute = 4
and (dow => 1 and dow =< 5) then Relais3 = OFF
'************************************************* **************************************
' if (hour = 07) and (minute = 03) and (dow => 1 and dow =< 5) then Relais4 = ON 'Gummibaer Rot OFF
' if (hour = 07) and (minute = 04) and (dow => 1 and dow =< 5) then Relais4 = OFF
'************************************************* **************************************
'if (hour = 21) and (minute = 10) and (dow => 0 and dow =< 6) then Relais5 = ON 'Bügelzimmer ON
'if (hour = 21) and (minute = 11) and (dow => 0 and dow =< 6) then Relais5 = OFF 'Vati Room ON
'************************************************* **************************************
if (hour = 23) and (minute = 10) and (dow => 0 and dow =< 6) then Relais6 = ON 'Bügelzimmer OFF
if (hour = 23) and (minute = 11) and (dow => 0 and dow =< 6) then Relais6 = OFF 'Vati Room OFF
'************************************************* **************************************
if (hour = 19) and (minute = 45) and (dow => 0 and dow =< 6) then Relais7 = ON 'neue Kugel ON
if (hour = 19) and (minute = 46) and (dow => 0 and dow =< 6) then Relais7 = OFF
'************************************************* **************************************
if (hour = 23) and (minute = 00) and (dow => 0 and dow =< 6) then Relais8 = ON ' neue Kugel OFF
if (hour = 23) and (minute = 01) and (dow => 0 and dow =< 6) then Relais8 = OFF
'************************************************* **************************************
return
#Reset
Relais1=Off
Relais2=OFF
Relais3=OFF
Relais4=OFF
Relais5=OFF
Relais6=OFF
Relais7=OFF
Relais8=OFF
return
#meldung
'lcd_param = &H02 : gosub LCD_WRITECMD
'lcd_param = &H01 : gosub LCD_WRITECMD
' xy=0:gosub cursor
' lcd_param = &H50
' gosub LCD_WRITECHAR
' xy=1:gosub cursor
' lcd_param = &H55
' gosub LCD_WRITECHAR
' xy=2:gosub cursor
' lcd_param = &H4D
' gosub LCD_WRITECHAR
' xy=3:gosub cursor
' lcd_param = &H50
' gosub LCD_WRITECHAR
' xy=4:gosub cursor
' lcd_param = &H45
' gosub LCD_WRITECHAR
' xy=5:gosub cursor
' lcd_param = &H3D
' gosub LCD_WRITECHAR
' xy=6:gosub cursor
' lcd_param = &H4F
' gosub LCD_WRITECHAR
' xy=7:gosub cursor
' lcd_param = &H4E
' gosub LCD_WRITECHAR
' PAUSE 200
return
'return
table Grad
-27 -27 -26 -25 -24 -24 -23 -22 -22 -21
-20 -20 -19 -18 -18 -17 -17 -16 -15 -15
-14 -13 -13 -12 -11 -11 -10 -9 -9 -8
-8 -7 -6 -6 -5 -5 -4 -3 -3 -2
-2 -1 -1 0 0 1 2 2 3 3
4 4 5 6 6 7 7 8 8 9
10 10 11 11 12 12 13 14 14 15
15 16 16 17 17 18 18 19 20 20
21 21 22 22 23 23 24 24 25 25
26 26 27 27 28 28 29 30 30 31
31 32 32 33 33 34 34 35 35 36
36 37 37 38 38 39 39 40 40 41
41 42 42 43 43 43 44 44 45 45
46 46 47 47 48 48 49 49 50 50
51 51 52 52 53 53 53 54 54 55
55 56 56 57 57 58 58 59 59 59
60 60 61 61 62 62 63 63 64 64
64 65 65 66 66 67 67 68 68 68
69 69 70 70 71 71 71 72 72 73
73 74 74 74 75 75 76 76 77 77
77 78 78 79 79 80 80 80 81 81
82 82 82 83 83 84 84 85 85 85
86 86 87 87 87 88 88 89 89 89
90 90 91 91 91 92 92 93 93 93
94 94 95 95 95 96 96 97 97 97
98 98 99 99 99 100
tabend
Gruß Oskar
melde Dich mal per Mail bei mir: info-system@onlinehome.de
Berechtigungen
- Neue Themen erstellen: Nein
- Themen beantworten: Nein
- Anhänge hochladen: Nein
- Beiträge bearbeiten: Nein
-
Foren-Regeln
Lesezeichen