Storing variables

Is there an easy way to save 12 bit values in eeprom as effeciently as possible? Basically, I have to store tons of data.

If I could afford to loose the resolution,is there a way to convert 12 bit values into 8 bits, kind of like if I had an 8 bit adc to begin with?

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----

formatting link
The #1 Newsgroup Service in the World! >100,000 Newsgroups

---= East/West-Coast Server Farms - Total Privacy via Encryption =---

Reply to
Richard
Loading thread data ...

Sure. Just right shift by 4. That will throw out the 4 least significant digits. If you are measuring signals that are small compared to the reference then you could throw away the 4 most significant bits by casting the value to a uint8_t (unsigned char).

Reply to
Thomas Carley

You might consider some compression if the data is not random. If it is slowly changing then you might consider just recording the change or delta. Depending on the shape of the data you could use a lot less bits for the deltas.

Peter

Reply to
peterk

It should be hard. Take two 12-bit values and store in 3 8-bit bytes. What kind of CPU? You might do something like this:

AAAAaaaaaaaa BBBBbbbbbbbb => aaaaaaaa AAAABBBB bbbbbbbb

or other arrangements.

Shift right 4 bits?

Reply to
mc

"peterk" wrote

And if it is random, why then you can ignore it completely: after all it's only noise, so why bother storing it. (ob smiley)

Funny how the most densely compacted information looks just like complete gibberish.

--
Nicholas O. Lindan, Cleveland, Ohio
Consulting Engineer:  Electronics; Informatics; Photonics.
 Click to see the full signature
Reply to
Nicholas O. Lindan

This is the preferred method which I already thought about doing. It's a datalogger project which has to store 8 channels of a 12 bit adc once per second for 24 hours.

I take it some large battery backed SRam would be the best way to store it since flash would burn out pretty quick? I would store the actual bit values then do the conversion to engineering units on the pc when downloaded.

Haven't picked a Pic yet. Thinking about a Pic Micro or an Atmega.

Richard

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----

formatting link
The #1 Newsgroup Service in the World! >100,000 Newsgroups

---= East/West-Coast Server Farms - Total Privacy via Encryption =---

Reply to
Richard

As other suggestions, '...depending upon the actual data being stored...'

If it is analog data, you may be able to get by with storing deltas in lieu of the actual values. 12-bit values could be stored as 8-bit deltas. You may want to include a full 12-bits in there every once in a while to keep things sane.

You could also map 12-bit the samples into an 8-bit range in a non-linear way. This would maintain proper resolution when the signal level is small but still provide the capability of large-signal output.

Noel

Reply to
Noel Henson

If you have enough capacity for 24 hours of recording, that means that each byte can be written once per day. At that rate, 100,000 flash erase/write cycles will last you quite a long time. Even lowly 10k cycle flash will last for over 20 years.

Thad

Reply to
Thad Smith

per

it

See if this is something that would provide you with your storage ...

formatting link

128K * 8 NVSRAM -- will store data for up to 10 years on it's internal lithium cell. Digikey (
formatting link
) has them for about $14 each. Static CMOS ram tends to be very low power -- it may be less than the power required to write to flash for that matter.

mikey

Reply to
Mike F

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.