Another CASE question
Is there an "AND" expression with CASE or can I simply use AND in the expression? I am reading the input of a 165 and need to do specific things based on the feedback of the 165 pin states. If 2 specific pins are HIGH on the 165, I need it to run one specific code.
repeat i from 0 to 7
xInputs := ina[Lever_DATA]
if xInputs == 1
case i
1: selected := 1
2: selected := 2
3: selected := 3
4: selected := 4 ' only set to 4 if just this one pin is active
5: selected := 5
6: selected := 6
4 AND 7: selected := 7 ' set selected to 7 if both pin 4 and 7 are active
outa[Lever_CLK] := 1
outa[Lever_CLK] := 0
process_pin_selection(selected)

Comments
switches := read_165 case switches %_0000_0001: ' switch 1 code %_0000_0010: ' switch 2 code %_0000_0100: ' switch 3 code %_0000_1000: ' switch 4 (only) code %_0001_0000: ' switch 5 code %_0010_0000: ' switch 6 code %_0100_1000: ' switch 7 and 4 code otherwise: ' unexpected inputs codeFor reasons I don't understand the forums editor doesn't like the binary indicator (percent sign) when a digit follows it -- hence the underscore (which you need to remove in the Propeller Tool).