Arraywrite can't write word variables?


+ Reply to Thread
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Feb 2013
    Posts
    852

    Default Arraywrite can't write word variables?

    Hello.
    As PBP manual states, page 35. It is possible to write word-size variables into word size array, using arraywrite statement. There is even an example.

    Code:
    stored VAR WORD[8]
    ARRAYWRITE stored, [1260,2500,10000,0,0,100,200,400]
    However, it does not works! When I try to add it into my code (which is empty and has only variable and pin defines), I'm getting the following error:

    Only BYTE datatype with constant offset allowed.

    The chip is 16F886 and no other code is loaded.

    Any ideas?

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,230


    Did you find this post helpful? Yes | No

    Default Re: Arraywrite can't write word variables?

    You are using con or byte variable to read from the array.

    Ioannis

  3. #3
    Join Date
    Feb 2013
    Posts
    852


    Did you find this post helpful? Yes | No

    Default Re: Arraywrite can't write word variables?

    I'm not reading anything
    the above quoted 2 line code from manual gives that error.
    There is no more code in the program.

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,413


    Did you find this post helpful? Yes | No

    Default Re: Arraywrite can't write word variables?

    Hmm, I can't test this right now but I think, perhaps, that particular line of example code is in error - which would be unfortunate, it being in the manual and all...
    If you look at section 5.5 you'll find:
    ARRAYWRITE

    ARRAYWRITE ArrayVar, {Maxlength, Label,}[Item...]

    Write one or more Items to byte array ArrayVar using SEROUT2 modifiers.

    ARRAYWRITE allows the writing of formatted data to a byte array which can then
    be output by other compiler commands, such as I2CWRITE, to write to a serial
    LCD, for example.
    Arraywrite is good when you want to do conversions to ASCII etc but loading constant values to an array is better done the old fashioned way, it's way more efficient:
    stored[0] = 1260
    stored[1] = 2500
    and so on.

    /Henrik.

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,230


    Did you find this post helpful? Yes | No

    Default Re: Arraywrite can't write word variables?

    You may have an older manual. I believe that mine is most recent and on page 37 that is attached here (and not 35) there is correct comment on BYTE and not WORD sized variable. Also nowhere within the manual is any state of WORD use in regard with ARRAYWRITE/ARRAYREAD.

    Ioannis
    Attached Images Attached Images

  6. #6
    Join Date
    Feb 2013
    Posts
    852


    Did you find this post helpful? Yes | No

    Default Re: Arraywrite can't write word variables?

    Haha yes, mine is different

    Name:  manual.jpg
Views: 45
Size:  418.0 KB

Similar Threads

  1. Arraywrite word
    By netstranger.nz in forum PBP3
    Replies: 0
    Last Post: - 6th August 2013, 05:22
  2. writing word variables to data memory
    By malc-c in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 6th August 2010, 09:21
  3. Replies: 13
    Last Post: - 24th April 2010, 16:44
  4. About writing word variables into the eeprom
    By Ted's in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 30th August 2008, 21:20
  5. Declaring word-variables in bank15 on a pic18f2431 ?
    By BigWumpus in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 25th October 2006, 22:32

Posting Permissions

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