PDA

View Full Version : Data tables in ROM



Drenov
- 26th October 2010, 16:18
Hello All,

I am looking to store an 8 bit look up table in an 18F4410. I would like to use the table read instructions. I am using MPLAB and I don't know how to put the data into the code space.

I have tried :

org 0x0100
LUT:
data 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07

When that compiles the listing shows that it's been converted to a NOP

I can use :
addwf PCL,f
retlw 0x00
retlw 0x01
retlw 0x02....

But that takes 2 bytes to store each byte, and a few clocks wasted jumping about.

What is the best way to do this ? Any ideas / constructive advice always welcomed

Regards

Dren

<º))))><

mackrackit
- 26th October 2010, 17:19
Maybe you did not notice but this forum mainly deals with Pic Basic Pro.
Are you using PBP? If not you may want to try here
http://www.piclist.com/techref/piclist/index.htm
Or are you trying to save a bit by using ASM?

Drenov
- 28th October 2010, 14:32
I found I could get around it by using :

data 0x0000
data 0x0001...

(stands up)

My name is Dren and... I am an alcoholic !

(long pause)

...err, I seem to be in the wrong room ?

(shuffles off awkwardly)