Re: 8051: writing to memory in the program
- From: Chris Hills <chris@xxxxxxxxxxxx>
- Date: Thu, 11 Jan 2007 16:31:48 +0000
In article <1168525923.353103.319400@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>, wanwan <ericwan78@xxxxxxxxx> writes
so does anyone know how I can read/write on the flash memory using Keil
in C?
Yes. By not TOP posting. Other would have flamed you for that.
the only information I found about it is an example code on the Keil
site.
Then that is your answer..... Keil are very good with their support answers and examples.
With the example code , it shows memory write to idata, pdata, data,
and xdata. I'm kind of confused by these variables.
Then you need to start with the basic 8051 architecture guide BEFORE you start to program ANYTHING.
Try
http://quest.phaedsys.org/
Document number 4 is
http://www.phaedsys.demon.co.uk/chris/papers/QuEST4_1.pdf
Which is a primer for the 8051 with the Keil compiler.
When you understand the 8051 hardware architect you will understand the multiple memory spaces this Harvard Architecture part has and therefore the various i,b,p,a, Data and CODE spaces it has.
Then the method of writing to flash will depend on the target 8051. With some you have to write byte at a time and some it is larger blocks.
And it has no
information about memory read.
After you have declared the variable, it's size and location etc you can just read it (and write to it if it is RAM.)
(And oops, AT89s52 has 256 bytes of RAM, not 2kb)
We know.
Chris Hills wrote:In article <1168498952.085962.157090@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>, -jg
<Jim.Granville@xxxxxxxxx> writes
>
>wanwan wrote:
>> I'm learning the 8051 type microcontroller now and using the Atmel
>> 89s52 microcontroller. There are 2kb of RAM and 8kb of flash memory.
>>
>> I'd like my program to be able to write some data to memory while
>> running, so these data can be remembered when power down and can be
>> retrieved at power up.
>>
>> Is there a way to do it? How do I do such a write with embedded c?
>>
>> Thanks
>
>The AT89S52 does not have 2K RAM ?
It is the flash he needs to write to so the RAM is irrelevant here
anyway,
>What I think you are seeking, is a self-pgm, or what is commonly called
>In Application Programming.
Not at all. This is for updating the application in code space not
storing data between powering down and up.
>and choose any device that has SelfPgmMemory column entry.
He is talking about DATA space not CODE space.
--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
/\/\/ chris@xxxxxxxxxxxx www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
/\/\/ chris@xxxxxxxxxxxx www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
.
- Follow-Ups:
- Re: 8051: writing to memory in the program
- From: CBFalconer
- Re: 8051: writing to memory in the program
- References:
- 8051: writing to memory in the program
- From: wanwan
- Re: 8051: writing to memory in the program
- From: -jg
- Re: 8051: writing to memory in the program
- From: Chris Hills
- Re: 8051: writing to memory in the program
- From: wanwan
- 8051: writing to memory in the program
- Prev by Date: Re: 8051: writing to memory in the program
- Next by Date: Re: Urgent Openings with the World's Leading Software Company !!!
- Previous by thread: Re: 8051: writing to memory in the program
- Next by thread: Re: 8051: writing to memory in the program
- Index(es):
Relevant Pages
|