Radio on - off example

From IARC 207 Wiki
Revision as of 11:11, 16 October 2015 by 24.237.158.14 (talk) (Created page with "<pre> ' Wiring: ' SW12V -- Radio Power ''' Diagnostic Variables Public batt_volt Public Flag(8) As Boolean Public radioflag As Boolean Public commscomp...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

' Wiring:
' SW12V -- Radio Power

    ''' Diagnostic Variables
    Public batt_volt
    Public Flag(8) As Boolean
    Public radioflag As Boolean  
    Public commscomplete As Boolean

BeginProg

  commscomplete = false
  radioflag=true  
  SW12 (1 )  ' turn on the radio
  Scan(30,Sec, 10, 0)
    '''''''''''''''''''''''''''''''''
    '''''''''''''''''''''''''''''''''
    '' Diagnostic Measurements  '''''
    '''''''''''''''''''''''''''''''''
    '''''''''''''''''''''''''''''''''    
    Battery(batt_volt)
    PanelTemp(Ptemp,_60Hz)
    ''''''''''''''''''''''''''''''''''''''''''''''''''''
    ''''''''''''''''''''''''''''''''''''''''''''''''''''
    '' Radio Control  ''''''''
    ''''''''''''''''''''''''''''''''''''''''''''''''''''
    ''''''''''''''''''''''''''''''''''''''''''''''''''''
      If radioflag=true Then SW12(1)
      ' if the battery voltage is high then turn the radio on hourly 
      If TimeIntoInterval(0,60,min) Then
        If batt_volt >= 12.4 Then 
          SW12(1)
        EndIf
      EndIf
      ' if the battery voltage isn't too low, turn the radio on daily.
      If TimeIntoInterval(720,1440,min) Then
        If batt_volt >= 12.2 Then 
          SW12(1)
        EndIf
      EndIf
      ' if the radioflag hasn't been set manually then turn the radio off 10 minutes into the hour.
      If TimeIntoInterval(10,60,min) OR commscomplete = true Then
        If radioflag = false Then 
          SW12(0)
          commscomplete = false
        EndIf
      EndIf      
      If batt_volt < 12.6 Then radioflag = false