Help! Flash EEPROM Component

For general Flowcode discussion that does not belong in the other sections.
Post Reply
seokgi
Posts: 209
http://meble-kuchenne.info.pl
Joined: Thu Dec 03, 2020 1:43 pm
Has thanked: 5 times
Been thanked: 7 times

Flowcode v10 Help! Flash EEPROM Component

Post by seokgi »

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.

mnfisher
Valued Contributor
Posts: 1546
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 138 times
Been thanked: 737 times

Re: Help! Flash EEPROM Component

Post by mnfisher »

Please give us some more info - some sample code that demonstrates the error?

seokgi
Posts: 209
Joined: Thu Dec 03, 2020 1:43 pm
Has thanked: 5 times
Been thanked: 7 times

Re: Help! Flash EEPROM Component

Post by seokgi »

What information should I provide?
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

BenR
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

Post by BenR »

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.

Post Reply