??? 10/13/06 08:39 Read: times |
#126370 - think! Responding to: ???'s previous message |
Dear Junior! :-)
Think! You want to WRITE into FLASH (and do so only ocassionally). If it would be a simple XRAM, what would you do? You'd fill up the needed registers (data into A and address into DPTR), then you'd use a method to perform the write (movx @dptr,a). The difference here is, that the method to perform the write is more complicated than a single instruction. That method is the call of the Flash API, which is nothing else than the code snippet I gave. So, you simply replace movx @dptr,a by call FLASH_API (plus you need to fill also r1 to indicate which operation ) AT THE MOMENT WHEN YOU WANT TO WRITE into FLASH (assuming, the appropriate page has been erased already, so it's slightly more complicated). And, you don't need to be concerned about what happens at startup (after reset). Don't be bothered by 400ms and bank switching, it is done automatically, without your code doing anything. From the point of view of the application, it just means, that the application starts to run not exactly when RESET is released, but slightly later. But it starts to run exactly in the same way as if it would be a plain 8051, starting from 0000h, with initialized SFRs (as appropriate). Is it clearer now? Jan Waclawek PS. Can you please describe in details the hardware you are using? I am afraid, that if you use some sort of development board (and if it is so please post a link to it), you might be confused by some of the HW accessories present there... |