Hi,
I think that should work. However, since Setpoint doesn change if Setting doesn't change there's no need to assign a value to SetPoint each time thru the loop.
You can move it into the If SettingChanged section, something like:Or you could do something like:Code:If SettingChanged THEN LOOKUP Setting, [12,23,34,45,56], DutyCycle ' Assign inital value to DutyCycle variable LOOKUP Setting, [0, 2, 5, 9, 14, 17], SetPoint ' Assign value to setpoint variable SettingChanged = 0 ' Clear flag EndIfTry it, see which works best, compiles to the smallest code, is easiest to maintain and understand etc etc.Code:IF SettingChanged THEN Select Case Setting Case 1 DutyCycle = 12 'Initial dutycycle for setting 1 SetPoint = 0 Case 2 DutyCycle = 23 SetPoint = 2 Case 3 '....... '....... End Select
Good luck!
/Henrik.




Bookmarks