DriftZ Posted October 14, 2003 Report Share Posted October 14, 2003 Hi, I been trying to do some table lookup but somehow I cannot get it to work. Is there something in MIOS that requires special attention todo these things ?Or maybe it is just my lack of knowledge :(I been looking thru following documents concerning TBLRD & stuff, but I didn't get much wiser.http://www.microchip.com/download/lit/suppdoc/refernce/golden/indgate/39508.pdfftp://ftp.microchip.com/download/faqs/example/18cxxx/table.zipI even tried it with the 'old style' RETLW & PCL things... no success either... I just can't read the correct data.Or perhaps could anyone provide me with an example of the simplest table lookup that works in MIOS ?thanks a bunch Quote Link to comment Share on other sites More sharing options...
TK. Posted October 14, 2003 Report Share Posted October 14, 2003 Hi DriftZ,there are some simple examples in the SID application, see:sid_sin_table.inc (reading one entry from a table)sid_lfo_table.inc (reading two entries from a table)retlw and PCL isn't working properly on a PIC18F, you have to use the JUMPTABLE_2BYTES macro instead: MY_INCFILE_GetValue JUMPTABLE_2BYTES 8 ; entries retlw 0x01 retlw 0x42 retlw 0x03 retlw 0x74 retlw 0x35 retlw 0x23 retlw 0x84 retlw 0x23 the GetValue function has to be called in order to get the return value. However, table reads are more elegant.Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
DriftZ Posted October 15, 2003 Author Report Share Posted October 15, 2003 you have to use the JUMPTABLE_2BYTES macro insteadHuray! :)This works, splendid, thanks !I did have a look at the SID tables, but I found so many 'extra' instructions in there, too much for me to filter out the essentials... I still have to learn alot !cheerzOh btw, about tablereads... perhaps more elegant but nowhere explained on a newcomers level :-/(e.g. the example by microchip isn't exactly drowning in explanatory commenting, is it ?) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.