PDA

View Full Version : Eeword


BeerFizz
05-03-04, 10:19 AM
How do I use EEWORD on a structure like the following:

HERE CONSTANT *JOINTS
1500 , 1500 , 1500 , 1500 ,
1500 , 1500 , 1500 , 1500 ,


Thanks
Phil

nmitech
05-03-04, 11:58 AM
Because the IsoPod CPU uses a "Harvard" memory model, with separate Program and Data memory, you need to build ROM tables slightly differently. The best way to do this is

CREATE *JOINTS
1500 P, 1500 P, 1500 P, 1500 P,
1500 P, 1500 P, 1500 P, 1500 P,
EEWORD

P, tells IsoMax to put the value into Program space, where it can be moved to ROM by EEWORD. CREATE, among other things, tells EEWORD where the start of the ROM data is.

When you then type *JOINTS you will get the starting address of the table in ROM. (This action comes automatically from CREATE.) You can then index from that address, and use P@ (not @) to fetch from Program space. For instance,

*JOINTS 3 + P@ \ to fetch the fourth element, i.e, at index +3

BeerFizz
05-03-04, 08:07 PM
Could someone please tell me what I'm doing wrong in this fragment of code?


SCRUB
ISOMAX-START

CREATE *JOINTS
1500 P,
EEWORD

*JOINTS P@ .
99 *JOINTS P!
*JOINTS P@ .

RMDumse
05-04-04, 09:49 AM
The combination of the P, which installs something into Program RAM and the EEWORD, which moves a definition from Program RAM into Program FLASH makes the table you are generating into essentially "ROM".

So when I see the code

99 *JOINTS P!
*JOINTS P@ .

which tries to modify a table already set in "write once only" "ROM like" Flash... I'm confused to at what you are trying to do.

The code

HERE CONSTANT *JOINTS
1500 , 1500 , 1500 , 1500 ,
1500 , 1500 , 1500 , 1500 ,

works just fine in that it creates a point to the Data RAM (HERE) and then puts eight values of 1500 into the next eight Data RAM locations. Using EEWORD following the definitions works just fine.

However. the predefined values of 1500 will be lost when modified, such as in

99 *JOINTS P!

and also at power down.

Perhaps you want to create the table this way, and just put the 1500's in, during your initialization routine.

BeerFizz
05-04-04, 10:33 AM
OK, more clear.

I am slowly beginning to understand the architecture of this thing.

RMDumse
05-04-04, 10:57 AM
If you could tell me more specifically what you're trying to do I might be able to give a better explanation. But of course, sometimes it just takes working through these things before you can even say what you want. So let us know, when you're ready.