Hi,
Sure, you can use Select Case. Perhaps something like
Code:
Select Case (PortB & %11000000)
Case 192
SetPoint = 19
Case 128
SetPoint = 10
Case 64
SetPoint = 2
Case 0
SetPoint = 0
End Select
But I think IF-THEN will compile to less code but execute a bit slower since it will test all four conditions even if it finds a match in the first one.
Code:
PinStates = PortB & %11000000
If PinStates = 192 THEN SetPoint = 19
If PinStates = 128 THEN SetPoint = 10
If PinStates = 64 THEN SetPoint = 2
If PinStates = 0 THEN SetPoint = 0
As with most things there are several ways of doing it and these two are likely not the only ones.
/Henrik.
Bookmarks