Array syntax not supported


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2009
    Posts
    583

    Default Array syntax not supported

    Hi,

    I've received a PBP error when compiling a bit of code I'm playing with involving a PCA6985 chip. I started with 16 variables CH1_PWM, CH2_PWM etc and if I then have 16 repetitions of the following code it all compiles and the LEDs light to whatever value CH1_PWM, CH2_PWM etc are set to

    Code:
    pcaChannel = 0  
    i2cControl = $6 + 4*pcaChannel                              
    I2CWRITE SDApin,SCLpin,i2cWriteAddress,i2cControl,[0,0,CH1_PWM.lowbyte,CH1_PWM.highbyte]
    So in order to make the code tidier I thought I would create a 16 line word array called fadeset, and used a byte variable in a FOR / NEXT loop and came up with the following

    Code:
    for counterd = 0 to 15
    pcaChannel = counterD                                              
    i2cControl = $6 + 4*pcaChannel                            
    I2CWRITE SDApin,SCLpin,i2cWriteAddress,i2cControl,[0,0,fadeset[counterD].lowbyte,fadeset[counterD].highbyte]
    Next counterD
    But when compiled I get an PBP error "This style array not supported" pointing to the line with "I2CWRITE SDApin,SCLpin,i2cWriteAddress,i2cControl,[0,0,fadeset[counterD].lowbyte,fadeset[counterD].highbyte]" . I tried wrapping the CounterD in round brackets but that still generated the same error.

    Is there a way of taking the 16 values stored (either in 16 set word variables or a 16 line array variable) and use a FOR / NEXT loop to send the 16 values to the PCA chip?

  2. #2
    Join Date
    Sep 2009
    Posts
    737


    Did you find this post helpful? Yes | No

    Default Re: Array syntax not supported

    You can't use .BYTEX or HIGhBYTE, LOWBYTE etc with array.
    Workaround that
    Code:
    for counterd = 0 to 15
        pcaChannel = counterD                                              
        i2cControl = $6 + 4*pcaChannel  
        Tmp= fadeset[counterD]                         
        I2CWRITE SDApin,SCLpin,i2cWriteAddress,i2cControl,[0,0,Tmp.lowbyte,Tmp.highbyte]
    Next counterD
    OR
    Code:
    for counterd = 0 to 15
        pcaChannel = counterD                                              
        i2cControl = $6 + 4*pcaChannel                         
        I2CWRITE SDApin,SCLpin,i2cWriteAddress,i2cControl,[0,0, fadeset[counterD]]
    Next counterD
    If you array is word wide, PBP should send 2 byte in sequence. But I'm not sure.

Similar Threads

  1. Error: This style srray syntax not supported??????
    By comwarrior in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 21st March 2010, 01:42
  2. Is 10F220 supported ?
    By ruijc in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 26th November 2009, 21:08
  3. 16F1936 doesn't seem to be supported?
    By ShortBus in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 17th October 2009, 15:56
  4. 16F677 supported?
    By 12aBridge in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 9th October 2009, 03:27
  5. Word array behaving like byte array.... wierd
    By forgie in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 2nd August 2005, 15:43

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