Simple routine how to store data in microcontroller flash and read from it using WinAVR
I’ve been asked about how to store data table in flash memory using winavr toolset. I decided to post an answer here. Might be someone find this useful.
To demonstrate this I have set up a project using VMLAB simulator. The files you can download from here: Small project using VMLAB simulator
So I created project in VMLAB. You should read my previous article ho to do this: Using VMLAB as virtual oscilloscope
In project window I have connected 8 LED’s to port D by typing this:
D1 VDD PD0
D2 VDD PD1
D3 VDD PD2
D4 VDD PD3
D5 VDD PD4
D6 VDD PD5
D7 VDD PD6
D8 VDD PD7
Then I wrote a simple C program:
In program you see, that data can be stored in flash memory using data describing sentence:
const uint8_t digits[] PROGMEM={your data};
To make PROGMEM macro work you have to include library pgmspace.h.
Bellow you see result of simulation in VMLAB environment:

Blogsphere: TechnoratiFeedsterBloglines
Bookmark: Del.icio.usSpurlFurlSimpyBlinkDigg
RSS feed for comments on this post | TrackBack URI for this post
New on WinAVR Tutorial
Running TX433 and RX433 RF modules with AVR microcontrollers,Sometimes in embedded design you may want to go wireless. Might be you will want to log various readi …Programming AVR ADC module with WinAVR,Most of AVR microcontrollers have Analog to Digital Converter (ADC) integrated in to chip. Such solut … |
New on WinARM Tutorial
What are differences between WinARM and WinAVR,Everyone who is working with AVR microcontrollers knows this powerful tool – WinAVR (http://win …LPC2000 watchdog timer,As in all microcontrollers watchdog timers purpose isto reset microcontroller after reasonable amount … |
