In that case, you can access individual bits. Let's just use the above example and I'll explain with that:
Code:
select case seven
case 1 num7 = 2
case 2 num7 = 4
case 3 num7 = 8
end select
PORTA = num7
num7 = 2 means RA1 is high. num7 = 4 means RA2 is high. num7 = 8 means RA3 is high.
So, instead of writing num7 = 2, write
Code:
RA1_bit = 1
RA2_bit = 0
RA3_bit = 0
Remove the PORTA = num7 at the bottom
Instead of writin num7 = 4, write
Code:
RA2_bit = 1
RA1_bit = 0
RA3_bit = 0
I hope you get the idea now.
>> means bit shift right.
The value of the ADC output is between 0 and 1023. >> 10 means bit shift to the right 10 times, which basically just means /1024, but executes faster.
So, the statement just scales the ADC output value to the range 0 to 500.
Hope this helps.
Tahmid.