NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » Saving Data Collected by a Microcontroller

December 04, 2009
by FWSquatch
FWSquatch's Avatar

I'm kicking some ideas around in my head and one of my ideas will require getting data from an input and saving it for later use by the MCU. It won't be a ton of data, just some short patterns. Any ideas about how I could do this? What kind of hardware would I need?

December 04, 2009
by pbfy0
pbfy0's Avatar

I think you should use the EEPROM.

#include <avr/eeprom.h>
uint8_t pattern[25] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25};
uint8_t i;
for(i = 0; i < 25; i++){
    eeprom_write_byte(i, pattern[i]);
}
for(i = 0; i < 25; i++){
    cpattern[i] = eeprom_read_byte(i);
}

Post a Reply

Please log in to post a reply.

Did you know that multiple microcontrollers can communicate with each other? Learn more...