We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I am finding conflicting information regarding the use of Flash memory. Some information indicates that all Flash memory is for code only, while other information implys that Flash can be used for code and data both. I get the impression that data storage in Flash is something that can be done on some parts and not others, but can't find any information on manufacturers websites that clarifies the issue. Is there any good information out there that will tell me what is what? I am looking at 8051 based parts - Atmel & Philips mostly. Thanks, Scott Kelley
There's no general answer. Flash stores bits; all else being equal, those could be "data" bits or "program" bits. It's just a question of whether or not that particular memory is wired to respond to the 8051 core's instruction fetch cycle, or data read/write cycles. Either (or both) can work. So, the answer for any specific part has to lie in the manufacturer's data sheet. The Atmel T89C51IC2, for example, says it has 32k flash "program / data memory". They describe some built-in API calls for programming the flash from software. So there's no reason you couldn't use some of that memory for "data" instead of "code"; at worst, you'd have to access it with MOVC instructions instead of MOVX. The Atmel AT89C51, on the other hand, sports 4k of "in system reprogrammable flash memory" -- but if you read further you'll notice that they refer to "every code byte in the flash array", and notice that the programming waveforms all involve the *PSEN (program store enable) signal. So, it looks like to me that this part is only intended to use flash as program store; it says nothing about making the flash visible in the data store address space. I agree that the data sheets can be unclear. (There's always tech support from the maker; serves 'em right if they can't write clear documentation...) Did you have any specific parts in mind?