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.

Scan vs Data Interval


adhillman Jul 1, 2020 07:08 AM

I am attempting to take an average reading over 30 seconds, once every 5 minutes. I am new to CRBasic, and I am a little confused about the sstructure of the scan and the data interval for the table. Which of these should I be adjusting(or both?) to get my desired outputs?

Thank you in advance.


nsw Jul 7, 2020 06:31 AM

I hope i have interpreted your requirement corrctly. The following shows the sensors are measured every1s. An average of both measurements is taken every 30s. This is only calculated and put in the output table depending on the state of the public variable "TorF".

This should get what you need or at least put you in the right direction :-

Public PTemp, Batt_volt
Public TorF As Boolean         'Define Data Tables

DataTable (Test,TorF,-1)        'TorF decides if the table is output or not
  DataInterval (0,30,Sec,10)
  Average (1,Batt_volt,FP2,False)
  Average (1,PTemp,FP2,False)
EndTable

'Main Program
BeginProg
  Scan (1,Sec,0,0)
    PanelTemp (PTemp,15000)
    Battery (Batt_volt)
    If IfTime (0,5,Min) Then
      TorF = True
    Else
      TorF = False
    EndIf
    CallTable Test
  NextScan
EndProg


adhillman Jul 13, 2020 12:40 PM

Thank you, this is clear! An additional question is if there is any way to only power the sensors for the 30 seconds of data collection?

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