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.

Burst sampling with Sub, and SlowSequence


--dd-- Nov 27, 2025 11:50 AM

Hi,

Im trying to make a program that does someting similar as my code below (but this will not compile).

I have a main scan of 10 min, every two minutes before a full hour, I would like to start two burst samplings with a scan of 10 sec and 100 msec. 

I would prefere to avoid fast scans between :00 - :58 to save on battery.

I need the two Burst modes to be in seperate SlowSequences to avoid missing samples (my real program will not run in pipeline mode).

Any idea how I can get this to work, and made the code pretty?

Thanks,

John 

Public PTemp, Batt_volt

Sub Burst1
  SlowSequence
  Scan (10,Sec,0,0)
    PanelTemp (PTemp,15000)
    If TimeIntoInterval (0,60,Min)
      Exit Sub
    EndIf
  NextScan
EndSub

Sub Burst2
  SlowSequence
  Scan (100,mSec,0,0)
    Battery (Batt_volt)
    If TimeIntoInterval (0,60,Min)
      Exit Sub
    EndIf
  NextScan
EndSub

'Main Program
BeginProg
  Scan (10,Min,0,0)
    PanelTemp (PTemp,15000)
    Battery (Batt_volt)
    ' Do meassuremnts here...
  NextScan

  SlowSequence
  Scan (2,Min,0,0)
    If TimeIntoInterval (58,60,Min)
      Call Burst1
      Call Burst2
    EndIf
  NextScan
EndProg

--dd-- Dec 2, 2025 01:12 PM

I think I found a general solution to my problem. Instead of using 'Sub', I use 'Do...Loop' with the 'TriggerSequence' command. That does what I want.

SequentialMode

Const Burst_Period = 5
Const Burst_Intervall = 30
Const Burst_Intervall_unit = sec
Const Burst_ScanIntervall_1 = 1
Const Burst_ScanIntervall_unit_1 = sec
Const Burst_ScanIntervall_2 = 100
Const Burst_ScanIntervall_unit_2 = msec

Public Wild1, Wild2, Wild3 As Long

'Main Program
BeginProg
  Scan (10,Sec,0,0) 'main scan can be any interval
    Wild1 = RND*100
    'Do main meassuremnts here...
  NextScan

  SlowSequence '(1) Controls the burst interval
  Scan (Burst_Period,Burst_Intervall_unit,0,0)
    If TimeIntoInterval (Burst_Intervall-Burst_Period,Burst_Intervall,Sec)
      TriggerSequence (2,0) 'Trigger first burst sampling (SlowSequence 2)
      TriggerSequence (3,0) 'Trigger second burst sampling (SlowSequence 3)
    EndIf
  NextScan

  SlowSequence '(2)
  Do
    WaitTriggerSequence
    Scan (Burst_ScanIntervall_1,Burst_ScanIntervall_unit_1,0,0) 
      Wild2 = RND*100
      'Do burst meassuremnts 1 here...
      If TimeIntoInterval (0,Burst_Intervall,Burst_Intervall_unit)
        ExitScan
      EndIf

    NextScan
  Loop

  SlowSequence '(3)
  Do
    WaitTriggerSequence
    Scan (Burst_ScanIntervall_2,Burst_ScanIntervall_unit_2,0,0)
      Wild3 = RND*100
      'Do burst meassuremnts 2 here...
      If TimeIntoInterval (0,Burst_Intervall,Burst_Intervall_unit)
        ExitScan
      EndIf
    NextScan
  Loop
EndProg

 

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