Fastest way to clear array


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2008
    Posts
    66

    Question Fastest way to clear array

    Due to time limitation, what is the fastest way to clear an array without using "For ...next" loop?

    Any idea?

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Pic2008
    what is the fastest way to clear an array without using "For ...next" loop?
    Code:
    CLEAR
    But then, that clears everything.

    The fastest way really depends on the PIC, and the array size.
    Using FSR's will always be fastest.

    But this one's really easy with PBP 2.60 (fast too).
    Code:
    ArraySize   CON 64
    MyArray     VAR BYTE[ArraySize]
    
    ARRAYWRITE  MyArray,[REP 0\ArraySize]
    Last edited by Darrel Taylor; - 20th March 2010 at 04:39.
    DT

  3. #3
    Join Date
    Aug 2008
    Posts
    66


    Did you find this post helpful? Yes | No

    Default

    "Clear" means clear all variables in the RAM, or does it clear the register to the default state also eg TRISA, PORTB etc?

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Only the GP RAM, and all of it.
    <br>
    DT

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