'..................................................................................... Dim Mylong AsLong Dim Voltage AsSingle Dim Vol_str AsString * 10
'(
Write to Config register:
First byte: 0b10010000 (first 7-bit I2C address followed by a low read/write bit) (H90/H91 OK)
Second byte: 0b00000001 (points to Config register)
Third byte: 0b10000100 (MSB of the Config register to be written)
Fourth byte: 0b10000011 (LSB of the Config register to be written)
Write to Pointer register:
First byte: 0b10010000 (first 7-bit I2C address followed by a low read/write bit) (H90/H91 OK)
Second byte: 0b00000000 (points to Conversion register)
Read Conversion register:
First byte: 0b10010001 (first 7-bit I2C address followed by a high read/write bit)
Second byte: the ADS1113/4/5 response with the MSB of the Conversion register
Third byte: the ADS1113/4/5 response with the LSB of the Conversion register
')
'Dim V100 As Single '0.4124V 100C
'Dim V000 As Single '0.6184V 0C Dim Vnow AsSingle Dim A AsSingle Dim B AsSingle
A = 3.00194174757e002
B = -4.85436893204e002
'(
线性拟合: y=a+bx
Coefficient Data:
a = 3.00194174757E+002
b = -4.85436893204E+002
')
'************************************************************************************* Cls Do
Mylong = Get_adc(1)
Voltage = Mylong / 32768
Voltage = Voltage * 10240
Mylong = Round(voltage)
Vol_str = Str(mylong)
Vol_str = Format(vol_str , "0.0000") + " " Locate 1 , 1 Lcd Vol_str
Vnow = Val(vol_str)
Voltage = B * Vnow
Voltage = A + Voltage
Voltage = Voltage * 10
Mylong = Round(voltage)
Vol_str = Str(mylong)
Vol_str = Format(vol_str , "0.0") + " " Locate 2 , 1 Lcd Vol_str Locate 2 , 6 LcdChr(0)