Loading a BIT array, losing my mind!


Results 1 to 5 of 5

Threaded View

  1. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Default

    Hi,
    You can't create an array of bits and then treat it as a word (as far as I know), you can however do the opposite - if you can have an array of words instead?
    Code:
    BitPatterns VAR WORD[512]
    i VAR BYTE
    
    BitPatterns[0] = %1010101010101010
    BitPatterns[1] = %0101010101010101
    BitPatterns[2] = 0
    
    For i = 0 to 23
      BitPatterns.0[i] = 1
    NEXT
    
    For i = 0 to 22 STEP 2
      BitPatterns.0[i] = 1
      BitPatterns.0[i+1] = 0
    NEXT
    Please see Melanies excellent write up.

    EDIT: I'm not sure you can actually declare an array of 512 words, look that up in the manual as it differs between different PIC series.

    /Henrik.
    Last edited by HenrikOlsson; - 19th January 2011 at 12:57.

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