1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
rem VerboseSetup.bas
rem
rem last revision 3 June 2004
rem

CONST PROG_TIMEOUT = 40 // 4.0 seconds

DIM Message[] = [ "  --- ", \
                  "      ", \
                  "Enter Setpoint Setup", \
                  "Select Setpoint", \
                  "Enter Setpoint Value", \
                  "Select Setpoint Activation" ]
CONST NO_MESSAGE = 0
CONST PREFIX = 0
CONST SUFFIX = 1
CONST ENTER_SP_SETUP = 2
CONST SELECT_SETPOINT = 3
CONST SP_VALUE = 4
CONST SP_ACTIVATION = 5

DIM NoYes[] = [ "No", "Yes" ]
CONST NO = 0
CONST YES = 1

DIM BelowAbove[] = [ "Below", "Above" ]
CONST BELOW = 0
CONST ABOVE = 1

DIM Setpoints[] = [ "Exit", "SP1", "SP2", "SP3", "SP4", "SP5", "SP6" ]

////////////////////////////////////////////////////////////
Customer_ID_Macro:
////////////////////////////////////////////////////////////
write "      Verbose Setup      "
END

////////////////////////////////////////////////////////////
Reset_Macro:
////////////////////////////////////////////////////////////
#msg = NO_MESSAGE
#temp = 0
#cur_sp = 0
&TIMER1 = 0
END

////////////////////////////////////////////////////////////
Main_Macro:
////////////////////////////////////////////////////////////

   // &STATE refers to the macros edit states
   // &EDIT_STATE refers to the built-in edit states
if &STATE = 0 and &EDIT_STATE = 0 then
  if |PROG_BUTTON = on then
    if &TIMER1 > PROG_TIMEOUT then
      EDIT NO
      &EDIT_MIN = NO
      &EDIT_MAX = YES
      EDIT_TEXT NoYes[]
      #msg = ENTER_SP_SETUP
      &STATE = ENTER_SP_SETUP
    endif
  else
    &TIMER1 = 0
  endif
else
  &TIMER1 = 0
endif

if #msg <> NO_MESSAGE then
  write Message[PREFIX]
  append Message[#msg]
  append Message[SUFFIX]
endif
END

////////////////////////////////////////////////////////////
Edit_Macro:
////////////////////////////////////////////////////////////

write ""  // interrupt display

select &STATE
case ENTER_SP_SETUP:
  EXIT_EDIT
  if &EDIT_VALUE = NO then
    #msg = NO_MESSAGE
  else
    // define the label 'select_setpoint' for goto command
select_setpoint:
    EDIT 0
    &EDIT_MIN = 0
    &EDIT_MAX = 6
    EDIT_TEXT Setpoints[]
    #msg = SELECT_SETPOINT
  endif
case SELECT_SETPOINT:
  EXIT_EDIT #cur_sp
  if #cur_sp = 0 then
    #msg = NO_MESSAGE
  else
    EDIT &SETPOINT1[#cur_sp-1]
    &EDIT_MIN = -19999
    &EDIT_MAX = 99999
    &EDIT_DEF = 0
    #msg = SP_VALUE
  endif

case SP_VALUE:
  |NON_VOLATILE_WRITE = on
  EXIT_EDIT &SETPOINT1[#cur_sp-1]

  // test bit 6 of the corresponding SP CONTROL register
  // set #temp to the complement to get to Above with UP button
  // and Below with DOWN button
  #temp = ABOVE
  if (&SP1_CONTROL[#cur_sp-1] and 0x00000040) <> 0 then
    #temp = BELOW
  endif
  EDIT #temp
  &EDIT_MIN = BELOW
  &EDIT_MAX = ABOVE
  EDIT_TEXT BelowAbove[]
  #msg = SP_ACTIVATION

case SP_ACTIVATION:
  EXIT_EDIT
  // copy bits 0-5 and 7 from SP CONTROL register ==> bit 6 = 0
  #temp = (&SP1_CONTROL[#cur_sp-1] and 0x000000bf)
  if &EDIT_VALUE = BELOW then
    #temp = #temp + 0x40 // set bit 6 to 1
  endif
  |NON_VOLATILE_WRITE = on
  &SP1_CONTROL[#cur_sp-1] = #temp

  // return to setpoint selection
  goto select_setpoint

default:
  #msg = NO_MESSAGE // just in case we missed a case
endsel
&STATE = #msg
END

Download VerboseSetup.bas
(3.3 KB , Aug. 26, 2008)