PIC code to Visual Basic


Closed Thread
Results 1 to 3 of 3
  1. #1
    Simon Brodeur's Avatar
    Simon Brodeur Guest

    Default 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

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    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
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3


    Did you find this post helpful? Yes | No

    Lightbulb

    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.

    Last edited by picnaut; - 28th October 2005 at 17:41.
    ---> picnaut

Similar Threads

  1. Looking at pic basic pro symbol values in mplab 8.15a simulator
    By ukemigrant in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 16th May 2009, 13:18
  2. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  3. PIC BASIC or PIC BASIC PRO
    By kirkmans in forum USB
    Replies: 3
    Last Post: - 20th April 2007, 00:52
  4. Visual Basic 6 and Pic com
    By shawn in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 15th September 2005, 05:21
  5. Help with MPASM and PIC Basic
    By johngb in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 21st February 2003, 13:07

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts