Presentation on theme: "What is a Microcontroller?"— Presentation transcript:
1 What is a Microcontroller? A microcontroller (sometimes abbreviated µC or MCU) is a small computer on a single IC containing a processor core, memory, and programmable input/output peripherals.It is a decision making device used widely in embedded systems and all intelligent devices.
3 Difference between Microcontroller and Microprocessor Microcontroller has I/O ports, Memory, timers etc all integrated on chip itselfIn Microprocessors, I/O ports, memory, timer etc are to be connected externally
7 How AVR Atmega8 got its name? It was developed by Atmel CorporationAVR implies it belongs to AVR family.‘16’ in Atmega8 means this microcontroller has 16Kb of flash memory
8 What is AVR?AVR is a modified Harvard architecture , 8-bit RISC single chip microcontroller.It was developed in the year 1996 by Atmel Corporation.
9 What’s special about AVR? They are fast.AVR Microcontroller executes most of the instructions in single execution cycle.AVRs are about 4 times faster than PIC.They consume less power and can be operated in different power saving modes.
10 What is RISC? RISC stands for “Reduced Instruction Set Computer”. It is a very fast architecture which executes one instruction per clock cycle.RISC contains very small instruction set.Programming is easy, but code length increases.
12 Harvard ArchitectureHarvard architecture has separate data and instruction buses.This allows transfers to be performed simultaneously on both buses.
13 Von Neumann Architecture A Von Neumann architecture has only one bus which is used for both data transfers and instruction fetchData transfers and instruction fetches must be scheduled as they cannot be performed at the same time
14 Introduction to Atmega8 Atmega8 is a low-power CMOS 8-bit microcontroller based on the AVR RISC architecture.Atmega8 achieves Up to 16 MIPS Throughput at 16 MHzIn order to maximize performance and parallelism, the AVR uses a Harvard architecture.
15 Features Of Atmega8High-performance, Low-power AVR 8-bit MicrocontrollerUp to 16 MIPS Throughput at 16 MHz32 x 8 General Purpose Working RegistersInternal Calibrated RC OscillatorExternal and Internal Interrupt SourcesData retention: 20 years at 85°C/100 years at 25°C
16 Memory Segments8K Bytes of In-System Self-programmable Flash program memory512 Bytes EEPROM (Electrically Erasable Programmable Read Only Memory)1K Byte Internal SRAM (Static Random Access Memory)
17 Peripheral Features– Two 8-bit Timer/Counters with Separate Prescaler, one Compare Mode– One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and CaptureMode– Real Time Counter with Separate Oscillator– Three PWM Channels– 8-channel ADC in TQFP and QFN/MLF packageEight Channels 10-bit Accuracy– 6-channel ADC in PDIP packageSix Channels 10-bit Accuracy
18 – Byte-oriented Two-wire Serial Interface – Programmable Serial USART– Master/Slave SPI Serial Interface– Programmable Watchdog Timer with Separate On-chip Oscillator– On-chip Analog Comparator
19 TYPES OF PACKAGES– 28-lead PDIP32-lead TQFP32-pad QFN/MLF
23 Pin Description VCC: Digital supply voltage 5V. GND: Ground. RESET: A low level on this pin for longer than the minimum pulse length will generate a reset, even if the clock is not running.AREF: The analog reference pin for the A/D Converter.
24 Continued….AVCC : The supply voltage pin for the A/D Converter, Port C (3..0).It should be externally connected to VCC, even if the ADC is not used. If the ADC is used, it should be connected to VCC through a low-pass filter.
25 PORTS There are 3 ports in Atmega8: Port B, Port C, Port D. Three registers are associated with every portDDRx – Data Direction RegisterPINx – Port inputPORTx- Port outputWhere x would be either B,C or D.
26 PORT B(PB7-PB0) It is a 8-bit bi-directional I/O port. It has internal pull up resistors(selected for each bit).It can be used either as a input port or as output port ( direction must be specified in programming).
27 PORT C(PC6-PC0) It is a 8-bit bi-directional I/O port. It has internal pull up resistors(selected for each bit).It can be used either as a input port or as output port ( direction must be specified in programming).
28 PORTD(PD7-PD0) It is a 8-bit bi-directional I/O port. It has internal pull up resistors(selected for each bit).It can be used either as a input port or as output port ( direction must be specified in programming).
29 Registers to Communicate with I/O Ports To communicate with the ports of Atmega8, we use three registers:PINxPORTxDDRxWhere x would be either B,C or D.
35 DDRx Register It stands for Data Direction Register. It is used to define Port as Input or Output.In order to make Port as Input Port: DDRx=0x00 (In Hexadecimal)DDRx=0b (In Binary)In order to make Port as output Port: DDRx=0xFF (In Hexadecimal)DDRx=0b (In Binary)
36 PORTx Register If DDRx=0xFF(Output port) Writing logic 1 to PORTx will make output high i.e 5v for that particular pin.Writing 0 to PORTx will make output low i.e 0v for that particular pin.
37 Continued..If DDRx=Ox00(Input port):If corresponding PORTx bit is set to 1, Internal pull up resistors are enabled i.e if we do not connect this pin to anything it still reads as 1.If corresponding PORTx bit is set to 0, internal pull up resistors are disabled i.e the pin will enter a high impedance state and will become unpredictable.
38 PINx Register It reads data from the port pins. If any/all bits of DDRx is set to 0(input)for a particular pin, we can read data from PINxIf any/all bits of DDRx is set to 1(output), then reading PINx register gives the same data which has been output on that particular pin.