Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Datatable Output Issue


DamnDog Jan 29, 2016 11:17 PM

Hello, 

I am quite new to CR basic and am having issues with the output from my file.   The datatable is recording a maximum value of "7999", while I can see that the value defined as a Public  shows +10,000.  I am able to recive accurate values from other sensors that record values below "7999".  I have posted the required  code below.  It is the MConT varible that is having issues recording.  Regards,

I am using a CR1000  and am collecting the moisture content of wood.  The values returned are the resistance value of the wood. 

'Declare Public Variables
'Standard Public Varibles:
Public PTemp, batt_volt
Public Vsup 'Voltage Supplied
Public Sets, Chnum, Setnum
Public MeasureTime

'Moisture Content Public Variables
Public MConT(12)
Dim Meas(12), MCRes(12)

DataTable (TestHutData,1,-1)
DataInterval (0,10,Min,10)
Minimum (1,batt_volt,FP2,0,False)
Sample (1,PTemp,FP2)
Sample (12,MConT(),FP2)

EndTable

' Moisture Content SubRoutine - Reading from TPM pins
Sub MCRsub
'Call Measurement
VoltSe (Meas(1),10,autorange,-2,0,50000,_60Hz,1.0,0) '
For Chnum = 1 To 12
MCRes(Chnum)=(66.667E3*(Vsup-Meas(Chnum))/Meas(Chnum))*(1e-6) ' Resistivity of Wood In MegaOhms

'Filter MCRes values
If MCRes(Chnum) > 30000 Then 'Assumes empty channel if MCRes is over 30 GOhms (but could be crazy dry)
MCRes(Chnum) = NaN
EndIf
Next
EndSub

'Main Program
BeginProg

Scan (60,Sec,0,0)
If ScanFlag = "False" Then 'Initial Indoor climate sample flag
Call IndoorClimate 'Indoor Climate Subroutine
End If
NextScan
SlowSequence
Scan (120,Sec,0,0)
ScanFlag = "True" ' Turn off indoor climate scaen
PanelTemp (PTemp,250)
Battery (batt_volt)
Timer (1,uSec,0)

'Begin Moisture measurment on MUX1(L)

Sets = 12
PortSet(1,1) ' Turn on MUX I-RES
SW12 (1) 'turn on SW12
Delay(0,500,mSec)
Battery (Vsup)
Vsup = Vsup*1000 ' Convert Vsup to millivolts

For Setnum = 1 To Sets
PulsePort(2,1000)
Delay (0,500,mSec)
Call MCRsub
MConT(Setnum) = MCRes(1)
Next
SW12 (0)
PortSet(1,0)
Sets = 0

'Call data table
CallTable TestHutData
ScanFlag = "False" ' Set Flag as false for indoor climate sampleing.
MeasureTime = Timer (1,uSec,3)
NextScan
EndProg

Let me know if there is other information required, 

Cheers, 


JDavis Jan 29, 2016 11:37 PM

The problem would be resolved by changing the data type for that output from FP2 to IEEE4. The maximum value of the FP2 format is 7999.

For more information, refer to Table 12 in the CR1000 manual for the differences between data output types.

Log in or register to post/reply in the forum.