Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Software-Projekte der Mitglieder (https://www.delphipraxis.net/26-software-projekte-der-mitglieder/)
-   -   [Hardware] USB-Temperatur-Sensor-Tester-fuer-DS18B20 (https://www.delphipraxis.net/181963-%5Bhardware%5D-usb-temperatur-sensor-tester-fuer-ds18b20.html)

hathor 21. Sep 2014 14:01

[Hardware] USB-Temperatur-Sensor-Tester-fuer-DS18B20
 
Liste der Anhänge anzeigen (Anzahl: 5)
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

sx2008 21. Sep 2014 14:15

AW: [Hardware] USB-Temperatur-Sensor-Tester-fuer-DS18B20
 
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.

hathor 21. Sep 2014 15:06

AW: [Hardware] USB-Temperatur-Sensor-Tester-fuer-DS18B20
 
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/

t.roller 29. Mai 2016 19:29

AW: [Hardware] USB-Temperatur-Sensor-Tester-fuer-DS18B20
 
Neuer Hardware-Link:
http://www.led-genial.de/USB-Tempera...-DS18B20-Rev-C


Alle Zeitangaben in WEZ +1. Es ist jetzt 00:52 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