How to read and write EEPROM ?!?!

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How to read and write EEPROM ?!?!

跳至解决方案
1,484 次查看
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!

标签 (1)
1 解答
1,126 次查看
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.

在原帖中查看解决方案

4 回复数
1,127 次查看
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,126 次查看
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 项奖励
回复
1,126 次查看
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 项奖励
回复
1,126 次查看
wendersonolivei
Contributor IV

That's helped me very much! Thank you Xu

0 项奖励
回复