Re: Using parentheses for operation order when setting an IO pin?

Originally Posted by
markedwards
After having issues with the original code, I did switch mine to
Code:
GoSub SetAllPinsHigh
Select Case Mode
Case 1
PinA = 0
Case 2
PinB = 0
Case 3
PinC = 0
Case 4
PinD = 0
Case 5
PinE = 0
End Select
Which did work and I did notice the word count dropped a bit. Your code looks like a pretty good way to do it too, thanks! Is there much difference between BRANCH and SELECT CASE? It looks like BRANCH needs GOTOs to avoid running through any following modes but is BRANCH a more simple / smaller option?
if you can change the Mode to arrive as 1-2-4-8-16 then ;
Code:
GoSub SetAllPinsHigh
PinA = ~Mode.0 '%00000001
PinB = ~Mode.1 '%00000010
PinC = ~Mode.2 '%00000100
PinD = ~Mode.3 '%00001000
PinE = ~Mode.4 '%00010000
Could work.
Last edited by sayzer; - 16th September 2018 at 09:26.
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Bookmarks