??? 03/01/07 08:47 Read: times |
#134000 - Writing to flash from firmware |
Hi Guys,
I want to use part of the flash in the c8051f330 as non-voletile data storage for some constants (similar to using an EEPROM). I can't seem to get my code to do what I want and am hoping somebody can spot (what I'm sure is a very obvious and dumb) the error. Thanks, D Write_To_Flash: clr EA clr EA ; THIS CHUNK SHOULD ERASE A 512 BYTE PAGE //Set PSWE and PSEE bits in PSCTL register mov 08Fh, #2h //write flash lock keys mov FLKEY, #0A5h mov FLKEY, #0F1h //move data pointer and write to flash mov dptr, #CONST1 mov A, #0AAh movx @dptr, A //Clear bits in PSCTL mov 08Fh, #0h //Uneeded delay call BIG_ASS_DELAY //Set PSWE bit in PSCTL mov 08Fh, #01h //move data pointer and write to a particular byte in flash mov dptr, #CONST1 mov A, #012h movx @dptr, A //clear PSCTL register mov 08Fh, #0h setb EA setb EA ret CSEG AT 2049 CONSTS_FOR_PROG: Const1: ds 1 Const2: ds 2 |
Topic | Author | Date |
Writing to flash from firmware | 01/01/70 00:00 | |
pretty sure the problem is in the erase section... | 01/01/70 00:00 | |
that's another thing ... | 01/01/70 00:00 | |
this is the case when the comment IS harmful.. :-) | 01/01/70 00:00 | |
need some sleep? | 01/01/70 00:00 | |
haha, yes | 01/01/70 00:00 | |
Key sequence | 01/01/70 00:00 | |
Thanks rob | 01/01/70 00:00 | |
"hung up"? | 01/01/70 00:00 | |
14 bytes or 15? | 01/01/70 00:00 | |
Another case where the comment is harmful :-( | 01/01/70 00:00 | |
More suggestions | 01/01/70 00:00 | |
random thought | 01/01/70 00:00 | |
RE: random thought | 01/01/70 00:00 | |
What I mean by hung up | 01/01/70 00:00 | |
since I do not use this deviate | 01/01/70 00:00 | |
the vdd monitor? | 01/01/70 00:00 | |
how you determine? | 01/01/70 00:00 | |
In response to Oleg's question | 01/01/70 00:00 | |
seen this app note? | 01/01/70 00:00 | |
problem solved... | 01/01/70 00:00 | |
are you using LARGE? | 01/01/70 00:00 | |
no large or xdata var![]() | 01/01/70 00:00 |