On the 16F690 the EEPROM appears to accept 14 bit numbers with the number being split across two 8bit registers. The datasheet is not that clear on this. Can Flowcode use a normal 16 bit variable to enter these numbers as all the help file examples only quote up to 8 bit numbers? If I limit my number size to 14 bits will it work? I assume the EEPROM can not accept negative numbers.
I put this same question in the v5 section as I might be using v5 instead, depending on the project worked on. Are v3 and v5 any diffent in this respect?
An alternative is some C code to do it, but beyond me to write it.
EEPROM data bit size
Moderator: Benj
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
Re: EEPROM data bit size
Data EEPROM is just 8 bit, Program EEPROM/Flash is wider.
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
Re: EEPROM data bit size
Ah thanks, that claries the datasheet. I will have to divide all my values by 8 or 16 before writing them and multiply again when reading them.
Interesting that Flowcode (at least v3) produces no error message if compile using an INT variable for the data for the EEPROM. That could lead to someone inadvertantly trying to store a number >255.
Interesting that Flowcode (at least v3) produces no error message if compile using an INT variable for the data for the EEPROM. That could lead to someone inadvertantly trying to store a number >255.
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: EEPROM data bit size
Thanks. In the past I found it worked fine if I used an integer variable if I limited my integers to >=0 and <256. But I have now extended the routine to store more values in more EEPROM locations and find it is giving unusual answers when read back. Could this be because it does not consistently store integers even if limited to 256? Or reads back the stored byte to the integer variable incorrectly?
I could just save the integers to byte variables before storing them and same again upon reading, but am getting preciously short of programme space so trying not to have unnecessary lines.
I could just save the integers to byte variables before storing them and same again upon reading, but am getting preciously short of programme space so trying not to have unnecessary lines.
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: EEPROM data bit size
Hi echase,
Perhaps if you could post the flowchart that is returning strange values.
I have successfully stored and retrieved values from 0 to 32767 in 8bit EEPROM by converting int to bytes first.
Martin
Perhaps if you could post the flowchart that is returning strange values.
I have successfully stored and retrieved values from 0 to 32767 in 8bit EEPROM by converting int to bytes first.
Martin
Martin
Re: EEPROM data bit size
To be clear I am doing this by storing the integer variable straight into EEPROM. i.e. Write, location, integer variable. And Read , location, integer variable. I am hoping that as the top 8 bits of the integer will always be zeros due to limiting data to 256 Flowcode can cope with putting an integer into an 8 bit data space with no extra processing by me.
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
Re: EEPROM data bit size
Could you try ANDing the value read from eeprom with 255? To do this, just after reading a value add a calculation icon:
Code: Select all
yourvar = yourvar & 255
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
Re: EEPROM data bit size
My stupidity it seems. I was manipulating the variables incorrectly. It does seem that one can read and write to an integer variable so Flowcode must be truncating the top 8 digit of treh variable when writing. But still getting the odd funny result.