Accessing a PBP array from inside an assembly language routine.


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2003
    Location
    Delaware
    Posts
    30

    Question Accessing a PBP array from inside an assembly language routine.

    Hi all,

    Its been a while since I've posted. I am wondering if anyone knows the syntax for accessing a byte array (e.g. mybuffer var byte[16]) from inside of an assembly language routine. I am trying not to force the array to a known memory location using equates. I apologize if this has been covered. I tried searching the archives but I came up empty.

    Thanks in advance,

    Joe Kupcha.

  2. #2
    Join Date
    Jul 2003
    Location
    Sweden
    Posts
    237


    Did you find this post helpful? Yes | No

    Lightbulb

    Hi Joe,

    ASM
    movlw 0x05
    movwf _YourArray + 7
    ENDASM

    This snippet should place 5 in the eighth element of YourArray.

    If you need the index to be a variable, you'll need to use the FSR and INDF registers. FSR is your index and INDF will contain the element pointed.

    This program should clear your array.

    YourArray VAR BYTE[16]
    LoopCounter VAR BYTE

    ASM
    clrf _LoopCounter
    movlw _YourArray
    movwf FSR
    Loop
    clrf INDF
    incf FSR
    incf _LoopCounter
    btfss _LoopCounter,4
    goto Loop
    ENDASM

    /Ingvar

  3. #3
    Join Date
    Feb 2003
    Location
    Delaware
    Posts
    30


    Did you find this post helpful? Yes | No

    Default Thanks

    Ingvar,

    Thanks. I was trying to use a variable for the pointer. Your examples should get me going.

    I am trying to load a ring buffer from inside an assembly language routine. I came up with a work around. I load the received character into a byte variable and increment the array pointer (with a mask to wrap it back to zero), then exit the ISR. In the main loop I check the value of the byte variable and if its not zero I load it into the next element in the array.

    Thanks again,

    Joe Kupcha.

Similar Threads

  1. Assembly Language inside PBP
    By Bill Legge in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 12th October 2009, 21:52
  2. Access array in PBP and .asm
    By JEC in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 6th September 2008, 00:35
  3. Using an Assmbly Routine in PBP
    By alanmcf in forum General
    Replies: 7
    Last Post: - 5th September 2008, 09:35
  4. Passing arrays PBP <-> Assembly
    By Charles Linquis in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th April 2006, 01:01
  5. Assembly Language + PBP
    By Charles Linquis in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 10th January 2006, 13:54

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