Hello?
I'm working on a project, but it doesn't work because I'm doing it wrong.
If you have a simple example, I'd like to refer to it.
MCU:PIC24FJ512GA606
Component:Flash EEPROM
And when communicating with Modbus RTU Slave of RS-232 base, it keeps stopping (within 10 minutes).
Other operations are fine.
When it stops, if I do a hardware reset, it works normally.
Is there a way I can do it?
Thank you.
Help! Flash EEPROM Component
-
- Posts: 209
- http://meble-kuchenne.info.pl
- Joined: Thu Dec 03, 2020 1:43 pm
- Has thanked: 5 times
- Been thanked: 7 times
Re: Help! Flash EEPROM Component
What information should I provide?
No special messages will be generated.
I will post the project I wrote.
No special messages will be generated.
I will post the project I wrote.
- Attachments
-
- 250624-Cutter-24FJ512GA606-No5-1.fcfx
- (91.32 KiB) Downloaded 15 times
-
- Matrix Staff
- Posts: 1940
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 506 times
- Been thanked: 688 times
Re: Help! Flash EEPROM Component
Hello,
The FlashEEPROM component is setup to have 256 16-bit values available however in your initialisation and write functions you are writing to address 20481. This should be in the range 0-255, probably 1 as the EEPROM component itself manages the offset address.
Secondly you are writing to the EEPROM every time around your loop. At least I think you are, the code is currently disabled. This is a big no no as you can rattle around that loop very quickly and you will quickly wear out the flash memory which is usually only good for 100,000 erase/write cycles. If possible you should only write to the EEPROM when the values you need to store change. If the values you need to store are changing constantly then you may have to try and detect a power loss event and saving to the EEPROM then.
The FlashEEPROM component is setup to have 256 16-bit values available however in your initialisation and write functions you are writing to address 20481. This should be in the range 0-255, probably 1 as the EEPROM component itself manages the offset address.
Secondly you are writing to the EEPROM every time around your loop. At least I think you are, the code is currently disabled. This is a big no no as you can rattle around that loop very quickly and you will quickly wear out the flash memory which is usually only good for 100,000 erase/write cycles. If possible you should only write to the EEPROM when the values you need to store change. If the values you need to store are changing constantly then you may have to try and detect a power loss event and saving to the EEPROM then.
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel