Hi, I'm working on a exercise to read and write from EEPROM, using E-blocks with a 16F877A and Sourceboost. I have a C-program that reads one location, and writes back the value + 1, and display the value on the LCD. This works fine e.g. with every reset or power on, I see an incremented value on the LCD. However I notice that every time I re-program the board, the EEPROM data area is reset to all 0xFF. (As viewed by PPP v3: View --> View PICmicro).
Is this expected behaviour? I would expect that EEPROM data area retaines its data, even during programming...
EEPROM gets erased during programming
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: EEPROM gets erased during programming
Hello Wim
The EEPROM erase can be disabled by going into PPP, clicking the options menu and selecting options and then unticking the boxes "Erase PICmicro before programming" and "Check that PICmicro gets erased ok".
Alternativly you can place the EEPROM data into your program using the following BoostC directives.
// Initializes EEPROM with data: 0x0C 0x22 0x38 0x48 0x45 0x4C 0x4C 0x4F 0x00 0xFE 0x99
#pragma DATA _EEPROM, 12, 34, 56, "HELLO", 0xFE, 0b10011001
The EEPROM erase can be disabled by going into PPP, clicking the options menu and selecting options and then unticking the boxes "Erase PICmicro before programming" and "Check that PICmicro gets erased ok".
Alternativly you can place the EEPROM data into your program using the following BoostC directives.
// Initializes EEPROM with data: 0x0C 0x22 0x38 0x48 0x45 0x4C 0x4C 0x4F 0x00 0xFE 0x99
#pragma DATA _EEPROM, 12, 34, 56, "HELLO", 0xFE, 0b10011001
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: EEPROM gets erased during programming
Hi Benj,
Thanks for your reply, few remarks/questions though:
1 - In Sourceboost I cannot change the options of PPP v3, and they appear always to be the default, e.g. "Erase PICmicro".
2 - When I start PPP manual (after Soourceboost created the .hex), and deselecting the two checkboxes you've mentioned, I get a failure: "Programming failed: Program memory check failed. etc... ". (NOTE: this happens only when I want to program a new version of the program. If I re-program the same .hex file again, it works. But that's obviously not much of use..)
It appears to me that the "Erase PICmicro before programming" and "Check that PICmicro gets erased ok" is also applicable for the program memory?! (flash)
_Wim_
Thanks for your reply, few remarks/questions though:
1 - In Sourceboost I cannot change the options of PPP v3, and they appear always to be the default, e.g. "Erase PICmicro".
2 - When I start PPP manual (after Soourceboost created the .hex), and deselecting the two checkboxes you've mentioned, I get a failure: "Programming failed: Program memory check failed. etc... ". (NOTE: this happens only when I want to program a new version of the program. If I re-program the same .hex file again, it works. But that's obviously not much of use..)
It appears to me that the "Erase PICmicro before programming" and "Check that PICmicro gets erased ok" is also applicable for the program memory?! (flash)
_Wim_
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: EEPROM gets erased during programming
Hello Wim
Ok it could be that the verify is picking up bits of the old program in flash and is therefore giving the error. This should not effect the operation of your program and you can even untick the verify option if you want to remove the error message. Please see this topic.
http://www.matrixmultimedia.com/mmforum ... rom#p12310
When you get the error message does your program still run ok on the hardware?
Ok it could be that the verify is picking up bits of the old program in flash and is therefore giving the error. This should not effect the operation of your program and you can even untick the verify option if you want to remove the error message. Please see this topic.
http://www.matrixmultimedia.com/mmforum ... rom#p12310
When you get the error message does your program still run ok on the hardware?
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: EEPROM gets erased during programming
Hello,
No luck... I did following:
1 - Loaded my EEPROM test program (read one loc, incr value, write back, display on LCD)
OK, LCD shows incremented value after each power off/on.
2 - start PPP, loaded a simple (.hex) program (e.g. turn on LED's), ticked off four options: "Verify..", "Perform full verify..", "Erase..", "Check..".
(Off course) PPP says all is OK (since verify is turned off), however the device doesn't work. E.g. no LED's on, and original program doesn't work either.
3 - I only ticked "Erase PICmicro", and click on "Send to PICmicro"
OK, the simple LED program works, but the EEPROM data, as viewed with PPP contains all FF again.
With respect to the other forum topic you refer to, (setting default values for the PPP option), that indeed appears to work... However it only operates on all the check boxes under "General Options", except the two "Erase PICmicro..." and "Check that PIC erased OK".
Which makes sense I guess: my conclusion is that the "Erase PICmicro" option is mandatory to clear out the flash program memory, but has the side effect that also the EEPROM data gets cleared....
No luck... I did following:
1 - Loaded my EEPROM test program (read one loc, incr value, write back, display on LCD)
OK, LCD shows incremented value after each power off/on.
2 - start PPP, loaded a simple (.hex) program (e.g. turn on LED's), ticked off four options: "Verify..", "Perform full verify..", "Erase..", "Check..".
(Off course) PPP says all is OK (since verify is turned off), however the device doesn't work. E.g. no LED's on, and original program doesn't work either.
3 - I only ticked "Erase PICmicro", and click on "Send to PICmicro"
OK, the simple LED program works, but the EEPROM data, as viewed with PPP contains all FF again.
With respect to the other forum topic you refer to, (setting default values for the PPP option), that indeed appears to work... However it only operates on all the check boxes under "General Options", except the two "Erase PICmicro..." and "Check that PIC erased OK".
Which makes sense I guess: my conclusion is that the "Erase PICmicro" option is mandatory to clear out the flash program memory, but has the side effect that also the EEPROM data gets cleared....
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: EEPROM gets erased during programming
One options for you could be to read the contents of the micro into PPP so you can see what should be in the EEPROM. Then add this information to Flowcode in the form shown above and you should be able to erase and then re-write the data back into the EEPROM as it was.
This should work a treat for a few EEPROM locations but if you are storing a lot there then this may not be desirable as it will take a while to read back the values and then manually enter them into Flowcode.
This should work a treat for a few EEPROM locations but if you are storing a lot there then this may not be desirable as it will take a while to read back the values and then manually enter them into Flowcode.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel