On Mon, Apr 14, 2003 at 12:45:54PM -0400, John Nall wrote: > This is probably another one of my dumb newbie questions, but I have done > the necessary grunt work of reading the datasheet and the manual, and still > don't quite understand exactly how the assembler and the storage hierarchy > work together. (I am using the 18F452 and have no experience with other > chips, so the questions are in regard to only that datasheet. MPASM is the > assembler. Good overview. > > I understand that there are three separate storage areas: program memory, > data memory, and a small bit of EEPROM memory. It is my understanding > from the datasheet that all of the instructions which move data to or from > storage (that is, the instructions which involve "f") strictly operate to > or from data memory (RAM). Correct. > > It also appears to me that to pre-allocate storage in assembler language, > that one uses the CBLOCK directive, which will allocate storage in data > memory, Note that allocate simply means to assign addresses. Also I will note for Olin's sake that the uswe of absolute program or data addressing is depricated. I believe that the 'RES' directive is used for allocating relocatable data memory space. > and/or use DA, DATA, DB or DW to pre-allocate storage in program > memory. Along with DT for allocating a RETLW style table. > > How does one read/write the data allocated in data memory? If you're talking about RAM (as it seems from your statements above) it can't be done from the programmer. You use the instructions MOVWF and MOVF to move data to and from the RAM (which again is what you called data memory above). If I'm misinterpreting, please clarify. > The only way > that I see is to use the table read/write instructions. Confusion. Now it seems like your talking about the EEPROM data memory which as you pointed out is separate from data (RAM) memory. Again please clarify. > Is there another way? If EEPROM data memory? Yes. I'll proceed as if there was no confusion in your statements above... > > How does one pre-allocate storage in EEPROM memory? Very clear question. > Is this what the DE directive is for? Yes. And I'll add a bit of information on how it works. There is a set of programmer instruction for reading/writing the data EEPROM. So the programmer can preload them. However there has to be an agreement as to where that data is located in the hex file. The convention with 14 bit core parts is address 0x2100. A quick google search did not produce an answer as to the address for the 16 bit core parts. [5 minutes later] I spoke too soon. And of course it's a PICLIST thread. Put this into google: +18F452 +org +eeprom 0xF00000 See that the address is 0xF00000 You'll need that address before your DE directives. i.e. org 0xF00000 DE 1,2,3,4,5 > And same question as to how to read/write it. I'll leave the programmatic interface to someone who's actually done it. > > Sorry for not knowing more. Some day I will. :-) No problem. Good questions. BAJ -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.