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