Storing variables

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
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?









Re: Storing variables
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).


"Richard" <rwskinner ATawesomenet Dot net> wrote in message
Quoted text here. Click to load it



Re: Storing variables
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


Re: Storing variables

Quoted text here. Click to load it

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.
We've slightly trimmed the long signature. Click to see the full one.
Re: Storing variables

"Richard" <rwskinner ATawesomenet Dot net> wrote in message
Quoted text here. Click to load it

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.

Quoted text here. Click to load it

Shift right 4 bits?



Re: Storing variables
Quoted text here. Click to load it

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






Re: Storing variables
 >  It's a
Quoted text here. Click to load it

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


Re: Storing variables

Quoted text here. Click to load it
per
it

See if this is something that would provide you with your storage ...
http://focus.ti.com/lit/ds/slus121/slus121.pdf
128K * 8 NVSRAM -- will store data for up to 10 years on it's
internal lithium cell.  Digikey ( http://www.digikey.com ) 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




Re: Storing variables

Quoted text here. Click to load it

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


Site Timeline