ASM question


Closed Thread
Results 1 to 3 of 3

Thread: ASM question

  1. #1
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107

    Default ASM question

    I'm using 18F's and I'm trying to build a small array in ASM, and then read it back with an ASM routine.

    I figured that if I defined the array in BANKA SYSTEM, I could probably get the first address of that array using the "GetAddress/CHK?RP" macro

    After that, I could incf a pointer and add it to the address to move down the array.

    Then I could use something like the movff instruction to move the contents of that location to my send buffer.

    While I know how to move the contents of one variable into another, I don't know how to move the contents of a memory LOCATION to a variable.

    Am I going about this the right way? Or is there a simple solution?
    Charles Linquist

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


    Did you find this post helpful? Yes | No

    Default Re: ASM question

    It would probably be easier to use an FSR.
    And the array doesn't need to be in BANKA so you're not limited in size.

    This shows how it could work in PBP.
    Hopefully you can see how it works with ASM too.

    Code:
    MyArray  VAR BYTE[32]
    Abyte    VAR BYTE
    X        VAR BYTE
    
    Init:
        ARRAYWRITE MyArray,["Hello World!",13,10]
    
    ;------------------------------------------
    Main:
    @   LFSR  0, _MyArray
        FOR X = 0 TO 13
    @       MOVE?BB  POSTINC0, _Abyte
            HSEROUT [Abyte]
        NEXT X
        PAUSE 1000
    GOTO Main
    DT

  3. #3
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default Re: ASM question

    Thanks Darrel,

    That is exactly what I was looking for.

    Now I'll have a fully functional I2C slave running in an ASM interrupt. Much less overhead than writing it in PBP.
    Charles Linquist

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