PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Problem bei Zeit+Tempsteuerung



croy
18.01.2004, 18:32
hallo,

folgendes problem:

nach start des programmes funktioniert alles ca 24 stunden, dann zeigt der display nix mehr an.

hardware: c-control-station+I/O terminal

code:


'INTERFACE ZUM I/O TERMINAL
define sdio port[5]'1
define sclio port[6]'2
define strobe port[4]'3
define light port[3]

'---- FUNCTION KEYS -------
define FUNCTION1 port[9]
define FUNCTION2 port[10]
define FUNCTION3 port[11]
define FUNCTION4 port[12]
'------- LEDs -------------
define LED1 port[13]
define LED2 port[14]
define LED3 port[15]
define LED4 port[16]

'--- BIN-DEZIMAL-CONVERTER ---
define tausender byte[1]
define hunderter byte[2]
define zehner byte[3]
define einer byte[4]

'---- MINI LCD 2x8 --------
define lcd_char byte[13]
define lcd_data byte[14]
define CHAR byte[15]
'---- PORT TREIBER --------
define LED_PORT byte[16]
define EXT_PORT byte[17]
define MASK byte[18]
'----- PROGRAMM ------------
define value byte[19]
define temp1 byte[20]
define temp2 byte[21]
define key byte[22]
define digit byte[23]

define T_Boden word[1]
define value17 word[2]
define gp word[3]
define value16 word[4]
define zeit word[5]
define VORON word[6]
define VOROFF word[7]
define NACHON word[8]
define NACHOFF word[9]
define T_Wasser word[10]
define counter word[11]
define DUENG word[12]
'VormittagLicht
'------ TEMP FÜHLER --------
define T1 AD[5]
define T2 AD[6]
define KEY_VAL AD[4]
define YES ON
define NO OFF
'------ ABCD ----------

define A_ &HC1
define B_ &HC2
define C_ &HC3
define D_ &HC4
define E_ &HC5
define F_ &HC6
define G_ &HC7
define H_ &HC8
define I_ &HC9
define J_ &HCA
define K_ &HCB
define L_ &HCC
define M_ &HCD
define N_ &HCE
define O_ &HCF
define P_ &HD0
define Q_ &HD1
define R_ &HD2
define S_ &HD3
define T_ &HD4
define U_ &HD5
define V_ &HD6
define W_ &HD7
define X_ &HD8
define Y_ &HD9
define Z_ &HDA
define LEERZ &HA0
define MINUS &HAD
define NULL &HB0
define EINS &HB1
define ZWEI &HB2
define DREI &HB3
define VIER &HB4
define FUENF &HB5
define SECHS &HB6
define SIEBEN &HB7
define ACHT &HB8
define NEUN &HB9
define GLEICH &HBD
define DOPPELPUNKT &HBA
define PUNKT &HAE
define GRAD &HDF
define FRAGEZ &HAF
define STERN &HAA


T_Boden = 200
T_Wasser = 290





'IIIIIIIIIIIII INITIALISIERUNG IIIIIIIIIIIIIIIIIIIII
strobe=off:light=on:LED_PORT=255:EXT_PORT=0:gosub write_ports:gosub clear_display
gosub lcd2x8_init:light=on
gosub begruessung:pause 50
gosub clear_display
'IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII II
'IIIIIIIIIIIIIII PROGRAMM START IIIIIIIIIIIIIIIIIIII
'IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII II
#MAINLOOP
gosub show_time:pause 100
gosub schalt
gosub tempsteuerung1:gosub tempsteuerung2:gosub tempanzeige1:gosub tempanzeige2
pause 5
goto MAINLOOP

'IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII II
'IIIIIIIIIIIIIII PROGRAMM ENDE IIIIIIIIIIIIIIIIIIII
'IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII II




'ZEITABFRAGE
#schalt
if TAGAN then gosub 1on
if NACHMITTAGAN then gosub 1on
if NACHTAN then gosub 4on
if DUENGERAN then gosub Duenger
return


#TAGAN
if ( HOUR > 8) and ( HOUR< 12) then return YES else return NO
#NACHMITTAGAN
if ( HOUR > 13 ) and ( HOUR< 21 )then return YES else return NO
#NACHTAN
if (HOUR > 21) or ( HOUR < 8 ) then return YES else return NO
#DUENGERAN
if ( HOUR = 12 )and ( SECOND = 0) then return YES else return NO


#tempsteuerung1
looktab ttab1, T1, value16
value16=value16-80
if value16 < T_Boden then gosub 2on else gosub 2off
return
#tempsteuerung2
looktab ttab1, T2, value17
value17=value17-80
if value17 < T_Wasser then gosub 3on else gosub 3off
return
#tempanzeige1
gosub setline1
lcd_char=T_:gosub write_char
lcd_char=EINS:gosub write_char
lcd_char=&HA0:gosub write_char
hunderter=value16/100:lcd_char=hunderter+&HB0:gosub write_char
gp=hunderter*100
zehner=(value16-gp)/10:lcd_char=zehner+&HB0:gosub write_char
lcd_char=&HAC:gosub write_char:
einer=value16-gp-(zehner*10):lcd_char=einer+&HB0:gosub write_char
lcd_char=&HA0:gosub write_char:lcd_char=&HC3:gosub write_char:lcd_char=&HA0:gosub write_char
return
#tempanzeige2
gosub setline2
lcd_char=T_:gosub write_char
lcd_char=ZWEI:gosub write_char
lcd_char=&HA0:gosub write_char
hunderter=value17/100:lcd_char=hunderter+&HB0:gosub write_char
gp=hunderter*100
zehner=(value17-gp)/10:lcd_char=zehner+&HB0:gosub write_char
lcd_char=&HAC:gosub write_char:
einer=value17-gp-(zehner*10):lcd_char=einer+&HB0:gosub write_char
lcd_char=&HA0:gosub write_char:lcd_char=&HC3:gosub write_char:lcd_char=&HA0:gosub write_char
return

#show_time
gosub clear_display
gosub setline1
value=hour:gosub show_2_digits
lcd_char =&HBA : gosub write_char
value=minute:gosub show_2_digits
lcd_char =&HBA : gosub write_char
value=second:gosub show_2_digits
pause 100
return

#Duenger
gosub 5on
pause 20
gosub 5off
return


'IIIIIIIIIIIII UNTERPROGRAMME IIIIIIIIIIIIIIIIIIIIIII
#1off
EXT_PORT=EXT_PORT and &HFE:goto write_ports
#1on
EXT_PORT=EXT_PORT or &H01:goto write_ports
#2off
EXT_PORT=EXT_PORT and &HFD:goto write_ports
#2on
EXT_PORT=EXT_PORT or &H02:goto write_ports
'-----------------------------------------------------
#3off
EXT_PORT=EXT_PORT and &HFB:goto write_ports
#3on
EXT_PORT=EXT_PORT or &H04:goto write_ports
#4off
EXT_PORT=EXT_PORT and &HF7:goto write_ports
#4on
EXT_PORT=EXT_PORT or &H08:goto write_ports
'-----------------------------------------------------
#5off
EXT_PORT=EXT_PORT and &HEF:goto write_ports
#5on
EXT_PORT=EXT_PORT or &H10:goto write_ports
#6off
EXT_PORT=EXT_PORT and &HDF:goto write_ports
#6on
EXT_PORT=EXT_PORT or &H20:goto write_ports
'------------------------------------------------------
#7off
EXT_PORT=EXT_PORT and &HBF:goto write_ports
#7on
EXT_PORT=EXT_PORT or &H40:goto write_ports
'------------------------------------------------------
#8off
EXT_PORT=EXT_PORT and &H7F:goto write_ports
#8on
EXT_PORT=EXT_PORT or &H80:goto write_ports
'IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII IIIIII
'IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII IIIIII
#1rton
LED_PORT=LED_PORT and &HFE:goto write_ports
#1rtoff
LED_PORT=LED_PORT or &H01:goto write_ports
#1gnon
LED_PORT=LED_PORT and &HFD:goto write_ports
#1gnoff
LED_PORT=LED_PORT or &H02:goto write_ports
'-----------------------------------------------------
#2rton
LED_PORT=LED_PORT and &HFB:goto write_ports
#2rtoff
LED_PORT=LED_PORT or &H04:goto write_ports
#2gnon
LED_PORT=LED_PORT and &HF7:goto write_ports
#2gnoff
LED_PORT=LED_PORT or &H08:goto write_ports
'-----------------------------------------------------
#3rton
LED_PORT=LED_PORT and &HEF:goto write_ports
#3rtoff
LED_PORT=LED_PORT or &H10:goto write_ports
#3gnon
LED_PORT=LED_PORT and &HDF:goto write_ports
#3gnoff
LED_PORT=LED_PORT or &H20:goto write_ports
'------------------------------------------------------
#4gnon
LED_PORT=LED_PORT and &HBF:goto write_ports
#4gnoff
LED_PORT=LED_PORT or &H40:goto write_ports
'------------------------------------------------------
#5gnon
LED_PORT=LED_PORT and &H7F:goto write_ports
#5gnoff
LED_PORT=LED_PORT or &H80:goto write_ports


#display_binary
gosub setline1
lcd_char=((value and &H80) shr 7)+&HB0:gosub write_char
lcd_char=((value and &H40) shr 6)+&HB0:gosub write_char
lcd_char=((value and &H20) shr 5)+&HB0:gosub write_char
lcd_char=((value and &H10) shr 4)+&HB0:gosub write_char
lcd_char=((value and &H08) shr 3)+&HB0:gosub write_char
lcd_char=((value and &H04) shr 2)+&HB0:gosub write_char
lcd_char=((value and &H02) shr 1)+&HB0:gosub write_char
lcd_char=(value and &H01)+&HB0:gosub write_char
return

#begruessung' Aquarium '
gosub setline1
lcd_char=A_:gosub write_character
lcd_char=Q_:gosub write_character
lcd_char=U_:gosub write_character
lcd_char=A_:gosub write_character
lcd_char=R_:gosub write_character
lcd_char=I_:gosub write_character
lcd_char=U_:gosub write_character
lcd_char=M_:gosub write_character

return


#time_msg ' Zeit '
gosub setline1

lcd_char=LEERZ:gosub write_char
lcd_char=Z_:gosub write_char
lcd_char=E_:gosub write_char
lcd_char=I_:gosub write_char
lcd_char=T_:gosub write_char

return
#grad ' GRAD'
gosub setline1

lcd_char=LEERZ:gosub write_char
lcd_char=G_:gosub write_char
lcd_char=R_:gosub write_char
lcd_char=A_:gosub write_char
lcd_char=D_:gosub write_char

return



'--------------------------------------------
'-------- I/O-TERMINAL PORT Treiber ---------
'--------------------------------------------
#write_ports
MASK=&H80
#shift_mask1
if MASK=0 then goto write_ledport
if (MASK and EXT_PORT)=0 then goto shift_lo1
sdio=on:sclio=off:sclio=on:MASK=MASK shr 1:goto shift_mask1
#shift_lo1
sdio=off:sclio=off:sclio=on:MASK=MASK shr 1:goto shift_mask1
'--------------------------------------------
#write_ledport
MASK=&H80
#shift_mask2
if MASK=0 then goto exit_driver
if (MASK and LED_PORT)=0 then goto shift_lo2
sdio=on:sclio=off:sclio=on:MASK=MASK shr 1:goto shift_mask2
#shift_lo2
sdio=off:sclio=off:sclio=on:MASK=MASK shr 1:goto shift_mask2
#exit_driver
strobe=on:strobe=off:return
'--------------------------------------------
'-------- I/O-TERMINAL LCD Treiber ----------
'--------------------------------------------
#setline1
lcd_char=&H84:goto mode_control
#setline2
lcd_char=&HC4:goto mode_control
#clear_display
lcd_char=&H01:goto mode_control
#scroll_display_left
lcd_char=&H18:goto mode_control
#scroll_display_right
lcd_char=&H1C:goto mode_control
#write_character
beep 368,1,0
#write_char
sclio=on:sdio=on:sdio=off:sclio=off
lcd_data=&H74:gosub write_byte
lcd_data=&H40:gosub write_byte
lcd_data=lcd_char:gosub write_byte
sdio=off:sclio=on:sdio=on:return
'--------------------------------------------

'------ 2 DIGITS AM LCD ANZEIGEN -------
#show_2_digits
zehner=value/10
lcd_char=zehner+&HB0
gosub write_char
'einer abfragen
einer=value-(zehner*10)
lcd_char=einer+&HB0
gosub write_char
return
'IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII II
'-----------------------------------------------
#mode_control
sclio=on:sdio=on:sdio=off:sclio=off
lcd_data=&H74:gosub write_byte
lcd_data=&H00:gosub write_byte
lcd_data=lcd_char:gosub write_byte
sdio=off:sclio=on:sdio=on:return
#write_byte
sdio=(lcd_data and &H80)shr 7:sclio=on:sclio=off
sdio=(lcd_data and &H40)shr 6:sclio=on:sclio=off
sdio=(lcd_data and &H20)shr 5:sclio=on:sclio=off
sdio=(lcd_data and &H10)shr 4:sclio=on:sclio=off

sdio=(lcd_data and &H08)shr 3:sclio=on:sclio=off
sdio=(lcd_data and &H04)shr 2:sclio=on:sclio=off
sdio=(lcd_data and &H02)shr 1:sclio=on:sclio=off
sdio=lcd_data and &H01:sclio=on:sclio=off
deact sdio:sclio=on:sclio=off:sdio=off:return
#lcd2x8_init
sclio=on:sdio=on:sdio=off:sclio=off
lcd_data=&H74:gosub write_byte
lcd_data=&H00:gosub write_byte
lcd_data=&H25:gosub write_byte
lcd_data=&H06:gosub write_byte
lcd_data=&H24:gosub write_byte
lcd_data=&H0C:gosub write_byte
lcd_data=&H84:gosub write_byte
sdio=off:sclio=on:sdio=on:return


'--------------------------------------------
'------ I/O-TERMINAL KEYBOARD DECODER -----
'--------------------------------------------
#key_decode
key=255:if key_val<8 then return
#get_stable
key=key_val:if key<>key_val then goto get_stable
if key_val>8 then key=10 'F1 KEY
if key_val>25 then key=11 'F2 KEY
if key_val>41 then key=12 'F3 KEY
if key_val>57 then key=1 ' 1 KEY
if key_val>74 then key=2 ' 2 KEY
if key_val>90 then key=3 ' 3 KEY
if key_val>106 then key=4 ' 4 KEY
if key_val>124 then key=5 ' 5 KEY
if key_val>140 then key=6 ' 6 KEY
if key_val>156 then key=7 ' 7 KEY
if key_val>170 then key=9 ' 9 KEY
if key_val>187 then key=8 ' 8 KEY
if key_val>203 then key=0 ' 0 KEY
if key_val>221 then key=13 ' CLEAR
if key_val>238 then key=14 ' RETURN
return



table ttab1 "temperaturen.tab"
table ttab2 "temperaturen.tab"

19.01.2004, 18:49
Hallo Croy,
in der Bedienungsanleitung für die M-Unit steht auf Seite:
"Definition von Variablen
Der C-Control/Basic Steuercomputer stellt 24 Byte- Speicherzellen dem Anwender zur Verwendung "

Du hast 12 Word Variablen a 2 Byte = 24 Bytes und 15 Byte Variable macht zusammen 39 Bytes.
Da kommt es meiner Meinung nach zu Überschreiben der Variablen
Bin kein Fachmann, hoffe aber Dir geholfen zu haben
mfg
Johann ter Horst

croy
19.01.2004, 22:10
danke für die hilfe, stimmt, könnte daran liegen, ich werds mal testen.....