Temperaturüberwachung mit Dallas DS1820
Liest bis zu 127 DS1820-Temperatursensoren aus und gibt die gemessenen Temperaturen über eine serielle Schnittstelle (RS232) aus. Mögliche Messintervalle sind 1, 5, 10, 30 Sekunden bzw. 1-50 Minuten, das Intervall und der Betriebsmodus (auf Kommando oder kontinuierlich) wird im DS1820 mit der kleinsten Adresse dauerhaft gespeichert.
Interface RS232 ⇔ DS1820 (bis zu 127 Stück)

/* ds1820mes.c Strobl 1999-08-02 / 2002-06-09 (C) Copyright 1999, 2002 by Wolfgang Strobl, all rights reserved [...] Version for 12c672 processor, English docs Purpose Read and decode Dallas DS1820 temperature sensors wired through a "1-wire" (tm) bus, optionally drive a single fan, 9600 Baud serial interface for input and output. Features * Command driven, command input via RS232, data output via RS232 messages * Enumerates up to 127 Dallas DS1820 "1-wire" temperature sensors wired to a single pin (pin_4 / GP4) * Read serial no, read scratchpad, get temperature, output result in degrees Celsius. * Check CRC for serial no and scratchpad * "parasite power" is supported in this version, only two wires needed * Use one of the DS1820 on the bus for storing the time between two measurements (because the 12c672 has no EEPROM). * Pure C, no external or inline assembly required * 4MHz operation, exact calibration necessary for software RS232 How to wire: All DS1820 in parallel: ground, Pin A4, ground. Up to 127 4,7k Pullup on Pin-A4. RS232out via GP2 (protected by a 10k resistor) RS232in via GP5 (protected by a 10k resistor) DS1820 via GP4 (4,7k Pullup) FAN via GP1 (use a switch transistor as you see fit) Links: DS1820 http://www.dalsemi.com 12C672 http://www.microchip.com
Beispieloutput:
DS1820-8 2.43 (C) strobl@unser.net 99-08-2 . for menu # 1. 10 c0 71 26 00 00 00 bd 22.5 C 2230 # 2. 10 1b 70 26 00 00 00 4c 22.0 C 2189 # 3. 10 47 a8 26 00 00 00 7f 22.5 C 2252 ( # 1. 10 c0 71 26 00 00 00 bd 22.5 C 2231 # 2. 10 1b 70 26 00 00 00 4c 22.0 C 2189 # 3. 10 47 a8 26 00 00 00 7f 22.5 C 2253 ) v, d1..d9, ?, f, F, b<x>, m, c to continue>. d 2 D 10 s. ...written >m # 1. 10 c0 71 26 00 00 00 bd 22.5 C 2230 # 2. 10 1b 70 26 00 00 00 4c 22.0 C 2182 # 3. 10 47 a8 26 00 00 00 7f 22.5 C 2255 >F >b 01 >? SP: 2d 00 32 32 ff ff 11 57 19 >c ( # 1. 10 c0 71 26 00 00 00 bd 22.5 C 2231 # 2. 10 1b 70 26 00 00 00 4c 21.5 C 2173 # 3. 10 47 a8 26 00 00 00 7f 22.5 C 2257 ) ( # 1. 10 c0 71 26 00 00 00 bd 22.5 C 2230 # 2. 10 1b 70 26 00 00 00 4c 21.5 C 2173 # 3. 10 47 a8 26 00 00 00 7f 22.5 C 2258 ) ( # 1. 10 c0 71 26 00 00 00 bd 22.5 C 2231 # 2. 10 1b 70 26 00 00 00 4c 21.5 C 2171 # 3. 10 47 a8 26 00 00 00 7f 22.5 C 2258 )
Im obigen Beispiel sind z.B. nur drei Sensoren angeschlossen, maximal möglich sind (aufgrund der Konstruktion des Programms) 127 verschiedene Sensoren.
Beispielauswertung

Olivetti M10 als Steuer- und Anzeigeeinheit
Ein Trivialprogramm liest einen Sensor kontinuierlich aus und stellt die Messwerte wie ein Kurvenschreiber dar.
Status
Dieses kleine Bastelprojekt liegt nun seit gut zehn Jahren halbfertig auf Eis. Der Code basiert auf dem Zeitverhalten des von einer alten Version eines kommerziellen C-Compilers erzeugten Maschinenprogramms, er entspricht meinen Qualitätsanforderugen nicht mehr und steht auch deswegen nicht mehr zur Verfügung, sorry.
