Hello everybody,
I have a counter to count the number of turns. For this I need to memorize the number of turns and exceed the number 255. How can I memorize the number 300 or 1000?
Thank you in advance!
eeprom
Moderator: Benj
-
- Valued Contributor
- Posts: 1189
- Joined: Wed May 31, 2017 11:57 am
- Has thanked: 70 times
- Been thanked: 439 times
- Contact:
Re: eeprom
Hi Samtim,
You just need to save a 16 bit number - so first byte as (or Value >> 8 )and second byte as (Note for the second byte you can just use as it will be 'truncated' to 8 bits or both of which are quicker than the modulus calculation..
Martin
You just need to save a 16 bit number - so first byte as
Code: Select all
Value/256
Code: Select all
Value % 256
Code: Select all
Value
Code: Select all
Value & 0xff
Martin
Re: eeprom
Hello everybody,
A flowchart with an example would help me. I tried something, but I don't know if it's okay. Thanks Martin for the answer. Attach a flowchart.
A flowchart with an example would help me. I tried something, but I don't know if it's okay. Thanks Martin for the answer. Attach a flowchart.
- Attachments
-
- 16 bit.fcf
- (9.5 KiB) Downloaded 178 times
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: eeprom
Hi samtin,
Following this post
Attached is how I would achieve what you are after.
Note:
As EEPROM has 1,000,000 erase/write cycles, it best to write to it as infrequent as possible.
Following this post
Attached is how I would achieve what you are after.
Note:
As EEPROM has 1,000,000 erase/write cycles, it best to write to it as infrequent as possible.
- Attachments
-
- 16 bit v2.fcf
- (13.5 KiB) Downloaded 184 times
Martin
Re: eeprom
Hi Martin,
I understand better now. Thank you very much Martin. I attach a flowchart, if you want to look a little.
I understand better now. Thank you very much Martin. I attach a flowchart, if you want to look a little.
- Attachments
-
- 16 bit v3.fcf
- (10 KiB) Downloaded 185 times
Re: eeprom
Hello everybody,
It works very well, thanks to Martin alias "medelec35", thanks to Martin alias "mnf".
![Very Happy :D](./images/smilies/icon_biggrin.gif)
It works very well, thanks to Martin alias "medelec35", thanks to Martin alias "mnf".
![Very Happy :D](./images/smilies/icon_biggrin.gif)
![Very Happy :D](./images/smilies/icon_biggrin.gif)
![Very Happy :D](./images/smilies/icon_biggrin.gif)
![Very Happy :D](./images/smilies/icon_biggrin.gif)
![Very Happy :D](./images/smilies/icon_biggrin.gif)
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: eeprom
Hi samtin,
Your welcome.
Glad us martin's has helped.
Calculation box can be deleted.
I was going to use it but changed my mind.
Was in a rush for dinner so deleting it slipped my mind.
The Calculation box withcan also be deleted as was for testing only.
Although I would strongly recommend either use the calculation box to assign an initial value.
Alternatively, delete the as suggested.
Edit value variable, then assign an initial value: Reason for this is in Flowcode simulator, variables start of with an initial value of 0.
On your hardware, it will be some random value.
General rule of thumb:
If a variable is read first then it must have an initial value assigned.
If a variable is wrote first then an initial value is not required.
Your welcome.
Glad us martin's has helped.
Calculation box can be deleted.
I was going to use it but changed my mind.
Was in a rush for dinner so deleting it slipped my mind.
The Calculation box with
Code: Select all
value = 1234
Although I would strongly recommend either use the calculation box to assign an initial value.
Alternatively, delete the
Code: Select all
value = 1234
Edit value variable, then assign an initial value: Reason for this is in Flowcode simulator, variables start of with an initial value of 0.
On your hardware, it will be some random value.
General rule of thumb:
If a variable is read first then it must have an initial value assigned.
If a variable is wrote first then an initial value is not required.
Martin
Re: eeprom
Hi Mr. Martin,
Thank you very much, Mr. Martin. Any answer from you on the forum is for me a lesson and a book page for what Flowcode means.
All the best!
Thank you very much, Mr. Martin. Any answer from you on the forum is for me a lesson and a book page for what Flowcode means.
All the best!