Mcgee, Mark wrote : > Hi > > I'm programming my PIC project (PIC16F628A) in assembler. I > created an initialised data section idata, but I'm not sure how I can > actually make this data available to my program. If you describe what problem you think you are solving using this, it would be easier to tell. > The MPASM and MPLINK documentation gives a spectacularly > undetailed explanation of how to use this feature. Not sure about that. The online help file seems not that bad. > I gather that the initialised data gets placed in program > (non-volatile) memory, and some file register locations > (volatile) are reserved for the data. The problem I have is > how do I get the data from the non-volatile ROM to volatile > where I can use it. The 628A can not directly read it's (own) Flash memory, so it have to be RETLW instructions. Havn't tried it. Then you probably have to "call" that "lookup table" and MOVWF your values into the RAM space (reserved but not initialized by the IDATA driective). > The docs mention some kind of link script and initialisation > code but don't give any examples or suggestions, and I found a > PIC16F628Ai.lkr script on my machine, but ran out of time > this morning to have a play with it (I'm doing my > PIC stuff on my laptop on the train to and from work). > > I assume I can just add the link script to my project (it is > a relocatable code base, already using the linker). Then you must already be using a LNK script !? Or havn't you done *any* (non-error) build yet ? And you don't have to "play" with it, just add the LNK file to your project, you must do that anyway, no matter the IDATA directive... > But then what? Is there something I need to call on reset, Yes. code calling your "lookup table". Just as usual. The IDATA directive just helps creating the RETLW instructions (I think ! ). > or will all work somehow magically (I expect not)? Nothing does, does it ? :-) :-) Why not just try it and see what code MPASM spits out ? Jan-Erik. _______________________________________________ http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist