Origin of Assembly Table


Results 1 to 6 of 6

Threaded View

  1. #1
    Join Date
    Feb 2010
    Posts
    11

    Default Origin of Assembly Table

    I am working on a PID controller that also does the quadrature decoding of an optical encoder (which I made tehehe). I have it basically working using assembly interrupts.

    The basic operation is to get the current encoder channels and the encoder channels from the last interrupt (interrupt on change of pin value) into one byte, which goes from 0-15 (I make sure to clear the 4 MSB bits).Then it uses a lookup table (In assembly, consisting of a PCL addition to a GOTO branch) to determine what this code means. I know it'd be faster to shift my index left by 1 or 2 places, and then have the necessary instructions on 2 or 4 lines. However, I'm not there yet.

    My main concern is that right now, I put my interrupt service routine as close the top of the code as possible, w/the table near the top of the interrupt service routine. I do this because I want the PCL to have a value that is less than 255-15, so that when I add to it jumps to the right place. According to AN556 from Microchip (http://www.engr.usask.ca/classes/EE/331/AN556.pdf) standard practice is to put an "org [address]" at the beginning of a table. What I can't figure out, even after searching quite a bit, is what is a good value for this? I've played around with it a bit, but it either doesn't compile because the address interferes w/PBP code, or crashes my code.

    Where can I determine a good value for the ORG of my table? Also, I know that the interrupt service routine needs to be near the top, is this because it has to be on the first page?

    I'm a bit confused about these pages and stuff. What's the best way to attach code?

    Please advise.

    Thanks,
    Matt
    Last edited by dksoba; - 8th February 2010 at 02:52.

Similar Threads

  1. Lookup Table
    By yasser hassani in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 11th March 2008, 10:38
  2. Assembly Guru : Question
    By Archangel in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 20th May 2007, 03:51
  3. PIC 18F452 Table Pointer/ Table Read
    By sougata in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 14th March 2006, 03:07
  4. Writing to a table.
    By Rhatidbwoy in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 24th December 2005, 16:20
  5. How do you do this in Assembly
    By ice in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 10th May 2005, 06:47

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