What is the largest number that can be represented by a "word:
realolman1
Posts: 55
The title pretty much asks my question
I am thinking that I can go from 0-255 with a byte
Is it 65535?
I want an array with elements from 0-1440 .. the number of minutes in 24 hours, so I need a "word" ...is that correct?
I am thinking that I can go from 0-255 with a byte
Is it 65535?
I want an array with elements from 0-1440 .. the number of minutes in 24 hours, so I need a "word" ...is that correct?
word AnalogRecord[NumberRecords]thank you
Comments
You'll also be using only 11 bits of the word, so if you wanted to you could use the other 5 bits for flags or status indicators for events and pack that information within the stored value.
the more I think of this, maybe it is not as simple as I thought... I want an array of 1440 elements... all the values in the array will be between 0 -500 (ADC voltage conversions)
Suppose I wanted an array of 1440 elements, that the values were all above 66,000... how do I go about declaring this array?
Jim
Storing an array of longs would be the simplest approach, but it wastes space. If you don't need full precision, you could store your ADC results divided by two into an array of bytes. Since your source number is only 0 to 500, half that is 0 to 250 which fits into a byte. If you're running low on memory you can trade off speed or resolution to gain memory.