1. Code fürs Hauptmenü
Code:
'ATMEGA CONFIG'
'-------------'
$regfile = "m32def.dat"
'$lib "lcd.lib"
$crystal = 4000000
$baud = 19200
$hwstack = 32
$swstack = 10
$framesize = 40
$sim
'LCD CONFIG'
'----------'
Config Lcd = 20 * 4
Config Lcdpin = Pin , Db4 = Portd.4 , Db5 = Portd.5 , Db6 = Portd.6 , Db7 = Portd.7 , E = Portd.3 , Rs = Portd.2
Config Lcdbus = 4
'---------------'
Ktemp = 0.488758553274682
Temp_word = Getadc(1)
For I = 1 To 19
Ad1 = Getadc(1)
Tempcalc = Tempcalc + Ad1
Next
Tempcalc = Tempcalc / 20 '
Tempout = Tempcalc * Ktemp
If Pinb.1 = 0 Then
Locate 3 , 1
Lcd "temp.:"
Locate 3 , 14
Lcd Fusing(tempout , "#.##") ; Chr(0)
End If
'---------------'
Druck = 0.004887585533
Druck_word = Getadc(2)
Waitms 50
'
Druckout = Druck_word * Druck
Druckout = Druckout - 1.808
Druckout = Druckout / 0.20
Home
Locate 4 , 1
Lcd "druck:"
Locate 4 , 13
Lcd Fusing(druckout , "#.##'")
Locate 4 , 18
Lcd "Bar"
'End If
Locate 4 , 17
Lcd Chr(1)
Loop
End
2. ´Code für Druck
Code:
'ATMEGA CONFIG'
'-------------'
$sim
$regfile = "m32def.dat"
'$lib "lcd.lib"
$crystal = 4000000
$baud = 19200
$hwstack = 32
$swstack = 10
$framesize = 40
'LCD CONFIG'
'----------'
Config Lcd = 20 * 4
Config Lcdpin = Pin , Db4 = Portd.4 , Db5 = Portd.5 , Db6 = Portd.6 , Db7 = Portd.7 , E = Portd.3 , Rs = Portd.2
Config Lcdbus = 4
'Symbole'
'-------'
Deflcdchar 0 , 0 , 0 , 0 , 0 , 1 , 3 , 7 , 15
Deflcdchar 1 , 0 , 0 , 0 , 0 , 31 , 31 , 31 , 31
Deflcdchar 2 , 0 , 0 , 0 , 0 , 16 , 24 , 28 , 30
Deflcdchar 3 , 31 , 31 , 31 , 31 , 30 , 28 , 24 , 16
Deflcdchar 4 , 16 , 24 , 28 , 30 , 31 , 31 , 31 , 31
Deflcdchar 5 , 15 , 7 , 3 , 1 , 0 , 0 , 0 , 0
Deflcdchar 6 , 31 , 31 , 31 , 31 , 0 , 0 , 0 , 0
Deflcdchar 7 , 30 , 28 , 24 , 16 , 0 , 0 , 0 , 0
Declare Sub Lcdbig
Dim Lcdbigspalte As Byte , Lcdbigzahl As Byte
Dim Druck As Word
Dim Druck_str As String * 4 , Tmp As String * 1
Dim A As Byte , B As Byte
Do
Cls
Druck = Getadc(1)
Druck_str = Str(druck)
Locate 1 , 1
Lcd "Druck:"
Locate 2 , 1
Lcd "b"
Lcdbigspalte = 10
Lcdbigzahl = druck
If Druck < 10 Then B = 1
If Druck > 9 Then B = 2
If Druck > 99 Then B = 3
If Druck > 999 Then B = 4
For A = 1 To B
If A > 1 Then Lcdbigspalte = Lcdbigspalte + 3
Tmp = Mid(druck_str , A , 1)
Lcdbigzahl = Val(tmp)
Lcdbig
Next
Waitms 50 ' wait 1
Loop
Sub Lcdbig
' Zeile 1
Locate 1 , Lcdbigspalte
Select Case Lcdbigzahl
Case 0 : Lcd Chr(0) ; Chr(1) ; Chr(2)
Case 1 : Lcd Chr(0) ; Chr(1) ; Chr(32)
Case 2 : Lcd Chr(0) ; Chr(1) ; Chr(2)
Case 3 : Lcd Chr(0) ; Chr(1) ; Chr(2)
Case 4 : Lcd Chr(1) ; Chr(32) ; Chr(32)
Case 5 : Lcd Chr(1) ; Chr(1) ; Chr(1)
Case 6 : Lcd Chr(0) ; Chr(1) ; Chr(2)
Case 7 : Lcd Chr(1) ; Chr(1) ; Chr(1)
Case 8 : Lcd Chr(0) ; Chr(1) ; Chr(2)
Case 9 : Lcd Chr(0) ; Chr(1) ; Chr(2)
End Select
' Zeile 2
Locate 2 , Lcdbigspalte
Select Case Lcdbigzahl
Case 0 : Lcd Chr(255) ; Chr(32) ; Chr(255)
Case 1 : Lcd Chr(32) ; Chr(255) ; Chr(32)
Case 2 : Lcd Chr(0) ; Chr(1) ; Chr(3)
Case 3 : Lcd Chr(32) ; Chr(0) ; Chr(3)
Case 4 : Lcd Chr(255) ; Chr(1) ; Chr(255)
Case 5 : Lcd Chr(255) ; Chr(1) ; Chr(2)
Case 6 : Lcd Chr(255) ; Chr(1) ; Chr(2)
Case 7 : Lcd Chr(32) ; Chr(0) ; Chr(3)
Case 8 : Lcd Chr(255) ; Chr(1) ; Chr(255)
Case 9 : Lcd Chr(255) ; Chr(1) ; Chr(255)
End Select
' Zeile 3
Locate 3 , Lcdbigspalte
Select Case Lcdbigzahl
Case 0 : Lcd Chr(255) ; Chr(32) ; Chr(255)
Case 1 : Lcd Chr(32) ; Chr(255) ; Chr(32)
Case 2 : Lcd Chr(255) ; Chr(32) ; Chr(32)
Case 3 : Lcd Chr(32) ; Chr(5) ; Chr(4)
Case 4 : Lcd Chr(32) ; Chr(32) ; Chr(255)
Case 5 : Lcd Chr(32) ; Chr(32) ; Chr(255)
Case 6 : Lcd Chr(255) ; Chr(32) ; Chr(255)
Case 7 : Lcd Chr(32) ; Chr(255) ; Chr(32)
Case 8 : Lcd Chr(255) ; Chr(32) ; Chr(255)
Case 9 : Lcd Chr(32) ; Chr(32) ; Chr(255)
End Select
' Zeile 4
Locate 4 , Lcdbigspalte
Select Case Lcdbigzahl
Case 0 : Lcd Chr(5) ; Chr(6) ; Chr(7)
Case 1 : Lcd Chr(6) ; Chr(6) ; Chr(6)
Case 2 : Lcd Chr(6) ; Chr(6) ; Chr(6)
Case 3 : Lcd Chr(5) ; Chr(6) ; Chr(7)
Case 4 : Lcd Chr(32) ; Chr(32) ; Chr(6)
Case 5 : Lcd Chr(6) ; Chr(6) ; Chr(7)
Case 6 : Lcd Chr(5) ; Chr(6) ; Chr(7)
Case 7 : Lcd Chr(32) ; Chr(6) ; Chr(32)
Case 8 : Lcd Chr(5) ; Chr(6) ; Chr(7)
Case 9 : Lcd Chr(5) ; Chr(6) ; Chr(7)
End Select
End Sub
3.Code für TEMP
Code:
'ATMEGA CONFIG'
'-------------'
$sim
$regfile = "m32def.dat"
'$lib "lcd.lib"
$crystal = 4000000
$baud = 19200
$hwstack = 32
$swstack = 10
$framesize = 40
'LCD CONFIG'
'----------'
Config Lcd = 20 * 4
Config Lcdpin = Pin , Db4 = Portd.4 , Db5 = Portd.5 , Db6 = Portd.6 , Db7 = Portd.7 , E = Portd.3 , Rs = Portd.2
Config Lcdbus = 4
'Symbole'
'-------'
Deflcdchar 0 , 0 , 0 , 0 , 0 , 1 , 3 , 7 , 15
Deflcdchar 1 , 0 , 0 , 0 , 0 , 31 , 31 , 31 , 31
Deflcdchar 2 , 0 , 0 , 0 , 0 , 16 , 24 , 28 , 30
Deflcdchar 3 , 31 , 31 , 31 , 31 , 30 , 28 , 24 , 16
Deflcdchar 4 , 16 , 24 , 28 , 30 , 31 , 31 , 31 , 31
Deflcdchar 5 , 15 , 7 , 3 , 1 , 0 , 0 , 0 , 0
Deflcdchar 6 , 31 , 31 , 31 , 31 , 0 , 0 , 0 , 0
Deflcdchar 7 , 30 , 28 , 24 , 16 , 0 , 0 , 0 , 0
Declare Sub Lcdbig
Dim Lcdbigspalte As Byte , Lcdbigzahl As Byte
Dim temp As Word
Dim temp_str As String * 4 , Tmp As String * 1
Dim A As Byte , B As Byte
Do
Cls
temp = Getadc(1)
temp_str = Str(druck)
Locate 1 , 1
Lcd "temp:"
Locate 2 , 1
Lcd "b"
Lcdbigspalte = 10
Lcdbigzahl = temp
If temp< 10 Then B = 1
If temp> 9 Then B = 2
If temp> 99 Then B = 3
If temp > 999 Then B = 4
For A = 1 To B
If A > 1 Then Lcdbigspalte = Lcdbigspalte + 3
Tmp = Mid(temp_str , A , 1)
Lcdbigzahl = Val(tmp)
Lcdbig
Next
Waitms 50 ' wait 1
Loop
Sub Lcdbig
' Zeile 1
Locate 1 , Lcdbigspalte
Select Case Lcdbigzahl
Case 0 : Lcd Chr(0) ; Chr(1) ; Chr(2)
Case 1 : Lcd Chr(0) ; Chr(1) ; Chr(32)
Case 2 : Lcd Chr(0) ; Chr(1) ; Chr(2)
Case 3 : Lcd Chr(0) ; Chr(1) ; Chr(2)
Case 4 : Lcd Chr(1) ; Chr(32) ; Chr(32)
Case 5 : Lcd Chr(1) ; Chr(1) ; Chr(1)
Case 6 : Lcd Chr(0) ; Chr(1) ; Chr(2)
Case 7 : Lcd Chr(1) ; Chr(1) ; Chr(1)
Case 8 : Lcd Chr(0) ; Chr(1) ; Chr(2)
Case 9 : Lcd Chr(0) ; Chr(1) ; Chr(2)
End Select
' Zeile 2
Locate 2 , Lcdbigspalte
Select Case Lcdbigzahl
Case 0 : Lcd Chr(255) ; Chr(32) ; Chr(255)
Case 1 : Lcd Chr(32) ; Chr(255) ; Chr(32)
Case 2 : Lcd Chr(0) ; Chr(1) ; Chr(3)
Case 3 : Lcd Chr(32) ; Chr(0) ; Chr(3)
Case 4 : Lcd Chr(255) ; Chr(1) ; Chr(255)
Case 5 : Lcd Chr(255) ; Chr(1) ; Chr(2)
Case 6 : Lcd Chr(255) ; Chr(1) ; Chr(2)
Case 7 : Lcd Chr(32) ; Chr(0) ; Chr(3)
Case 8 : Lcd Chr(255) ; Chr(1) ; Chr(255)
Case 9 : Lcd Chr(255) ; Chr(1) ; Chr(255)
End Select
' Zeile 3
Locate 3 , Lcdbigspalte
Select Case Lcdbigzahl
Case 0 : Lcd Chr(255) ; Chr(32) ; Chr(255)
Case 1 : Lcd Chr(32) ; Chr(255) ; Chr(32)
Case 2 : Lcd Chr(255) ; Chr(32) ; Chr(32)
Case 3 : Lcd Chr(32) ; Chr(5) ; Chr(4)
Case 4 : Lcd Chr(32) ; Chr(32) ; Chr(255)
Case 5 : Lcd Chr(32) ; Chr(32) ; Chr(255)
Case 6 : Lcd Chr(255) ; Chr(32) ; Chr(255)
Case 7 : Lcd Chr(32) ; Chr(255) ; Chr(32)
Case 8 : Lcd Chr(255) ; Chr(32) ; Chr(255)
Case 9 : Lcd Chr(32) ; Chr(32) ; Chr(255)
End Select
' Zeile 4
Locate 4 , Lcdbigspalte
Select Case Lcdbigzahl
Case 0 : Lcd Chr(5) ; Chr(6) ; Chr(7)
Case 1 : Lcd Chr(6) ; Chr(6) ; Chr(6)
Case 2 : Lcd Chr(6) ; Chr(6) ; Chr(6)
Case 3 : Lcd Chr(5) ; Chr(6) ; Chr(7)
Case 4 : Lcd Chr(32) ; Chr(32) ; Chr(6)
Case 5 : Lcd Chr(6) ; Chr(6) ; Chr(7)
Case 6 : Lcd Chr(5) ; Chr(6) ; Chr(7)
Case 7 : Lcd Chr(32) ; Chr(6) ; Chr(32)
Case 8 : Lcd Chr(5) ; Chr(6) ; Chr(7)
Case 9 : Lcd Chr(5) ; Chr(6) ; Chr(7)
End Select
End Sub
Kann sein das nun ein kleiner fehler im Programm ist aber das sollte ja nichts mit den Screens zu tun haben
Lesezeichen