ATmega 128

ATmega128 is a low-power CMOS 8-bit microcontroller based on the AVR enhanced RISC architecture (see figure 1). By executing powerful instructions in a single clock cycle, the ATmega128 achieves throughputs approaching 1 MIPS per 1 MHz for the maximum frequency 16MHz that means 16 MIPS. 

Having 133 instructions and most of them executed in one clock cycle, the processor can control until 53 input/output lines, 4 kBytes SRAM memory that include 32 x 8 bits registers, 4 kBytes EEPROM memory and 128 kBytes program flash memory.

A lot of peripheral devices are included on chip, such as: 2 timers at 8 bit each with prescalers and other 2 timer/counters 16 bits each that accept a large variety of programming modes. An analogue to digital converter is implemented on chip with 8 inputs that are multiplexed.

The microcontroller includes two USART (Universal Synchronous and Asynchronous Receive Transmit) units, one SPI (Serial Peripheral Interface) unit and the other TWI (Two Wire Interface), unit that allows implementation of a wide kind of possibilities for serial communication between the microcontroller and external systems.

A lot of possibilities are allowed to preset the system clock, such as: internal clock based on RC calibrated oscillator, external RC oscillator, and external crystal stabilized oscillator. The clock signal can be divided by software in a wide range of modes.
A large variety of power saving modes could be programmed in order to choose the optimal saving mode.

The direction of signal can be set for all the input/output lines (input / output 20mA /each line). If the port is programmed as a special peripheral unit (USART, timer, etc) this programming has priority. Interrupt sources are defined for all the peripheral devices that are treated separately using interrupt vectors.

Programming language includes instructions that implement the transfer of data from/to internal and external memory, transfer of data from/to input and output ports, using direct/indirect-addressing modes, decision instructions.

This allows to redirect the running of the program (logical and mathematical), functions of a bit or byte value, repeating instructions (loops without or with test applied in advance or at the end of loop) and arithmetical operations: addition, subtract, multiply and division. By using data transfer instructions the user can configure all the ports in a wide variety of modes, including also the internal memory and the mapping of registers in it.

Structure of ATmega 128 microcontroller

Figure 1 Structure of ATmega 128 microcontroller

The interrupt service routines run starting from fix addresses allowing to treat specifically each of interrupts. The time loss for the change of context is very low, only four clock cycles. In this period the processor recognizes the interrupt source.

It determines the highest priority if more interrupts occur simultaneously and, in this case, decides which of them will be treat first. After it saves in memory the program counter (PC) jumping to the interrupt service routine. For more information access the site: www.atmel.com.

Privacy | About Us
Copyright © 2008 Home Automation - JAEC - All the rights reserved