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 » on flash FILE i/o

April 02, 2010
by sharadgupta7
sharadgupta7's Avatar

I believe that when i write my program to the micro-controller memory, its the flash memory it goes and sits on. I don't know what is there by default in EEPROM memory say the micro-controller which i received in the box from nerdkits.

My question is :

Is it possible to say store a very small file say a.txt (e.g. contains 10 chars only) and read it from my flash program.

The other question is in what ways can i use EEPROM. how can i read/write to it? Is it advisable??

Thanks

April 02, 2010
by sharadgupta7
sharadgupta7's Avatar

Just out of curiosity, i installed AVR studio 4.

One thing which is beating me completely is the AVR programmer. It asks me to select from a list which goes like

AVR One STK600 QT600 STK500 JTAGIC mk11 AVR Dragon JTAG ICE and many more

What are these? Which one should i select for my nerdkit microcontroller? Please help.

April 02, 2010
by Rick_S
Rick_S's Avatar

Yes you can. The ATMEGA168 has 512 bytes of EEPROM available. It is a perfect place to store small strings of text. To use the eeprom, you have to include eeprom.h like this:

#include <avr/eeprom.h>

Simply place that line at the top of your program with your other includes.

Then you use...

eeprom_write_byte((uint8_t*)0,234);

To write a byte in eeprom. Where in this example, the zero would represent the location in the eeprom and the 234 would represent the value stored there.

Use...

chek_eep = eeprom_read_byte((uint8_t*)0);

To read a byte from eeprom. Where, in this example, the unsigned int chek_eep would receive the value read from memory location zero.

That's about the extent of my limited knowledge.

Hope this helps,

Rick

April 13, 2010
by BobaMosfet
BobaMosfet's Avatar

It's asking you what ISP to talk to the MCU with. If you don't have a supported ISP, then AVR Studio won't help you.

BM

April 14, 2010
by JKITSON
JKITSON's Avatar

Rick

Thanks for your post.... I have been trying to include a calibration routine on the "TRACTOR PULL SLED MONITOR". I need to be able to adjust one variable in my program after the ATmega 128 is installed in the field...

Wow thanks again

Jim

April 18, 2010
by treymd
treymd's Avatar

On AVR studio and the part where it asks for a programmer...

I am kinda new at AVR studio myself but I have encountered 2 places where that happens.

the first is when you are emulating, I have the AVRISP MKII which I do not believe is capable of any debugging in system , and that is why I believe it does not show up in the emulator list.

However it DOES show up in the programming list when I go to write the bootloader and program the fuses on a real uC.

Post a Reply

Please log in to post a reply.

Did you know that you can control 120 LEDs with just 17 microcontroller pins? Learn more...