View previous topic :: View next topic |
Author |
Message |
mjdale2003
Joined: 10 Oct 2004 Posts: 21 Location: UK
|
18f4455 Table read problem |
Posted: Tue Jun 28, 2005 4:48 am |
|
|
Hi, i could do with some help with my latest project i am using PCWH 3.222 and the problem is i need to create a table in c some thing like :
char const temp[8] =
{0b00111000,
0b00111100,
0b00111000,
0b00111100,
0b00111000,
0b00111100,
0b00111000,
0b00111100};
and i need to be able to read it using the TBLRD*+ in asembler like
#ASM
TBLRD*+
movff TABLAT, PORTb
#ENDASM
i know that i have to point TBLPTR to the address of the table and you cant use a pointer to a constant but after reading the previous posts on this subject i am still none the wiser.
Can any one give me some example code that creates a table as above and uses a variable to hold the address of the table, puts that address in to TABLAT and then uses an assembler loop to read the whole table and asign the value to PORTb one by one, i know its a lot to ask but iv been stuck on this for about a week now any its getting frustraiting
Kind regards
Michael Dale |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
|
Posted: Tue Jun 28, 2005 5:15 am |
|
|
Here is an example of doing it with an EEPROM. It is the same mechanism for Program memory just chainging the address.
Code: |
#define EEPROM 0xf00000
#define E_Priority 0x00 // SMS Telephone Number Priority
#define E_SMS0 0x10 // Index 0 SMS Number
#define E_SMS1 E_SMS0 + SMS_Number_Length+1 // Index 1 SMS Number
#define E_SMS2 E_SMS1 + SMS_Number_Length+1 // Index 2 SMS Number
#define E_SMS3 E_SMS2 + SMS_Number_Length+1 // Index 3 SMS Number
#rom EEPROM + E_Priority = {"\2\1\0\3"}
#rom EEPROM + E_SMS3 = {"0123456789"}
#rom EEPROM + E_SMS2 = {"0419204802"} |
_________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
|
|