FillMem or ClearMem


Closed Thread
Results 1 to 10 of 10

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    For PBP 2.60 ...

    Code:
    MyArraySize   CON 32                    ; SizeOf
    MyArray       VAR BYTE[MyArraySize]     ; The Array
    
    ARRAYWRITE  MyArray,[REP 0\MyArraySize] ; Clear Array
    DT

  2. #2
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Cool

    I've done some own work, but it is not tested:

    Code:
        asm
    ClearMem macro Array,Size                           ;Macro um Speicher zu löschen
        lfsr 0,Array
        movlw Size
        clrf POSTINC0
        decfsz WREG
        bra $-2
        endm
        endasm
    Any hints ?
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

  3. #3
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Lightbulb

    Quote Originally Posted by Darrel Taylor View Post
    For PBP 2.60 ...

    Code:
    ARRAYWRITE  MyArray,[REP 0\MyArraySize] ; Clear Array
    Does this build a loop, or is there a "heavy load" of data in the code ?
    I work with PBP 2.50C.
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    You need PBP 2.60 to use ARRAYWRITE.
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by BigWumpus View Post
    Does this build a loop, or is there a "heavy load" of data in the code ?
    Yes, it will use a loop (with 2.60).

    And in your macro above ...
    Since it uses the LFSR instruction, it will only work on 18F's.
    And 18F's are addressed by bytes instead of words, so I think the bra $-2 would need to be bra $-4.
    Otherwise, it should work.
    DT

  6. #6
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Wink

    And in your macro above ...
    Since it uses the LFSR instruction, it will only work on 18F's.
    Yes - that is know, the tiny 16Fs doesn't have so big tasks to do ... ;-)
    And 18F's are addressed by bytes instead of words, so I think the bra $-2 would need to be bra $-4.
    Otherwise, it should work.
    No - the datasheet uses a bra $-2 too and Picbasic compiles:
    Code:
    000C12 0003               M loop    sleep
    000C14 D7FE               M         bra     loop
    the same way as
    Code:
                          03868  ClearMem _bTier,_lTier                    ;Tier-Buffer löschen
    000F46 EE01 F042          M     lfsr 0,_bTier
    000F4A 0E20               M     movlw _lTier
    000F4C 6AEE               M     clrf POSTINC0
    000F4E 2EE8               M     decfsz WREG
    000F50 D7FE               M     bra $-2
    So, I think it will work for me...
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by BigWumpus View Post
    No - the datasheet uses a bra $-2 too and Picbasic compiles:
    Code:
    000C12 0003               M loop    sleep
    000C14 D7FE               M         bra     loop
    the same way as
    Code:
                          03868  ClearMem _bTier,_lTier                    ;Tier-Buffer löschen
    000F46 EE01 F042          M     lfsr 0,_bTier
    000F4A 0E20               M     movlw _lTier
    000F4C 6AEE               M     clrf POSTINC0
    000F4E 2EE8               M     decfsz WREG
    000F50 D7FE               M     bra $-2
    So, I think it will work for me...
    In the "sleep" example, the branch is going to the instruction immediately before the bra.

    In your macro, the bra needs to jump 2 instructions up to the clrf POSTINC0.
    So it will need to be -4.
    DT

  8. #8
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Unhappy

    S*it

    to late - to much wine
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

Members who have read this thread : 0

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