Jack Sparrow's Blog – January 2011 Archive (1)

PIC16 Table Lookups - A Guide

A table lookup on the PIC16 basically takes the following steps:

  • Get the address of index zero of the table
  • Add the table index to the address
  • Jump to that address

The table itself is a sequence of retlw instructions, which put a value into W and return. (dt and related directives are just assembler shorthand for inserting many retlws.)



A first try at implementing a table lookup thus looks like this:…



Continue

Added by Jack Sparrow on January 28, 2011 at 1:00am — 6 Comments

Latest Blog Posts

Most Popular Blog Posts

Monthly Archives

2011

© 2024   Created by PML.   Powered by

Badges  |  Report an Issue  |  Terms of Service