AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Projekte [Hardware] USB-Temperatur-Sensor-Tester-fuer-DS18B20

[Hardware] USB-Temperatur-Sensor-Tester-fuer-DS18B20

Ein Thema von hathor · begonnen am 21. Sep 2014 · letzter Beitrag vom 29. Mai 2016
Antwort Antwort
hathor
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
Miniaturansicht angehängter Grafiken
1-wire.jpg   ds18b20.jpg   erfos-platine_2sensors_mini.jpg   hidtemp-2014.jpg  
Angehängte Dateien
Dateityp: zip _HIDtemp-2014.zip (621,0 KB, 112x aufgerufen)
 
Benutzerbild von sx2008
sx2008

 
Delphi 2007 Professional
 
#2
  Alt 21. Sep 2014, 15:15
Nettes Projekt aber weshalb ist die wichtigste Prozedur so unvorteilhaft?
Man kann doch nicht in der gleichen Prozedur Daten von USB auslesen, die Daten dekodieren und dann auch noch auf "Form1" ausgeben.
Die Datenerhebung und die Anzeige der Daten müssen vollständig voneinander isoliert werden.
  Mit Zitat antworten Zitat
hathor
 
#3
  Alt 21. Sep 2014, 16:06
http://www.libstock.com/projects/view/104/tempsensors
http://www.rosseeld.be/DRO/PIC/DS182...20_DS18S20.pdf

Zitat:
"mikroPascal PRO for AVR is a full-featured Pascal compiler for Atmel® AVR devices. Pascal is a popular programming language that encapsulates strong data types, very nice syntax, and has probably the best balance between simplicity and control. It has intuitive IDE with docking support, rich with features, advanced text editor, many available tools, libraries and examples. Compiler uses advanced SSA optimization algorithms that reduce your generated code by an average of 20%. It is definitely an affordable solution and an excellent choice."

http://www.mikroe.com/mikropascal/avr/

Geändert von hathor (23. Sep 2014 um 15:42 Uhr)
  Mit Zitat antworten Zitat
t.roller
 
#4
  Alt 29. Mai 2016, 20:29
Neuer Hardware-Link:
http://www.led-genial.de/USB-Tempera...-DS18B20-Rev-C
  Mit Zitat antworten Zitat
Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 11:32 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz