-
PIC code to Visual Basic
I run out of space on the 12F675. I must send the decoding part of my program to Visual Basic because it takes too many space. I found how to shift bits with VB 6.0 but a for simple bit isolation like this I didn't :
PATERN.bit15 = .........
How can I isolate this bit, because I have to construct 3 words bit per bit.
If some of you have experience with VB, give me tricks.
Simon Brodeur
-
case by case i guess. If you only want to test Bit 15...
One way
IF MyVar>=32768 then PlahBlahPouetPouet
The use of Logical and Bitwise operator is also another option
http://msdn2.microsoft.com/en-us/lib...US,VS.80).aspx
In conjunction with a Bit shift it will be the paradise...
MyCode=1010 0010
I want to test Bit 1 of MyVar
in PBP:
ToTest=(MyCode>>1) & 1
IF ToTest=1 then TagadaTzouinTzouin
OR
If MyCode.1=1 then JoyeuxNoel
In VB... it's a bit different
ToTes=(Mycode/2) AND 1
If ToTest=1 then DansonsLePiedDePoule
It's only math :)
-
Hi,
This has always worked fine for me in the past.
If (Value And (2 ^ Bit)) > 0 Then 'that bit must be set
'Do something
End If
Value = the word value send to the VB application from the PIC
Bit = the bit you want to test (to see if it's set or not)
Try it out and let me know how everything works out.
Cheers.
:)