|
|
View previous topic :: View next topic |
Author |
Message |
Shep Guest
|
ASM table reads |
Posted: Thu Sep 30, 2004 5:36 am |
|
|
Hi all,
How do you extract the address of a const array for use with table reads?
i.e. :
int const lookup[16] = {0 1 2 3 ...};
#ASM
MOVLW who?
MOVWF TBLPRTU
MOVLW what?
MOVWF TBLPRTH
MOVLW where?
MOVWF TBLPRTL
TBLRD*
MOVFF TBLLAT, Result
#ENDASM
cheers |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Sep 30, 2004 1:20 pm |
|
|
The method shown below appears to work. This was tested with
PCH vs. 3.188. To verify that it works with your version of the
compiler, you should check the .LST file and the Program Memory
window (to see the location of the ROM data in the lookup array).
Code: | #include <18F458.H>
#fuses XT, NOPROTECT, PUT, NOBROWNOUT, NOWDT, NOLVP
#use delay(clock=4000000)
int const lookup[4] = {0, 1, 2, 3};
//=================================
main()
{
int16 addr;
addr = label_address(lookup);
while(1);
} |
|
|
|
Shep Guest
|
|
Posted: Thu Sep 30, 2004 2:49 pm |
|
|
Don't appear to work that one. my compiler is 3.123
and i get:
Error[72] main.c 25 : Incorrectly constructed label |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|