Another CASE question
eagletalontim
Posts: 1,399
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
For 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).