Hello!
Hope expert team can help me.
I am working on a project where I need to save data in eeprom. when I save data in eeprom in the various addresses and I simulate the FC is also saved and loaded again. but when I run it in the real world (PIC16F876) it is not either read back or there will not be written to addresses after I've either reset or had the power off. I made a smallere test program with only one memo to better transparency of the program, but here the same problem. What am I doing wrong. I believe that the eeprom to store the data and could read them again after disconnecting the voltage or reset (pin1).
I've almost tried everything, looked at examples in books, it looks like I'm doing the right thing
Should I do something in the config?
Best regard
Jgu1
Eeprom
Moderator: Benj
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
- Contact:
- 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
Hello,
Your configuration settings look correct and you are right that the EEPROM values should be retained during a reset or powerdown.
Could it be something to do with the EEPROM write macro. It seems that if you press the switch quick enough then the data would never be written and if you press the switch for a while the data could be written hundreds or thousands of times. The data retention for EEPROM is normally 10,000 erase write cycles so maybe that location has been burned out? Maybe try another location in EEPROM and add a large delay after your EEPROM write to see if this helps to solve the problem.
Your configuration settings look correct and you are right that the EEPROM values should be retained during a reset or powerdown.
Could it be something to do with the EEPROM write macro. It seems that if you press the switch quick enough then the data would never be written and if you press the switch for a while the data could be written hundreds or thousands of times. The data retention for EEPROM is normally 10,000 erase write cycles so maybe that location has been burned out? Maybe try another location in EEPROM and add a large delay after your EEPROM write to see if this helps to solve the problem.
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
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
- Contact:
Re: Eeprom
Hi Benj.
Thank you for your prompt reply. I took a whole new 16F876 and made a long delay 500ms, but unfortunately still the same results.
When I run the progam, it seemed to me after powering up, it not read the eproom.
I'm sure there have only been written to eeprom few times.
Hope you have more suggest´s.
Best regard
jgu1
Thank you for your prompt reply. I took a whole new 16F876 and made a long delay 500ms, but unfortunately still the same results.
When I run the progam, it seemed to me after powering up, it not read the eproom.
I'm sure there have only been written to eeprom few times.
Hope you have more suggest´s.
Best regard
jgu1
- Attachments
-
- EE1.fcf
- (14 KiB) Downloaded 305 times
- 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
Hello,
Ok looking at the code I have something for you to try.
If you go to the View -> Project Options menu.
Enable supplementary code and then add this to the defines section of the supplementary code window.
#define MX_EE_TYPE2
Then close the supplementary code window and recompile to the chip. Hopefully now any data you write to the EEPROM will be saved correctly.
Alternativly here is an updated FCD you can try. Simply copy the file into your Flowcode v4/FCD directory and restart Flowcode. Then recompile the program as is to the device and hopefully the EEPROM will be written to correctly. Let me know how you get on.
Ok looking at the code I have something for you to try.
If you go to the View -> Project Options menu.
Enable supplementary code and then add this to the defines section of the supplementary code window.
#define MX_EE_TYPE2
Then close the supplementary code window and recompile to the chip. Hopefully now any data you write to the EEPROM will be saved correctly.
Alternativly here is an updated FCD you can try. Simply copy the file into your Flowcode v4/FCD directory and restart Flowcode. Then recompile the program as is to the device and hopefully the EEPROM will be written to correctly. Let me know how you get on.
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
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
- Contact:
Re: Eeprom
Hey Benj!
YES. I am now a big question .???? and a bit confused.
I added only this # define MX_EE_TYPE2 in Supplementary code so it worked immediately . subsequently, I have overwritten the file you sent.
But now I've have some more questions.
1st. Is it a bug in FC?
2nd. Will it work on all addresses in the eeprom of 16F876?
3nd. To try something, I tested with a 16f872 same problem?
4rd. Does this mean that I can not expect the eeprom does not work in all different types Pic?
5th. If not, can I just use the command you sent to all types Pic?
Hope you understand my confusion. I have no knowledge of C and expect that when the component is there, so it works.
Hope it is not too much trouble for you.
Thank´s Benj look forward to hear from you.
jgu1
YES. I am now a big question .???? and a bit confused.
I added only this # define MX_EE_TYPE2 in Supplementary code so it worked immediately . subsequently, I have overwritten the file you sent.
But now I've have some more questions.
1st. Is it a bug in FC?
2nd. Will it work on all addresses in the eeprom of 16F876?
3nd. To try something, I tested with a 16f872 same problem?
4rd. Does this mean that I can not expect the eeprom does not work in all different types Pic?
5th. If not, can I just use the command you sent to all types Pic?
Hope you understand my confusion. I have no knowledge of C and expect that when the component is there, so it works.
Hope it is not too much trouble for you.
Thank´s Benj look forward to hear from you.
jgu1
- 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
Hello,
Great glad its working for you now. This FCD fix will be available as part of the up coming release.
1) Yes it was a small bug in the device definition file.
2) Yes all EEPROM addresses should now work correctly.
3) I've just checked the 16F872 FCD and it's correct and should work ok. i.e. it does not have the problem present in the 16F876. The devices found to have problems are 16F873, 16F874, 16F876, 16F877.
4) Most devices should be ok. Any devices found to not work, I should be able to fix fairly quickly.
5) Not all PICs have EEPROM but yes the Flowcode macros should work with all PIC devices with EE memory.
Great glad its working for you now. This FCD fix will be available as part of the up coming release.
1) Yes it was a small bug in the device definition file.
2) Yes all EEPROM addresses should now work correctly.
3) I've just checked the 16F872 FCD and it's correct and should work ok. i.e. it does not have the problem present in the 16F876. The devices found to have problems are 16F873, 16F874, 16F876, 16F877.
4) Most devices should be ok. Any devices found to not work, I should be able to fix fairly quickly.
5) Not all PICs have EEPROM but yes the Flowcode macros should work with all PIC devices with EE memory.
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
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
- Contact:
Re: Eeprom
Hello again!
Many thanks for your help. When will a new update for these errors and how I could find it?
A little history:
I made a small solar tracker system that charge some batteries (400A). These batteries powered using PIC, (and some other hardware) when it gets dark, some LED lights I have around my garden and house. I made in the program a button where I can calibrate how dark it must be before the light turned on and stores these values in Eprom. Lamp´s must then be turned on for 5 hours then turn off, and then on again when it is getting dark, but sometimes something strange happened, the light would not turn on, or turned it on several times during the day. So I got a suspicion that these values were not as they should be when I calibrated. And sure enough, after I made a small test program, (I attact) I could see they were not saved. I have now programmed a new pic with your updates and installed in the controller and, must be when it gets dark out and calibrate.
The problem was just about to make me crazy in the head.
Once again many many thanks Benj..
Best regard and a very industrious and satisfied user of FC.
jgu1
Many thanks for your help. When will a new update for these errors and how I could find it?
A little history:
I made a small solar tracker system that charge some batteries (400A). These batteries powered using PIC, (and some other hardware) when it gets dark, some LED lights I have around my garden and house. I made in the program a button where I can calibrate how dark it must be before the light turned on and stores these values in Eprom. Lamp´s must then be turned on for 5 hours then turn off, and then on again when it is getting dark, but sometimes something strange happened, the light would not turn on, or turned it on several times during the day. So I got a suspicion that these values were not as they should be when I calibrated. And sure enough, after I made a small test program, (I attact) I could see they were not saved. I have now programmed a new pic with your updates and installed in the controller and, must be when it gets dark out and calibrate.
The problem was just about to make me crazy in the head.
Once again many many thanks Benj..
Best regard and a very industrious and satisfied user of FC.
jgu1
- 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
Hello,
Glad its working well for you now. Finding the cause of a problem like that can indeed be tricky. Sounds like a great project, might have a go at something like that myself.
The new modified FCD's will be included as part of the v4.5 update which is being rolled out shortly.
Glad its working well for you now. Finding the cause of a problem like that can indeed be tricky. Sounds like a great project, might have a go at something like that myself.
The new modified FCD's will be included as part of the v4.5 update which is being rolled out shortly.
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