Der vorgestellte
USB-Temperatur-Sensor-Tester-fuer-DS18B20 ist ein
HID: Human Interface Device oder HIT - wie man will...
Das briefmarkengrosse Platinchen für max. 4 Sensoren vom Typ DS18B20 kostet weniger als 10 EUR.
Die Hardware und Software gibt es hier:
http://www.led-genial.de/USB-Tempera...r-fuer-DS18B20
Ich habe eine andere Software für WINDOWS angepasst.
Quelle:
http://www.libstock.com/projects/vie...ther-languages
Die wichtigste Procedure ist einfach:
Delphi-Quellcode:
// Callback procedure to capture incoming data
procedure HIDreader(Report: THIDReport; NumBytes: byte); stdcall;
var
InStr, HexStr, wertstr: AnsiString;
I: Integer;
wert : Single;
begin
InStr := '';
for I := 0 to NumBytes - 1 do InStr := InStr + CHR(Report.Data[I]);
if Report.Data[1]=1 then Form1.InputWindow.clear;
MM('Sensors found: '+ INTTOSTR(Report.Data[0]));
MM('SensorNr: ' + IntToStr(Report.Data[1]));
MM('Received: '+ INTTOSTR(NumBytes)+' Bytes');
Wert:= (Report.Data[4]+ 256 * Report.Data[5]) / 10;
wertstr:= FormatFloat('0.0', wert)+' °C';
case Report.Data[1] of
1 : Form1.S1.Caption:= wertstr;
2 : Form1.S2.Caption:= wertstr;
3 : Form1.S3.Caption:= wertstr;
4 : Form1.S4.Caption:= wertstr;
end;
HexStr := '';
for I := 1 to Length(InStr) do HexStr := HexStr + IntToHex(ORD(InStr[I]), 2) + ' ';
MM(HexStr);
MM('------------------------------------------------');
end;
Im Anhang ist der komplette Sourcecode + EXE.
Beschreibung:
ATMEL 90USB 162-16AU -
http://www.atmel.com/devices/at90usb162.aspx
Microcontroller:
AT90USB162
16 kByte Flash
16 MHz Taktfrequenz
512 Byte EEprom
64 Byte-Packet
Byte 0: Anzahl Sensoren
Byte 1: Sensor-Nummer
Byte 2: Anzahl USB-Temperatur-Reader
Byte 4 + 5: Temperatur-Wert mit 1 Dezimalstelle
Bytes 8-15: 64Bit-Unique number des Temperatursensors
http://de.wikipedia.org/wiki/Maxim_Integrated
Übernahme: 2001: „Dallas Semiconductor“ aus Dallas, Texas
http://www.maximintegrated.com/en/ap...dex.mvp/id/162
http://www.maximintegrated.com/en/pr...0.html/tb_tab0
http://www.maximintegrated.com/en/pr...k-windows.html
"Each DS18B20 has a unique 64-bit serial code, which allows multiple DS18B20s to function on the same 1-Wire bus.
The DS18B20 digital thermometer provides 9-bit to 12-bit Celsius temperature measurements and has an alarm function with nonvolatile user-programmable upper and lower trigger points. The DS18B20 communicates over a 1-Wire® bus that by definition requires only one data line (and ground) for communication with a central microprocessor. It has an operating temperature range of -55°C to +125°C and is accurate to ±0.5°C over the range of -10°C to +85°C. In addition, the DS18B20 can derive power directly from the data line ("parasite power"), eliminating the need for an external power supply.
Interface Timing
Communication with the DS18x20/DS1822 is achieved through the use of "time slots", which allow data to be transmitted over the 1-Wire bus.
Every communication cycle begins with a reset pulse from the microcontroller followed by a presence pulse from the DS18x20/DS1822"
Infos:
http://www.maximintegrated.com/en/pr...0.html/tb_tab0
http://www.pjrc.com/teensy/rawhid.html