Hi !
Please help us.
1° How to configure the resolution of the sensor readings in CR-Basic please.
Hen I downloading the single-ended readings the conversion of the readings is very high. EX.20.80134212°C. How to configure to download in 20.8 (0.1° resolution)
2°
we have a barometer that is configured as below doing readings in mbar normally.When we change the barometer setting to PA (Pascal), the readings look like this ***.*** . We need to read instead of for example 925,00 mbar .= 92500 PA. can you help us please?
'CONFIGURtipn port
SerialOpen (Com2,9600,0,10,1000)
Var=CHR(114)+CHR(13) 'CHR() = caracter "R"
'PTB210 A1A2B Barometric Pressure Sensor measurement BP_mbar
'Send command .R
SerialOut (Com2,Var,"",0,100)
Delay(0,100,msec)
'reciv datas
SerialIn (Pressao_ATM,Com2,100,13,500)
Delay(0,100,msec)
SerialFlush (Com2)
''SerialClose (Com2)
best regards
There is a Round() function. It is better to do rounding in post processing.
The example number you provided rounds cleanly. Some numbers would fit exact in a floating point number, and would still display more digits. You would end up with 0001 at the end. The only way to prevent that from ever happening is to store in string variables. String variables use a lot more storage space.
Here is an example you can use. The value for Original can be modified in table monitor to try different numbers. The FP2 data format is limited range and works for some numbers. There is a section about FP2 in the datalogger manual.
Public Original = 20.80134212 Public Rounded DataTable (TestTable,True,-1 ) DataInterval (0,10,Sec,10) Sample (1,Original,IEEE4) Sample (1,Rounded,IEEE4) Sample (1,Rounded,FP2) FieldNames("Rounded_FP2") EndTable BeginProg Scan (1,Sec,3,0) Rounded = Round (Original,1) CallTable TestTable NextScan EndProg
Regarding the numeric string, you must first copy the value from a string into a floating point variable. Then, you can do math on it to scale.
Public FromSensor As String = 92500 Public Scaled As Float BeginProg Scan (1,Sec,3,0) Scaled = FromSensor Scaled = Scaled/100 NextScan EndProg