0

I am reading an ASCII serial data values from a sensor and storing it in an unsigned integer variable. The values are ~45000 to 50000 range. I need to store 600 values and then find the minimum and maximum. after 600 values reached the oldest value is being replaced with the new value. The array size required is 600 which is approx.1200Bytes of the size of storage. I'm using Atmega 2560. I would like to know is it possible to store all 600 values in SRAM or do I need to use EEPROM memory?

3
  • 3
    The ATmega2560 has 8kB of SRAM. So yes. possible. Do you have a question, that cannot be answered by simply one word? – chrisl Oct 12 '20 at 12:15
  • If you only need the minimum and maximum, you could calculate them on the fly, and not even have to store any of the values. Add a counter, so you know when you've received 600 values. Just a thought. – Gerben Oct 12 '20 at 15:55
  • @gerban @ chrisl After reaching 600 values, the first stored value is deleted and all 599 values are shifted left, a new value is added(LIFO). This is a continuous process, from every 600 values, need to find out max.and min values. This is my requirement. – srikanth Oct 23 '20 at 4:54
0

The Atmega 2560 has 8K of static ram, more than enough for your 1200-byte array.

Reading-, and especially, writing EEPROM are very slow, and EEPROM has a rather limited lifetime-number-of-write-cycles, so it is not a good candidate for active use but rather for storing data that change infrequently and need to survive a power-down. These would typically per-system preferences, or data that needs to be stored to let the system resume at the next power-up, where it had left off when the power went down. This latter function requires that the system store enough power (capacitor or tiny battery) to keep it running long enough to sense the main power failing and still have run-time enough to write to EEPROM.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.