Download AVR microcontrollers have a RISC architecture 8 Bit, so all the

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Opto-isolator wikipedia , lookup

Power dividers and directional couplers wikipedia , lookup

Immunity-aware programming wikipedia , lookup

Transcript
AVR microcontrollers have a RISC architecture 8 Bit, so all the instructions packaged in 16-bit code (16bits word) and most of the instructions executed in one instruction cycle clock. And this really
differentiate once with MCS-51 instructions (CISC Architecture of) that requires 12 clock cycles. RISC is
Reduced Instruction Set Computing, while CISC is Complex Instruction Set Computing.
AVR grouped into 4 classes, namely ATTiny, family AT90Sxx, ATMega family, and the family AT86RFxx.
Of all the classes distinguish from each other is the size of the onboard memory, on-board peripherals
and functions. In terms of architecture and the instructions they used to say about the same.
Architecture ATMega8535
* IO channels as much as 32 pieces, namely Port A, Port B, Port C and Port D
* ADC 10 bit by 8 Channel
* Three timer / counter
* 32 registers
* Watchdog Timer with internal oscillator
* SRAM as many as 512 bytes
* Flash memory is 8 kb
* Internal and external interrupt sources
* Port SPI (Serial Interface pheriperal)
* EEPROM on board as many as 512 bytes
* Analog Comparator
* Port USART (Universal Shynchronous Ashynchronous Receiver Transmitter)
Features ATMega8535
* System-based 8-bit RISC processor with speeds up to 16 MHz.
* The size of 8KB flash memory, 512 bytes of SRAM, EEPROM of 512 bytes.
* Internal ADC with 10 bit resolution channel by 8
* USART serial communication port with a maximum speed of 2.5 Mbps
* Sleep mode to save power consumption
Description:
Flash is a type of Read Only Memory that is usually filled with the results of a man-made program to be
executed by the microcontroller
RAM (Random Access Memory) is a memory that helps the CPU for temporary data storage and
processing of data when the program is running
EEPROM (Electrically Erasable Programmable Read Only Memory) is a memory for storing data
permanently by the programs that are currently running
Port I / O is the distance to an exit or entry signal as output or input for program
Timer is in the hardware module to calculate working time / pulse
UART (Universal Asynchronous Receive Transmit) is a specialized data communication lines are
asynchronous serial
PWM (Pulse Width Modulation) is a facility to make the pulse modulation
ADC (Analog to Digital Converter) is a facility to be able to receive analog signals within a certain range
and then converted to a digital value within a certain range
SPI (Serial Peripheral Interface) is a specialized data communication lines are a serial synchronous serial
ISP (In System Programming) is a special ability microcontroller to be programmed directly in the circuit
system with a minimal number of pins needed
Arsitektur ATMEGA8535
(gambar arsitektur ATMEGA8535)
Broadly speaking, ATMEGA8535 microcontroller architecture consists of:
* 32 channels of I / O (Port A, Port B, Port C and Port D)
* 8 Channel 10 bit ADC (Analog to Digital Converter)
* 4 channel PWM
* 6 Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, Standby and Extended
Standby
* 3 pieces of timer / counter
* Analog comparator
* Watchdog timer with internal oscillator
* 512 bytes of SRAM
* 512 bytes EEPROM
* 8 kb Flash memory with the ability to Read While Write
* Units interruptions (internal & external)
* Port interface SPI8535 "memory map"
* Port USART for serial communication with a maximum speed of 2.5 Mbps
* 4.5 to 5.5V operation, 0 to 16MHz
Pin Configuration ATMega8535
* VCC pin that serves as an input pin power supply
* Ground Pin GND is
* Port A (PA0. .. PA7) is a pin I / O pins and ADC input
* Port B (PB0. .. PB7) is an I / O pins and pins that have special functions: Timer / Counter,
Comparator Analog and SPI
* Port C (PC0. .. PC7) is an I / O port and a pin that has a special function, namely analog comparator
and Timer Oscillator
* Port D (PD0. .. PD1) is a port I / O and special function pins are analog comparator and an external
interrupt and serial communication
* RESET pin is used to reset the microcontroller
* XTAL1 and XTAL2 is an external clock input pin
* AVCC is the input pin for the voltage ADC
* AREF is the input pin for the ADC reference voltage
Description PIN ATMEGA8535
A. Port A
An 8-bit directional port I / O. Each pin can provide internal pull-up resistor (adjustable per bit). Port A
output buffers can provide current of 20 mA and can directly control the LED display. Data Direction
Register port A (DDRA) must be set first before Port A is used. DDRA stuffed bits 0 if you want to enable
the pins corresponding port A as input, or 1 if the output is filled. In addition, the eight port A pin is also
used for analog signal input to the A / D converter.
B. Port B
An 8-bit directional port I / O. Each pin can provide internal pull-up resistor (adjustable per bit). Port B
output buffers can provide current of 20 mA and can directly control the LED display. Data Direction
Register Port B (DDRB) must be set first before Port B is used. DDRB bits filled with 0 if you want to
enable the pins corresponding port B as input, or 1 if the output is filled. Pin-pin port B also has to
alternate functions as special as can be seen in the following table.
Port Pin
Fungsi Khusus
PB0
T0 = timer/counter 0 external counter input
PB1
T1 = timer/counter 0 external counter input
PB2
AIN0 = analog comparator positive input
PB3
AIN1 = analog comparator negative input
PB4
SS = SPI slave select input
PB5
MOSI = SPI bus master output / slave input
PB6
MISO = SPI bus master input / slave output
PB7
SCK = SPI bus serial clock
C. Port C
An 8-bit directional port I / O. Each pin can provide internal pull-up resistor (adjustable per bit). Port C
output buffers can provide current of 20 mA and can directly control the LED display. Data Direction
Register port C (DDRC) must be set first before Port C is used. DDRC bits filled with 0 if you want to
enable the pins corresponding port C as input, or 1 if the output is filled. In addition, two port C pin (PC6
and PC7) also has an alternative function as an oscillator for the timer / counter 2.
D. Port D
An 8-bit directional port I / O. Each pin can provide internal pull-up resistor (adjustable per bit). Port
D output buffers can provide current of 20 mA and can directly control the LED display. Data Direction
Register port D (DDRD) must be set first before Port D is used. DDRD stuffed bits 0 if you want to enable
the pins corresponding port D as input, or 1 if the output is filled. In addition, the pin-pin D port also has
to alternate functions as special as can be seen in the following table.
Port Pin
Fungsi Khusus
PD0
RDX (UART input line)
PD1
TDX (UART output line)
PD2
INT0 ( external interrupt 0 input )
PD3
INT1 ( external interrupt 1 input )
PD4
OC1B (Timer/Counter1 output compareB match output)
PD5
OC1A (Timer/Counter1 output compareA match output)
PD6
ICP (Timer/Counter1 input capture pin)
PD7
OC2 (Timer/Counter2 output compare match output)
Memory Map ATMega8535
ATMega8535 has a data memory addressing space and a separate program memory. Data memory is
divided into 3 sections: general registers 32 pieces, 64 pieces registers I / O, and 512 bytes of internal
SRAM.
General-purpose registers occupy the bottom of the address space of data on the $ 00 to $ 1F.
Meanwhile, special registers to handle I / O and control of the microcontroller occupies 64 addresses
the next, ranging from $ 20 to $ 5F. Register is a special register that is used to regulate the function of
various microcontroller peripherals, such as control registers, timer / counter, function function I / O,
and so on. Special registers memory addresses details can be seen in the table below. Next memory
address used for SRAM 512 bytes, which is the location of $ 60 to $ 25F.
Data Memory AVR ATMega8535
Located in program memory Flash Perom arranged in word or 2 bytes for each instruction has a width
of 16-bit or 32bit. AVR ATMega8535 has 4KByte x 16 Bit Flash Perom with addresses ranging from $ 000
to $ FFF. AVR has a 12 bit Program Counter (PC) so that they can put address the Flash content.
Memory Program AVR ATMega8535
In addition it also has an ATmega8535 AVR form of EEPROM data memory 8-bit as 512 bytes.
EEPROM addresses starting from $ 000 to $ 1FF.
Status Register
Status register contains the status register is generated on every operation performed when an
instruction is executed. Comfortable is part of the microcontroller CPU core.
Status Register ATMega8535
* Bit7
lobal Interrupt Enable) bit must be set to enable the all kinds of interruptions.
* Bit6
struction BLD and BST using T-bit as source or destination in bit
operations. A bit in a GPR register bits can be copied into T using BST instruction, and vice versa T bits
can be copied back to a little market bits in GPR registers using instructions BLD.
* Bi5
* Bit4
complement overflow).
-N (negative) and V flags (two
* Bit3
* Bit2
* Bit1
it will be set if the operation results yield mathematical number 0.
* Bit0
en an operation produces a carry.
Steering Assembler
Steering assembler is useful to change the pointer assembly code. Here is a list of some directional
assembler syntax found in ATMega8535.
1. . Cseg (code segment) is useful as a directional pointer that put the code or expression underneath
the steering program memory is usually placed after steering. Deseg
2. . Db (data byte) steering allows us to put the constants such as serial number, and a lookup table in
program memory at the specified address.
3. . Dw (data word) is like the director of data bytes, but the size of the word.
4. . Org is used to set the program counter to the specified address
5. . Byte is used to initialize the bytes used in the SRAM for a specific label
6. . Dseg (data segment) is useful as a directional indicator that the underlying code functions to SRAM
settings
7. . Def (define) steering allows a register can be defined.
8. . Equ useful to give a name to a constant that can not be changed.
9. . Sets like. Equ but constant can be changed.
10. . ENDM (end macros) to end the macro.
11. . Include for mengincludekan a file into the program to make the program more quickly understood
or separating kedo in two separate files.
12. . Device as a pointer type used AVR.
13. . Exit as a pointer to stop doing assembly in the current file.
14. . Handy list generating file list.
15. . Listmac allows the addition of macros shown in the file list generated.
16. . Nolist useful for an orderly instruction is not included in the file list generated.
Minimum System AVR 8535 series
Minimum system (sismin) microcontroller is the minimum necessary electronic circuits for the operation
of the microcontroller IC. Sismin can then be connected to other circuits to perform certain functions. In
the AVR microcontroller family, a series of 8535 is one of a series that is very widely used.
To create a series of Atmel AVR 8535 sismin required several components, namely:
1. ATmega8535 microcontroller IC
2. 1 XTAL 4 MHz or 8 MHz (XTAL1)
3. 3 capacitors paper ie two 22 pF (C2 and C3) and 100 nF (C4)
4. One 4.7 uF electrolytic capacitor (C12) 2 is 100 ohm resistor (R1) and 10 Kohm (R3)
5. 1 button reset pushbutton (PB1)
Also of course necessary power supply can provide 5V DC voltage.
The minimum system circuit is ready to accept analog signals (ADC facility) on port A. Picture of the
circuit is as follows.
Minimum system network AVR