$regfile = "m128def.dat"
$crystal = 16000000
Config Lcd = 20 * 4
Config Lcdpin = Pin , Db4 = Porta.3 , Db5 = Porta.2 , Db6 = Porta.1 , Db7 = Porta.0 , E = Porta.5 , Rs = Porta.4
'Config Adc = Single , Prescaler = Auto , Reference = Internal_2.56
'Config Dcf77 = Ping.1 , Timer = 1 , Timer1sec = 1 ,
Config Portc = Input
Config Adc = Single , Prescaler = Auto , Reference = Avcc
'Now give power to the chip
Start Adc
Dim Sel As Bit
Dim B As Byte
Dim Y As Byte
Dim Hmenu As Byte
Dim Hm As Byte
Dim Back As Bit
Dim W1 As Word
Dim W2 As Word
Dim W1g As Single
Dim W1f As Single
Dim W2g As Single
Dim W2f As Single
Dim Temp1 As Single
Dim Temp2 As Single
Portc = &B11111111
Initlcd
Cls
Cursor Off
Hmenu = 0
'Print B
Do
W1 = Getadc(0)
W2 = Getadc(1)
W1g = W1 - 145
W2g = W2 - 145
W1f = W1g / 6.75
W2f = W2g / 6.75
Temp1 = Round(w1f)
Temp2 = Round(w2f)
B = Encoder(pinc.0 , Pinc.1 , Links , Rechts , 0)
' ^--- 1 means wait for change which blocks programflow
' ^--------^---------- labels which are called
' ^-------^---------------------------- port PINs
Sel = Pinc.2
Back = Pinc.3
Hmenu = Hm / 4
Locate 4 , 15
Lcd Hmenu
Locate 1 , 15
Lcd Hm
Locate 2 , 15
Lcd Sel
Locate 3 , 15
Lcd Back
'While Sel = 1
Select Case Hmenu
'-------------------------------------------------------------------------------
Case 0 : 'Beleuchtung
'Cls
Locate 1 , 1
Lcd "A"
Locate 2 , 1
Lcd "B"
Locate 3 , 1
Lcd "C"
Locate 4 , 1
Lcd "D"
'-------------------------------------------------------------------------------
Case 1 : 'Motor
' Cls
Locate 1 , 1
Lcd "B"
Locate 2 , 1
Lcd "C"
Locate 3 , 1
Lcd "D"
Locate 4 , 1
Lcd "E"
'-------------------------------------------------------------------------------
Case 2 : 'Optionen
' Cls
Locate 1 , 1
Lcd "C"
Locate 2 , 1
Lcd "D"
Locate 3 , 1
Lcd "E"
Locate 4 , 1
Lcd "F"
'-------------------------------------------------------------------------------
Case 3 : 'Heizung
' Cls
Locate 1 , 1
Lcd "D"
Locate 2 , 1
Lcd "E"
Locate 3 , 1
Lcd "F"
Locate 3 , 1
Lcd "G"
'-------------------------------------------------------------------------------
Case 4 : 'IO
' Cls
Locate 1 , 1
Lcd "E"
Locate 2 , 1
Lcd "F"
Locate 3 , 1
Lcd "A"
Locate 4 , 1
Lcd "B"
'-------------------------------------------------------------------------------
Case 5 : 'Temperaturen
' Cls
Locate 1 , 1
Lcd "F"
Locate 2 , 1
Lcd "A"
Locate 3 , 1
Lcd "B"
Locate 4 , 1
Lcd "C"
'-------------------------------------------------------------------------------
Case 6 : 'Sonstiges
' Cls
Locate 1 , 1
Lcd "A"
Locate 2 , 1
Lcd "B"
Locate 3 , 1
Lcd "C"
Locate 4 , 1
Lcd "D"
Case Else:
End Select
'Wend
Loop
End
Links:
If Hm > 0 Then
Decr Hm
Elseif Hm = 0 Then
Hm = 25
End If
Return
Rechts:
If Hm <= 24 Then
Incr Hm
Elseif Hm > 24 Then
Hm = 0
End If
Return
|