Array variable access time


+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2009
    Location
    Huntsville, AL
    Posts
    27

    Default Array variable access time

    I posted this question on another website but did not really get a straight answer.

    If I have an array of 32 bytes defined in a variable SINB, and I execute the command "ampvar=SINB[lookbyte]", does the execution time vary as a function of index, or is the retrieval time constant? As a follow-up, are there any other suggestions that could speed up accessing an array or make it more consistent? (ex: storing in program code vs RAM).

    I am aware that there are existing sin functions in PBP, but my end intent is to scale this up once I get it working.

    Thanks in advance!
    Dave

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    1,731

    Default Re: Array variable access time

    I posted this question on another website but did not really get a straight answer.

    if my answer was not straight enough maybe your not asking the right question
    This is more entertaining than Free to Air TV

  3. #3
    Join Date
    Jan 2009
    Location
    Huntsville, AL
    Posts
    27

    Default Re: Array variable access time

    Quote Originally Posted by richard View Post
    if my answer was not straight enough maybe your not asking the right question
    Your answer specific to the "// 32" operation was extremely helpful and did indeed result in a significant speed increase. And I very much appreciate it. One of your later replies did address my first question (specifically "does an array lookup require more clock cycles than other instructions based on the array size?"), however it was after I had posted here (or perhaps I didn't see it until I had posted here). Either way, thanks again!

    Dave

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    1,731

    Default Re: Array variable access time

    thats not quite the question asked, it was

    With respect to the 'ampvar=SINB[lookbyte]' instruction, does the execution time vary as a function of index, or is the retrieval time constant?
    the only answer i could think of that made any sense was
    (thinking is the timing different for an index of 0 verses 31 is inferred)
    providing all the vars are byte sized the timing is constant regardless of index value
    does the same hold true for word arrays, i don't know you would need to examine the .lst file to be sure.

    its kind of a weird question anyway, given the largest possible pbp pic16fxxx byte array is 80 bytes, 40 for a word array. where are you going with this?

    if you used an enhanced core p16f1xxxx chip much larger arrays of any type are possible using the memory in linear access mode , in asm of course.
    you can even have huge arrays up to 14bits wide in flash accessable though the fsrx
    indirect addressing process,[lightening quick] in asm of course.
    This is more entertaining than Free to Air TV

Similar Threads

  1. Variable not getting value from array...?
    By Ioannis in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 3rd May 2016, 23:58
  2. Replies: 9
    Last Post: - 14th September 2014, 19:38
  3. Variable in array
    By Gusse in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 22nd February 2009, 19:46
  4. Access array in PBP and .asm
    By JEC in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 6th September 2008, 00:35
  5. Maximum variable array ?
    By Keith55555 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 7th May 2004, 14:29

Posting Permissions

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