Jack Sparrow
  • Toronto, ON
  • Canada
Share on Facebook Share on Facebook Share
  • Blog Posts (1)
  • Discussions
  • Groups
  • Photos
  • Photo Albums
  • Videos

Jack Sparrow's Friends

  • Hollis Milroy

Gifts Received

Gift

Jack Sparrow has not received any gifts yet

Give a Gift

 

Jack Sparrow's Page

Latest Activity

Jack Sparrow commented on Ritchie Thai's blog post Tool: MPASM Pseudo Table Generator
"I actually talked about how PCLATH relates to tabling in my blog post. I'm glad you understand tabling now, though."
Jan 29, 2011
Jack Sparrow commented on Ritchie Thai's blog post Tool: MPASM Pseudo Table Generator
"I am not in AER201 now, but have been previously. Figure 7.4-2 does not indicate that there is special "table memory" any more than it indicates that your interrupt service routine must be at the end of your code. Nor does the accompanying…"
Jan 28, 2011
Jack Sparrow commented on Ritchie Thai's blog post Tool: MPASM Pseudo Table Generator
"There is no such thing as table memory. On the PIC16, "RETLW k" translates to the instruction opcode 11 01xx kkkk kkkk, while "MOVLW k; RETURN" translates to the two instruction opcodes 11 00xx kkkk kkkk; 00 0000 0000 1000. The…"
Jan 28, 2011
Jack Sparrow commented on Ritchie Thai's blog post Tool: MPASM Pseudo Table Generator
"The code this tool generates is of the form PseudoTableLookup movwf index # index = W addwf index, w # W = 2*index = 2*offset addwf PCL, f # PC = start of table + 2*index movlw '0' return movlw '1' return ... while the simplest…"
Jan 28, 2011
Jack Sparrow commented on Jack Sparrow's blog post PIC16 Table Lookups - A Guide
"Remember that the last thing a table does is retlw the lookup value, meaning you need to call the table lookup routine for it to do what you expect. Hence you'd have to use the macro as follows: ConvertBcdToAscii: call_table…"
Jan 28, 2011
Ritchie Thai commented on Jack Sparrow's blog post PIC16 Table Lookups - A Guide
"Wait. Is your name actually Jack Sparrow? I assumed for a while that it was a fake name used by an AER201 student, but your posts seem to indicate the you are a TA. Disney ripped off your name.   More relevant to the post, this code would be…"
Jan 28, 2011
Keiming Kwong commented on Jack Sparrow's blog post PIC16 Table Lookups - A Guide
"Ok awesome.  :D  woot happy i chose pic18 now..  less stuff to deal with :P"
Jan 28, 2011
Rick Zhang commented on Jack Sparrow's blog post PIC16 Table Lookups - A Guide
"The same problem is not present for PIC18. Because the programming memory is 16 bits wide, tables can be stored more efficiently. Moreover, PIC18 provides special instructions for reading from and writing to tables. Have a look at the course notes…"
Jan 28, 2011
Keiming Kwong commented on Jack Sparrow's blog post PIC16 Table Lookups - A Guide
"Is the same problem present for pic 18?"
Jan 28, 2011
Rick Zhang commented on Jack Sparrow's blog post PIC16 Table Lookups - A Guide
"Hear, hear!"
Jan 28, 2011
Jack Sparrow posted a blog post

PIC16 Table Lookups - A Guide

A table lookup on the PIC16 basically takes the following steps:Get the address of index zero of the tableAdd the table index to the addressJump to that addressThe 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:movlw TABLE_BASE # Get the address of index zeroaddwf index, w # Add the table index to the…See More
Jan 28, 2011
Jack Sparrow commented on Ritchie Thai's blog post Tip: DT location in code matters.
"Table lookups on the PIC16 work by replacing PCL with a base+offset address. Since PCL is only 8 bits, PCLATH provides the remainder of the new PC register, so the easiest solution is to ensure the entirety of any given table falls within the same…"
Jan 26, 2011
Jack Sparrow is now a member of Personal Mechatronics Lab
Jan 5, 2011

Jack Sparrow's Blog

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

Posted on January 28, 2011 at 1:00am — 6 Comments

Comment Wall (1 comment)

You need to be a member of Personal Mechatronics Lab to add comments!

Join Personal Mechatronics Lab

At 5:33pm on January 28, 2011, Ritchie Thai said…

If you don't mind my asking, and feel free to decline if you do, who are you if not a student or TA of the course. Just a helpful engineering student who was told about the site? Based on what I was told, AER201 students this year are the first people to ever actually use the site.

 
 
 

© 2017   Created by PML.   Powered by

Badges  |  Report an Issue  |  Terms of Service