Forum: Mikrocontroller und Digitale Elektronik Thermometer mit LM35 und Atmega8


von A.erwin W. (der_neugierige)


Lesenswert?

Hallo Leute

Ich möchte ein Thermometer mit einem LM35, Atmega8 und 16*2 LCD bauen.
Ich habe sowas auch schon im Netz gefunden, allerdings mit einem 4*20 
LCD.
hier der Link : http://www.avrprojects.net/articles.php?lng=en&pg=62

Jetzt hab ich allerdings ein paar kleine Fragen.

1. Welcher Codeabschnitt sagt dem LCD das er eine Skala anzeigen soll ? 
diese möchte ich entfernen. Ich möchte lediglich nur, dass auf dem LCD 
zB. "Temperatur innen" 22° steht.

2. Sobald eine Temperatur von zB. 26° erreicht wird, soll ein Ausgang 
geschaltet werden um ein Relais anzusteuern. die schaltung sollte kein 
Problem sein, allerdings habe ich ein Problem mit der umsetzung des 
Codes

3. Ich habe leider im mom keinen LM35 zur Hand, könnte ich auch ein 
PT100 nehmen ? oder ein NTC ? wobei NTC´s nicht Linear verlaufen, allso 
sollte es schon ein PT100 sein oder verstehe ich das falsch.


Ich danke euch schonmal im Vorraus.
Mfg Der_Neugierige

von A.erwin W. (der_neugierige)


Lesenswert?

Hallo da bin ich nochmal

Ich habe jetzt einen DS1721 genommen und angeschlossen, in Bascom habe 
ich ein beispiel gefunden, allerdings für einen DS1624.

hier der code

$regfile = "m8def.dat"                                      'Define the 
chip you use

$baud = 19200                                               'Define UART 
BAUD rate


'Declare RAM for temperature storage
Dim I2ctemp As Byte                                         'Storage for 
the temperature


'Configure pins we want to use for the I²C bus
Config Scl = Portd.1                                        'Is serial 
clock SCL
Config Sda = Portd.3                                        'Is serial 
data SDA



'Declare constants - I2C chip addresses
Const Ds1721wr = &B10010000                                 'DS1624 
Sensor write
Const Ds1721rd = &B10010001                                 'DS1624 
Sensor read

'This section initializes the DS1624
   I2cstart                                                 'Sends start 
condition
   I2cwbyte Ds1721wr                                        'Sends the 
address




'byte with r/w 0




'Access the CONFIG register (&HAC address byte)

   I2cwbyte &HAC
'Set continuous conversion  (&H00 command byte)

   I2cwbyte &H00
   I2cstop                                                  'Sends stop 
condition
   Waitms 25                                                'We have to 
wait some time after a stop

   I2cstart
   I2cwbyte Ds1721wr

'Start conversion (&HEE command byte)
   I2cwbyte &HEE
   I2cstop
   Waitms 25
'End of initialization

Print                                                       'Print empty 
line


Do

   'Get the current temperature
   I2cstart
   I2cwbyte Ds1721wr
   I2cwbyte &HAA                                            'Read 
temperature (&HAA command byte)
   I2cstart
   I2cwbyte Ds1721rd                                        'The chip 
will give register contents

'Temperature is stored as 12,5 but the ,5 first
   I2crbyte I2ctemp

'So you'll have to read twice... first the ,5
   I2crbyte I2ctemp , Nack

'And then the 12... we don't store the ,5
   I2cstop
                                                                'That's 
why we read twice.

'We give NACK if the last byte is read

   'Finally we print

Print "Temperature: " ; Str(i2ctemp) ; " degrees" ; Chr(13);

   Waitms 25

Loop
End


allerdings kommt bei mir im Terminal emulator nur sowas bei raus

xàø€€€€€x€xþ€xà€x€x€xþ€xxxøxøxx€xà€xüxxøxà€x€xàø€€€€€x€xþ€xà 
€x€x€x
þ€xxxøxøxx€xà€xüxxøxà€x€xàø€€€€€x€xþ€xà€x€x€xþ€xxxøxøxx€ 
xà€xüxx
øxà€x€xàø€€€€€x€xþ€xà€x€x€xþ€xxxøxøxx€xà€xüxxøxà€x€xàø€€€€€ 
x€xþ€xà
€x€x€xþ€xxxøxøxx€xà€xüxxøxà€x€xàø€€€€€x€xþ€xà€x€x€xþ€xxx 
øxøxx€



Ich bin echt am verzweifeln, ich komme auf keinen grünen Zweig.
Einen pull-up widerstand von scl und sda zu 5V von jeweils 4,7k hab ich 
auch angeschlossen

Lg der neugierige

von sm4ck (Gast)


Lesenswert?

Wie siehts mit mit deiner Frequenz aus?

benzutzt du die 1Mhz interne oder externe Quarze bzw Oszillatoren?

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.