also ich komme ohne die kalibrierung aus und auch ohne single variaablen damit konnte ich den code von 26% aud 17% drücken
5V stabilCode:$regfile = "m8def.dat" $crystal = 8000000 '$baud = 19200 ' baud rate $hwstack = 32 ' default use 32 for the hardware stack $swstack = 10 ' default use 10 for the SW stack $framesize = 40 'dont touch eeprom data by restart $eepleave 'config Config Lcd = 16 * 4 'LCD Display Config Lcdpin = Pin , Db4 = Portd.2 , Db5 = Portd.1 , Db6 = Portd.0 , Db7 = Portd.7 , E = Portd.3 , Rs = Portd.4 Config Adc = Single , Prescaler = Auto , Reference = Avcc 'cuonstanten Const Tnull = 559 'nei 25° Const Traum = 609 ' bei 0° Const Faktor = 5 'erechnet aus 5V/1024=0,048 'dim Dim Zahl As Word Dim Wert As Word Dim Temperatur As Word Dim Text As String * 1 Deflcdchar 1 , 8 , 20 , 8 , 32 , 32 , 32 , 32 , 32 ' replace ? with number (0-7) Initlcd Cursor Off Start Adc Anfang: Cls Zahl = Getadc(3) Wert = Zahl Lcd "adc " ; Zahl Text = "+" If Wert > Traum Then Zahl = Wert - Traum Zahl = Zahl * Faktor Temperatur = 250 + Zahl End If If Wert = Traum Then Temperatur = 250 If Wert < Traum And Wert > Tnull Then Zahl = Traum - Wert Zahl = Zahl * Faktor Temperatur = 250 - Zahl End If If Wert = Tnull Then Text = " " Temperatur = 0 End If If Wert < Tnull Then Text = "-" Zahl = Tnull - wert Temperatur = Zahl * Faktor End If Zahl = Temperatur / 10 Wert = Temperatur Mod 10 Locate 3 , 1 : Lcd "Temp " ; Zahl ; "." ; Wert ; Chr(1) ; "C" Wait 1 Goto Anfang
|
4,7K
|
V+ --> ADC ref AVCC mit 10µH und 100nF extern
LM335
V-
|
GND







Zitieren

Lesezeichen