Store & Retrieve ULong using EEPROM.fcfx

Tips, Tricks and methods for programming, learn ways of making your programming life easier, and share your knowledge with others.

Moderators: Benj, Mods

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8440
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2412 times
Been thanked: 3451 times
Contact:

Store & Retrieve ULong using EEPROM.fcfx

Postby medelec35 » Thu Jul 24, 2014 10:31 am

I have attached a V6 flowchart for anyone who would like to store and retrieve a ULong number (0 to 4294967295) using EEPROM

The attached Flowchart stores the number 1234567890 from the cycles variable by breaking it down into for sets of bytes.
The bytes are then stored within EEPROM.
Finally the four bytes are retreived from EEPROM then assigned back to cycles variable = 1234567890.

Martin
Attachments
Store and Retrieve ULong within EEPROM V2.fcfx
(7.6 KiB) Downloaded 559 times
These users thanked the author medelec35 for the post (total 8):
Benj (Thu Jul 24, 2014 10:32 am) • jgu1 (Thu Jul 24, 2014 1:38 pm) • dazz (Thu Jul 24, 2014 2:56 pm) • Kenrix2 (Wed Aug 06, 2014 7:30 am) • Rudi (Thu Aug 28, 2014 11:29 pm) • ionize (Wed Oct 22, 2014 11:28 pm) • leoo (Tue Mar 28, 2017 8:43 am) • rudolfsteiner (Fri Nov 17, 2017 7:16 pm)
Rating: 42.11%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8440
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2412 times
Been thanked: 3451 times
Contact:

Re: Store & Retrieve ULong using EEPROM.fcfx

Postby medelec35 » Tue Aug 05, 2014 5:11 pm

Corrected an issue.
Store and Retrieve ULong within EEPROM V2.fcfx
Should now work within Flowcode simulator and on hardware.

Martin
These users thanked the author medelec35 for the post:
Benj (Tue Aug 05, 2014 5:19 pm)
Rating: 5.26%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

electron67
Posts: 289
Joined: Sat Jan 12, 2008 2:08 am
Has thanked: 102 times
Been thanked: 45 times
Contact:

Re: Store & Retrieve ULong using EEPROM.fcfx

Postby electron67 » Wed Dec 16, 2015 5:45 am

Hello Martin,
excuse my ignorance,You can help me understand how to record the ULONG numbers in the EEPROM, as I understand you recorded in the EEPROM 1, 2, 3 and 4 numbers 73, 150, 2 and 210 but if you want to record, for example 25684, 698564 , 85247, and 985746 could show me how? :?:

Thanks
Enrique

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8440
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2412 times
Been thanked: 3451 times
Contact:

Re: Store & Retrieve ULong using EEPROM.fcfx

Postby medelec35 » Wed Dec 16, 2015 6:57 pm

Hi Enrique,
You can only store bytes (0 to 255) in EEPROM with 8bit microcontrollers.
The number I was actually storing is 1234567890 which is assigned to Cycles variable.
Numbers 73, 150, 2 and 210 is the 1234567890 broken down into bytes to store within EEPROM.

If you want to store numbers from -32768 to 32767 then you only need two bytes instead of four bytes used with Ulong.

In your case the 5684, 698564 , 85247, and 985746 just replaces the 1234567890 within the flwochart I had posted.
Since they are within int range, just remove references to TotCycle3 & TotCycle4.

Martin
These users thanked the author medelec35 for the post:
electron67 (Wed Dec 16, 2015 7:14 pm)
Rating: 5.26%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

electron67
Posts: 289
Joined: Sat Jan 12, 2008 2:08 am
Has thanked: 102 times
Been thanked: 45 times
Contact:

Re: Store & Retrieve ULong using EEPROM.fcfx

Postby electron67 » Wed Dec 16, 2015 7:13 pm

Hi Martin,
I take one day to know that you were saving was number 1234567890, I thought it was part of the formula to save EEPROM, thanks anyway, the forum is an excellent way to learn. :oops:

Enrique
These users thanked the author electron67 for the post:
medelec35 (Wed Dec 16, 2015 7:28 pm)
Rating: 5.26%
 

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8440
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2412 times
Been thanked: 3451 times
Contact:

Re: Store & Retrieve ULong using EEPROM.fcfx

Postby medelec35 » Wed Dec 16, 2015 7:28 pm

Hi Enrique,
Glad you are learning from what we post!

Thanks for your feedback.
I have now edited my first post in the hope of making it all clearer.

Martin
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

electron67
Posts: 289
Joined: Sat Jan 12, 2008 2:08 am
Has thanked: 102 times
Been thanked: 45 times
Contact:

Re: Store & Retrieve ULong using EEPROM.fcfx

Postby electron67 » Wed Dec 16, 2015 11:00 pm

Thank you Martin and Benj the whole team of matrix, including all users wish you have a happy Christmas and a good year 2016


HAPPY HOLIDAYS !
Enrique
These users thanked the author electron67 for the post (total 2):
medelec35 (Wed Dec 16, 2015 11:06 pm) • Benj (Tue Dec 22, 2015 6:26 pm)
Rating: 10.53%
 

rudolfsteiner
Posts: 5
Joined: Fri Feb 06, 2015 5:54 pm
Has thanked: 1 time
Contact:

Re: Store & Retrieve ULong using EEPROM.fcfx

Postby rudolfsteiner » Fri Nov 17, 2017 7:21 pm

Hi Martin,
I had the curiosity to put the ULong number on a display and it works nicely, but 4294967295 does not display it, the display shows -1, I can not handle it, I do not know what to do.
Thank you in advance!
Attachments
4294967295.png
4294967295.png (18.16 KiB) Viewed 3908 times
1234567890.png
1234567890.png (18.09 KiB) Viewed 3908 times

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8440
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2412 times
Been thanked: 3451 times
Contact:

Re: Store & Retrieve ULong using EEPROM.fcfx

Postby medelec35 » Fri Nov 17, 2017 10:18 pm

Hi Rudolf,
I can't see all of your flowchart so will be difficult to say exactly.
I believe the issue is with Flowcode V5 & V6 the LCD can only display signed numbers.
I requested LCD in V7 to be able to display unsigned numbers like UInt & ULong.
So it was implemented

Martin
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

electron67
Posts: 289
Joined: Sat Jan 12, 2008 2:08 am
Has thanked: 102 times
Been thanked: 45 times
Contact:

Re: Store & Retrieve ULong using EEPROM.fcfx

Postby electron67 » Sat Nov 18, 2017 12:32 am

Hi

And you need to use the highest value number in Ulong :?:

rudolfsteiner
Posts: 5
Joined: Fri Feb 06, 2015 5:54 pm
Has thanked: 1 time
Contact:

Re: Store & Retrieve ULong using EEPROM.fcfx

Postby rudolfsteiner » Sat Nov 18, 2017 10:44 am

Hi Martin,
Thanks a lot for the answer, I attach a flowchart, maybe you will notice where I'm wrong.
Attachments
Store and Retrieve ULong within EEPROM V3.fcf
(11 KiB) Downloaded 58 times

rudolfsteiner
Posts: 5
Joined: Fri Feb 06, 2015 5:54 pm
Has thanked: 1 time
Contact:

Re: Store & Retrieve ULong using EEPROM.fcfx

Postby rudolfsteiner » Sat Nov 18, 2017 12:02 pm

Hi Enrique,
And you need to use the highest value number in Ulong :?:

I do not need, I just noticed a possible bug in Flowcode.