Array variable access time


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2009
    Location
    Huntsville, AL
    Posts
    32

    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
    2,383


    Did you find this post helpful? Yes | No

    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
    Warning I'm not a teacher

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


    Did you find this post helpful? Yes | No

    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
    2,383


    Did you find this post helpful? Yes | No

    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.
    Warning I'm not a teacher

Similar Threads

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

Members who have read this thread : 2

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