Make your own free website on Tripod.com

BUTTERFLY BEGINNERS SITE

BASIC AVR ARCHITECTURE

HOME
YAHOO GROUP
BUTTERFLY FAQ
FORUM
FRONT PICTURE
PINOUTS
LCD PORT USE
BACK PICTURE
PC SERIAL CONN
BLOCK DIAGRAM
ARCHITECTURE
BUTTERFLY PRIMER
BEEP PROGRAM
SOUND EFFECTS
WHITE NOISE GENERATOR
THEREMIN MUSIC PROGRAM
BLINK PROGRAM
SIMPLE TIMER PROGRAM
SIMPLE TIMER II PROGRAM
8 BIT INTERUPT TIMER
TICK SECONDS PROGRAM
90 HR CLOCK PROGRAM
90 HR CLOCK II PROGRAM
READ TEMPURATURE PROGRAM
HELLO WORLD PROGRAM
SCROLLING TEXT PROGRAM
JOYSTICK TEST PROGRAM
RANDOM NUMBER GENERATOR
TURBO CHARGE
AVR ASSEMBLER
MCU SCHEMATIC
JOY SCHEMATIC
SPK SCHEMATIC
LCD SCHEMATIC
FLASH SCHEMATIC
LDR SCHEMATIC
NTC SCHEMATIC
VIN SCHEMATIC
PORTB SCHEMATIC
PORTD SCHEMATIC
UART SCHEMATIC
ISP SCHEMATIC
USI SCHEMATIC
JTAG SCHEMATIC
VCC SCHEMATIC
XTL SCHEMATIC
ALTERNATE PORT PIN USES
[SUPERFLY]
AVR BOOK
AVR STUDIO TUTORIAL
ATMEL CORP WEB SITE
BUTTERFLY WIKI
ATMEL AVR WIKI
PROJECTS

atmel.jpg

 
VON NEUMANN vs. HARVARD ARCHITECHTURE
 
If you are new to Microcontrollers one of the arguments you are going to hear bantered about is Harvard Architecture versus the Von Neumann Architecture.
 
 
THE VON NEUMANN ARCHITECTURE

Most computers we are familiar with use an architecture called Von Neumann. The term arose out of Neumann's 1945 draft report on the ADVAC computer. He was not, however the original inventor of it.
 
                                       +---------+
                                       |   RAM   |
                                       | - - - - |
                           BottleNeck  | PROGRAM |
                    [CPU] <==========> | - - - - |
                                       |  DATA   |
                                       +---------+
 
A Von Neumann machine has one large monolithic RAM structure that contains both program memory and data memory mixed together. Since both program steps and data must be loaded from the same place, it can create a problem called the Von Neumann Bottle-Neck.


THE HARVARD ARCHITECTURE
 
Most microcontrollers use a different system called Harvard architecture. The larger program storage and the smaller data memory are separated. The first such machine, the Harvard Mark I had it's programs hard-coded on paper-tape and the volatile data was loaded into electric relays.
 
 
                +----------+                     +------+
                |  PROGRAM |                     | DATA |
                |   ROM    | <----> [CPU] <----> | RAM  |
                +----------+                     +------+
 
 
Harvard style machines allow program steps to be fetched at the same time as data, thereby creating potentially faster through-put and less of a bottle-neck. They also have the benefit that run away processes can't damage the program stored in the non-volatile program area so they're more stable. Many C programs lack proper boundary checking and a null pointer or an over-run buffer can overwrite and crash a program that shares RAM with data.

If you are new to this architecture you need to keep this in mind. When creating a routine that needs a few bytes of storage, I would normally create that space within the routine itself. On a Harvard machine, those bytes would not be in volatile RAM but part of the hard coded program memory stored in ROM (or FlashRAM).

 

AVR BUTTERFLY PROGRAM SPACE (FLASH)
 
The AVR Butterfly (Atmega169) program space is 16K long and is divided into two main areas. The top 1-2K and is usually loaded with a bootloader that is protected from an overwrite and the rest is available for your programs. At the beginning of each program space is an area for interupt vectors. The first such vector is the Power-Up/Reset Vector and should contain an RJMP to the first line of your program.
 
 
   .---------------------------------------------------.
   | POWER-UP VECTOR (NORMALLY POINTS TO YOUR PROGRAM) |
   |             OTHER INTERUPT VECTORS                |
   |- - - - - - - - - - - - - - - - - - - - - - - - - -|
   |                                                   |
   |           YOUR PROGRAM SPACE (14-15K)             |
   |                                                   |
   |                                                   |
   .---------------------------------------------------.
   |           BOOT:INTERUPT VECTORS                   |
   |- - - - - - - - - - - - - - - - - - - - - - - - - -|
   |        BOOTLOADER PROGRAM SPACE (1-2K)            |
   `---------------------------------------------------'
 

AVR BUTTERFLY DATA SPACE (SRAM)
 
The data space on the AVRs is a little unusual. The 32 internal accumulators are memory mapped as the first 32 bytes of data memory, followed by all the I/O ports which are mapped into memory space followed by the 1K of actual SRAM starting at $100.
 
 
   .---------------------------------------------------.
   |$00-$1F: 32 Internal Accumulator/Working-Registers |
   +---------------------------------------------------+
   |$20-$5F:    64 Input/Output Ports                  |
   |-   -   -   -   -   -   -   -   -   -   -   -   -  |
   |$60-$FF     160 Extra I/O Ports                    |
   +---------------------------------------------------|
   |$100                                               |
   |           1024 Bytes SRAM $100 to $4FF            |
   |                                                   |
   |                                                   |
   |-   -   -   -   -   -   -   -   -   -   -   -   -  |
   |$4FF    (Normal Location for Stack)                |
   `---------------------------------------------------'

The AVR Butterfly is a credit-card sized demo board from Atmel that is feature-packed and retails for under $20 US. The AVR Butterfly is a self-contained, battery-powered demonstration board running theATMEL AVR ATmega169v Microcontroller. The Butterfly board includes an LCD display screen, joystick, speaker, RS232 serial/modem/terminal port, flash RAM chip, temperature, light, voltage & Anolog-to-Digital sensors, serial EEPROM chip and internal EEPROM for data storage. The board has a shirt pin on its back and can be worn as a portable electronic scrolling name badge after you enter your own name. The AVR Butterfly comes preloaded with software to demonstrate the capabilities of the microcontroller. The factory firmware can scroll your name, display the sensor readings like tempurature or light levels. It can show the time. The AVR Butterfly has a piezo speaker that can reproduce music and sounds. The AVRButterfly demonstrates LCD driving by running a 14-segment, 6 alpha-numeric character display. The Butterfly's ATmega 169v CPU is capable of speeds up to 8Mhz. it is factory set by software to 2Mhz to preserve the button battery life. A pre-installed bootloader program allows the board to be re-programmed with a standard RS-232 serial plug. Just look at what it has to offer: Atmega169 MCU 32 x 8-Bit Registers 16K Flash (Program) RAM 512 Byte EEPROM 1K SRAM for Data 2 x B-Bit Timers 1 x 16-Bit Timer 4 PMW Channels UART 100 Segment LCD Display 4 MegaBit (512K Byte) DataFash 32KHz OScillator for RTC 4 Way Joystick Light Sensor (LDR) Tempurature Sensor (NTC) Speaker for Sound Generation Multiple Header Connectors JTAG Port 2 x 8-Bit General I/O Ports ISP Port USI Port RS-232 Level Converter Voltage Level Reading Sony CR2450 3V Lithium Battery Self Programming Bootloader No need to Purchase a Programmer Temperature & Light Level Programs Music/Sound Demo Upload Name for Use as Name-Tag with Pin Write & Upload your own Programs The AVR Butterfly is a credit-card sized demo board from Atmel that is feature-packed and retails for under $20 US. The AVR Butterfly is a self-contained, battery-powered demonstration board running theATMEL AVR ATmega169v Microcontroller. The Butterfly board includes an LCD display screen, joystick, speaker, RS232 serial/modem/terminal port, flash RAM chip, temperature, light, voltage & Anolog-to-Digital sensors, serial EEPROM chip and internal EEPROM for data storage. The board has a shirt pin on its back and can be worn as a portable electronic scrolling name badge after you enter your own name. The AVR Butterfly comes preloaded with software to demonstrate the capabilities of the microcontroller. The factory firmware can scroll your name, display the sensor readings like tempurature or light levels. It can show the time. The AVR Butterfly has a piezo speaker that can reproduce music and sounds. The AVRButterfly demonstrates LCD driving by running a 14-segment, 6 alpha-numeric character display. The Butterfly's ATmega 169v CPU is capable of speeds up to 8Mhz. it is factory set by software to 2Mhz to preserve the button battery life. A pre-installed bootloader program allows the board to be re-programmed with a standard RS-232 serial plug. Just look at what it has to offer: Atmega169 MCU 32 x 8-Bit Registers 16K Flash (Program) RAM 512 Byte EEPROM 1K SRAM for Data 2 x B-Bit Timers 1 x 16-Bit Timer 4 PMW Channels UART 100 Segment LCD Display 4 MegaBit (512K Byte) DataFash 32KHz OScillator for RTC 4 Way Joystick Light Sensor (LDR) Tempurature Sensor (NTC) Speaker for Sound Generation Multiple Header Connectors JTAG Port 2 x 8-Bit General I/O Ports ISP Port USI Port RS-232 Level Converter Voltage Level Reading Sony CR2450 3V Lithium Battery Self Programming Bootloader No need to Purchase a Programmer Temperature & Light Level Programs Music/Sound Demo Upload Name for Use as Name-Tag with Pin Write & Upload your own Programs The AVR Butterfly is a credit-card sized demo board from Atmel that is feature-packed and retails for under $20 US. The AVR Butterfly is a self-contained, battery-powered demonstration board running theATMEL AVR ATmega169v Microcontroller. The Butterfly board includes an LCD display screen, joystick, speaker, RS232 serial/modem/terminal port, flash RAM chip, temperature, light, voltage & Anolog-to-Digital sensors, serial EEPROM chip and internal EEPROM for data storage. The board has a shirt pin on its back and can be worn as a portable electronic scrolling name badge after you enter your own name. The AVR Butterfly comes preloaded with software to demonstrate the capabilities of the microcontroller. The factory firmware can scroll your name, display the sensor readings like tempurature or light levels. It can show the time. The AVR Butterfly has a piezo speaker that can reproduce music and sounds. The AVRButterfly demonstrates LCD driving by running a 14-segment, 6 alpha-numeric character display. The Butterfly's ATmega 169v CPU is capable of speeds up to 8Mhz. it is factory set by software to 2Mhz to preserve the button battery life. A pre-installed bootloader program allows the board to be re-programmed with a standard RS-232 serial plug. Just look at what it has to offer: Atmega169 MCU 32 x 8-Bit Registers 16K Flash (Program) RAM 512 Byte EEPROM 1K SRAM for Data 2 x B-Bit Timers 1 x 16-Bit Timer 4 PMW Channels UART 100 Segment LCD Display 4 MegaBit (512K Byte) DataFash 32KHz OScillator for RTC 4 Way Joystick Light Sensor (LDR) Tempurature Sensor (NTC) Speaker for Sound Generation Multiple Header Connectors JTAG Port 2 x 8-Bit General I/O Ports ISP Port USI Port RS-232 Level Converter Voltage Level Reading Sony CR2450 3V Lithium Battery Self Programming Bootloader No need to Purchase a Programmer Temperature & Light Level Programs Music/Sound Demo Upload Name for Use as Name-Tag with Pin Write & Upload your own Programs The AVR Butterfly is a credit-card sized demo board from Atmel that is feature-packed and retails for under $20 US. The AVR Butterfly is a self-contained, battery-powered demonstration board running theATMEL AVR ATmega169v Microcontroller. The Butterfly board includes an LCD display screen, joystick, speaker, RS232 serial/modem/terminal port, flash RAM chip, temperature, light, voltage & Anolog-to-Digital sensors, serial EEPROM chip and internal EEPROM for data storage. The board has a shirt pin on its back and can be worn as a portable electronic scrolling name badge after you enter your own name. The AVR Butterfly comes preloaded with software to demonstrate the capabilities of the microcontroller. The factory firmware can scroll your name, display the sensor readings like tempurature or light levels. It can show the time. The AVR Butterfly has a piezo speaker that can reproduce music and sounds. The AVRButterfly demonstrates LCD driving by running a 14-segment, 6 alpha-numeric character display. The Butterfly's ATmega 169v CPU is capable of speeds up to 8Mhz. it is factory set by software to 2Mhz to preserve the button battery life. A pre-installed bootloader program allows the board to be re-programmed with a standard RS-232 serial plug. Just look at what it has to offer: Atmega169 MCU 32 x 8-Bit Registers 16K Flash (Program) RAM 512 Byte EEPROM 1K SRAM for Data 2 x B-Bit Timers 1 x 16-Bit Timer 4 PMW Channels UART 100 Segment LCD Display 4 MegaBit (512K Byte) DataFash 32KHz OScillator for RTC 4 Way Joystick Light Sensor (LDR) Tempurature Sensor (NTC) Speaker for Sound Generation Multiple Header Connectors JTAG Port 2 x 8-Bit General I/O Ports ISP Port USI Port RS-232 Level Converter Voltage Level Reading Sony CR2450 3V Lithium Battery Self Programming Bootloader No need to Purchase a Programmer Temperature & Light Level Programs Music/Sound Demo Upload Name for Use as Name-Tag with Pin Write & Upload your own Programs