Home > Back-end >  Temperature and humidity data acquisition - a serial port communication - Delphi7
Temperature and humidity data acquisition - a serial port communication - Delphi7

Time:10-03

Temperature and humidity data acquisition - - Delphi7, serial communication source code?

CodePudding user response:

Figure 51 MCU + before DS18B20 line temperature measurement, MAX485 transmission to the PC should not difficult also, what temperature range, precision is more high?

CodePudding user response:

Humidity has a low price module is available, the key is to know your requirements: using the environment, temperature range, accuracy, so as to know what to use sensors, different sensors, the collection procedures nature on the other hand, MCU and PC communication part, generally is the same: MAX485 + twisted-pair + PC serial port, Q 382943850

CodePudding user response:

Commercial products and similar products with China map, a complete source code, private chat Q: 188136923

CodePudding user response:

Also use a serial port, such as serial port to send to 01, Delphi according to temperature, humidity, is that ok?

CodePudding user response:

This kind of things have corresponding sensors, with a serial port protocol, you send a data in the past, the other string of data transfer to come over, very simple

CodePudding user response:

Single thread open to receive a serial port control itself, if any, as long as well send a part of their side in the agreement with respect to OK

CodePudding user response:

Using SPCOMM controls, search your download online,
Comm1.Com mName:=Trim (Comprot. Text);//serial number
Comm1. BaudRate:=strtoint (Trim (Comrate. Text));//baud rate
Comm1. Parity:=None;//
Sender:
 
Var
Buff: array [8] 1.. of byte;
The begin
Comm1. StartComm;
Sleep (100);
Buff [1] :=$00;
Buff [2] :=$00;
Buff [3] :=$00;
Buff [4] :=$00;
Buff [5] :=$00;
Buff [6] :=$00;
CRC16 @ buff, (6);
Buff [7] :=crc1;
Buff [8] :=bad startup;

If not comm1. Writecommdata (@ buff, 8) then
The begin
.
End
.
End


Receiver:
 
Procedure TForm1.Com m1ReceiveData (Sender: TObject; Buffer: Pointer;
BufferLength: Word);
Var
I: integer;
Viewstring: string;
Buff: array [0.. 19] of Byte;

The begin
Sleep (100);
Viewstring:=';
CopyMemory (@ buff, buffer, BufferLength);
Memo1. Lines. The add (+ floattostr 'temperature: (((Buff [3] * 256) + (Buff [4] mod 256)) * 0.1) + + floattostr' humidity: '(((Buff [5] * 256) + (Buff [6] mod 256)) * 0.1) +' state: '+ inttohex (Buff [7], 2));

For I:=8 to 19 do
The begin
Viewstring:=viewstring + inttohex (Buff [I], 2) + ";
end;
;
Comm1. StopComm;
end;

CodePudding user response:

It depends on what protocol you use temperature and humidity, are generally the modbus protocol
  • Related