Ross Myers

Table lookups (HC08)

Discussion created by Ross Myers on Sep 20, 2007
Latest reply on Sep 24, 2007 by bigmac
Hi All,
I am a little stuck on perhaps the correct syntax to do a simple table lookup (see code below).
Ignoring any additional instructions that would increment the Table pointer, what I have found is if I use the code below, the values from the Table are not getting stored in to T1MODH, instead the address location value of Table is being stored.
What is the correct syntax to use so I can point to a table location and get the value from the table to store in to T1MODH.
I also tried using -
ldhx  Table
Figuring that that is not an immediate load, but, the compiler complains I can't use that addressing mode for that command.
ldhx  #Table             
sthx  T1MODH 
 fdb   2000
 fdb   3000
 fdb   4000