Testing Bits in variables..


Closed Thread
Results 1 to 3 of 3
  1. #1

    Default Testing Bits in variables..

    Am I missing something here? I have a declared word variable and byte variable.
    Why can't I test bits in the word variable using the byte variable as the pointer?

    Count1 being 0-9 in this example. I want to test the bits in turn in positions 0-9 using a loop.

    if databyte.Count1 = 1 then

    above causes a compile error "Bad variable modifier"

  2. #2
    Join Date
    Sep 2009
    Posts
    737


    Did you find this post helpful? Yes | No

    Default Re: Testing Bits in variables..

    Try:
    if databyte.0[Count1] = 1 then

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,516


    Did you find this post helpful? Yes | No

    Default Re: Testing Bits in variables..

    Yep, see section 7.6.5 in the PBP3 manual and/or see the [url=http://www.picbasic.co.uk/forum/showthread.php?t=544&highlight=bits+bytes+wordsBit s, Bytes, Words & Arrays[/url] thread starting with Melanies excellent primer on the subject.

    /Henrik.

Similar Threads

  1. Replies: 2
    Last Post: - 23rd April 2013, 17:34
  2. Testing
    By aratti in forum Test Area
    Replies: 0
    Last Post: - 26th April 2010, 20:15
  3. Don't look! Testing
    By .W4GNS in forum Test Area
    Replies: 8
    Last Post: - 6th March 2010, 20:58
  4. DT_INTS-14 /interrupts enable bits / flag bits
    By bogdan in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 16th May 2009, 19:42
  5. testing bits
    By Darrenmac in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 13th November 2004, 00:27

Members who have read this thread : 1

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