How to read and write EEPROM ?!?!

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to read and write EEPROM ?!?!

Jump to solution
1,483 Views
wendersonolivei
Contributor IV

Hi guys, pleas help me!

 

I should make a project with mc9s08pa16, but i don't know how i program in C the read and write on eeprom. I tried make this with ProcessorExpert, where they give me the funcitons setbyte, get byte.. but i don't know how i use that. I have to use ProcessorExpert? or have another way? and what is the codes?

Thank you!

Labels (1)
1 Solution
1,125 Views
weapon
Senior Contributor I

Hi Oliveira,

I attached one sample code for your reference.  The EEPROM routines are at the bottom of  flash.c(\TWR-S08PT60_Flash_Lab_v6\src\drivers\nvm).

Any doubt in using those routines, feel free to contact with me.

View solution in original post

4 Replies
1,126 Views
weapon
Senior Contributor I

Hi Oliveira,

I attached one sample code for your reference.  The EEPROM routines are at the bottom of  flash.c(\TWR-S08PT60_Flash_Lab_v6\src\drivers\nvm).

Any doubt in using those routines, feel free to contact with me.

1,125 Views
robertobabicz
Contributor I

Weiping Xu,

I'm developing a product with a microprocessor MC9S08PA4.

With 512 bytes of RAM.

I was watching the project: TWR-S08PT60_Flash_lab_v6.

I understand the management of the Flash and EEPROM memory.

But I see that it uses a lot of RAM to run the routines of writing and erasing flash.

I have only 512 bytes of RAM in the MC9S08PA4.

Using only the routines:

Flash_Program1LongWord

Flash_EraseSector

Occupy 299 bytes of RAM!

Am I right?

Is there another way to write the flash with the PA4 and not have to use as much RAM?

I worked with QD4 with only 256 Bytes of RAM and features doonstack.asm had no problems.

I hope you can help me,

cordially

Roberto.

0 Kudos
Reply
1,125 Views
robertobabicz
Contributor I

Weiping Xu,

Now solve the problem, run the following lines only in RAM.

NVM_FSTAT = 0x80;

while (!(NVM_FSTAT & NVM_FSTAT_CCIF_MASK));


The other lines run from the Flash.


Thank you!


Roberto

0 Kudos
Reply
1,125 Views
wendersonolivei
Contributor IV

That's helped me very much! Thank you Xu

0 Kudos
Reply