CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

ASM table reads

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Shep
Guest







ASM table reads
PostPosted: Thu Sep 30, 2004 5:36 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Sep 30, 2004 1:20 pm     Reply with quote

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







PostPosted: Thu Sep 30, 2004 2:49 pm     Reply with quote

Don't appear to work that one. my compiler is 3.123
and i get:
Error[72] main.c 25 : Incorrectly constructed label
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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