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.

execute slowsequence entering values in public


kokihualpa May 1, 2020 05:28 PM

I want to execute a routine in slowsequence (in the program of CR1000) but when I put some values in public and so the routine start. Is it possible?


JDavis May 4, 2020 10:17 AM

 I think the below example code will answer your program. The Trigger variable is only ever set to True by a user manually changing it with connected software.

Public PTemp, Batt_volt
Public Trigger As Boolean

'Main Program
BeginProg
  Scan (1,Sec,0,0)
    PanelTemp (PTemp,60)
    Battery (Batt_volt)


    CallTable Test
  NextScan

  SlowSequence
  Scan (1,Sec,3,0)
    If Trigger Then
      Trigger = False 'Include this line if you want sequence to only run once
      
      'Add other code here.
      
    EndIf
  NextScan

EndProg

 


kokihualpa May 5, 2020 02:06 PM

Thank you very much it is work.

An aditional question:

when I want the sequence starts and with some values like for example: hour=16 , day=05 , year=20 .

like so

If Trigger AND hour AND day AND year Then
      Trigger = False 'Include this line if you want sequence to only run once
      
      'Add other code here AND THIS CODE CONTAINS THE VARS HOUR, DAY AND YEAR.
      
    EndIf


JDavis May 5, 2020 02:38 PM

Yes, you can combine conditions. I prefer to always add parentheses to make sure the order of operations is what I expect.

  If (Trigger = True) AND (hour = 16) AND (day=5) Then

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