1.an Introduction To Microcontrollers - P1

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 37

INTRODUCTION TO

MICRO-
CONTROLLERS
PREPARED BY
BASEM IBRAHEEM
MODIFIED BY
KHALED M. IBRAHEEM
Microprocessor –vs- Microcontroller

“Is there a difference between a


microprocessor and microcontroller?”

CISC – vs - RISC
Microprocessor –vs- Microcontroller

CISC RISC
Emphasis on hardware Emphasis on software
Includes multi-clock Single-clock
complex instructions reduced instruction only
Memory-to-memory: “LOAD” and Register to register: “LOAD” and
“STORE” incorporated in “STORE” are independent
instructions instructions
high cycles per second, Small code Low cycles per second, large code
sizes sizes
Microprocessor Microcontroller
General computing Appliances, specialized
Applications
(i.e. Laptops, tablets) devices

Speed Very fast Relatively slow


External Parts Many Few
Cost High Low
Energy Use Medium to high Very low to low

Vendors
History of Microcontrollers

Vacuum Tube Transistor Logic Gate Microcontroller


1939 1947 1960 1971
What is a microcontroller?
● A microcontroller is an integrated
circuit that is programmed to do a
specific task.

● Microcontrollers are really just


“mini-computers”.
Microprocessor

Microprocessor
System Bus

Clock RAM Data Storage

Peripheral Bus

SPI, USB DAC,ADC Ethernet SD/MMC


Processor Core

Microcontroller
System Bus

Clock RAM Data Storage

Peripheral Bus

SPI, USB DAC,ADC Ethernet SD/MMC


Where do you find them?

● Microcontrollers are hidden in tons of


appliances,gadgets, and other electronics.
● They’re everywhere!
Microcontroller Applications
●This is the controller board
for a washing machine. If a
button is pushed or if a knob is
turned, the microcontroller
knows how to react to the
event.

● Ex. If “start” is pushed, the


microcontroller knows to
switch a relay which starts the
motor.
Microcontroller Applications
●This is the main controller
from a Buick Regal. This board
has several microcontrollers
each for a specific task.

● Ex. A microcontroller may


handle dashboard controls or
it may even control something
more complex like the ignition
system.
Microcontroller Applications
●Many robots use
microcontrollers to allow robots
to interact with the real world.

● Ex. If a proximity sensor


senses an object near by, the
microcontroller will know to
stop its motors and then find an
unobstructed path.
Basic Principles of Operation
● Microcontrollers are used for specific applications.
● They do not need to be powerful because most applications
only require a clock of a few MHz and small amount of
storage.
● A microcontroller needs to be programmed to be useful.
● A microcontroller is only as useful as the code written for it.
If you wanted to turn on a red light when a temperature
reached a certain point, the programmer would have to
explicitly specify how that will happen through his code.
Microcontroller Programming
1.) Code is written for the microcontroller in an integrated development
environment, a PC program. The code is written in a programming
language. (e.g. C, BASIC or Assembly).

2.) The IDE debugs the code for errors, and then compiles it into binary
code which the microcontroller can execute.

3.) A programmer (a piece of hardware, not a person) is used to transfer


the code from the PC to the microcontroller. The most common type of
programmer is an ICSP (In-circuit serial programmer).
Microcontroller Programming
Microcontroller Packaging

DIP SOIC QFP BGA


(Dual Inline Package) (Small Outline IC) (Quad Flat Package) (Ball Grid Array)
Through hole Surface Mount Surface Mount Surface Mount
8 pins 18 pins 32 pins 100 pins
9mm x 6mm 11mm x 7mm 7mm x 7mm 6mm x 6mm
0.15pins/mm2 0.23pins/mm2 0.65pins/mm2 2.78pins/mm2
SELECTING YOUR MICROCONTROLLER
PROJECTS REVIEW
• The Hatcher
PROJECTS REVIEW
• SawStop
BASES FOR SELECTING A MICROCONTROLLER
• DO I NEED A MICROCONTROLLER OR A MICROPROCESSOR ?
• ONBOARD WI-FI / BLUETOOTH / FLASH / LARGE I/O / GRAPHICS
UNIT
• SPI / I2C / UART

• BITS SIZE (8/16/32) : DATA BUS , REGISTER SIZE , PORT SIZE –


ADDRESS BUS (PAGING REGISTER)
• OSCILLATOR FREQUENCY
• PACKAGING FOR SIZE AND ACCESSIBILITY
BASES FOR SELECTING A MICROCONTROLLER
• POWER CONSUMPTION
• RAM / ROM SIZES
• I/O PORTS
• COST PER UNIT
• MANUFACTURE AVAILABILITY
• DEVELOPMENT PLATFORM / INSTRUCTION SET / SIMULATOR /
EMULATOR
• OPERATING ENVIRONMENT : MOBILE / FIXED , STABLE / SHOCKS
, TEMPERATURE , MOIST
CORTEX A – R – M BY SILICON LABS
• CORTEX A
• MICROPROCESSOR FOR PERFORMANCE INTENSIVE SYSTEMS
• RUN AND OS SUCH AS ANDROID
• MULTIPLE THREADED
• COMPLEX HIGHSPEED INTERFACES : ETHERNET - MICROSD - USB -
ON BOARD WI-FI
• RASPBERRY PI 2 / SMARTPHONES
CORTEX A – R – M BY SILICON LABS
• CORTEX R
• MICROPROCESSOR FOR HIGH PERFORMANCE REAL-TIME APPLICATIONS
• BLUE-RAY – AIRBAGS – BRAKING SYSTEM – ENGINE MANAGEMENT
• CORTEX M
• MICROCONTROLLER FOR EMBEDDED APPLICATIONS
• RUN YOUR CODE OR BARE CODE AS BOOT LOADER
• (0) SINGLE THREADED
• ONBOARD I2C , SPI , UART , USB
• YOUR CODE SHOULD HANDLE ALL ACTIVITIES IN A SINGLE THREAD
(CODING IS HARDER)
ARM VS AVR

• AVR AND ARM COMES UNDER THE FAMILY OF MICRO-CONTROLLER. BUT ARM
CAN BE USED AS BOTH MICROCONTROLLER OR AS MICROPROCESSOR. ARM
MICRO-CONTROLLER AND AVR MICRO-CONTROLLER DIFFERS FROM EACH
OTHER IN TERMS OF DIFFERENT ARCHITECTURE AND DIFFERENT SETS OF
INSTRUCTION, SPEED, CAST, MEMORY, POWER CONSUMPTION, BUS WIDTH ETC.
NOW LET’S UNDERSTAND IN DETAIL HOW THEY DIFFERS FROM EACH OTHER.
ARM VS AVR
AVR ARM
AVR micro controller refers to AVR stands for "Alf
and Vegard's RISC processor" or "Advanced ARM micro controller refers to Advanced RISC Micro-controller
Virtual RISC".. (ARM).
It has bus width of 8 bit or 32 bit. It has bus width of 32 bit and also available in 64 bit.
Its speed is 1 clock per instruction cycle. Its speed is also 1 clock per instruction cycle.
Its manufacturer is Apple, Nvidia, Qualcomm, Samsung
Its manufacturer is Atmel company. Electronics and TI etc.
It uses Flash, SRAM, EEPROM memory. It uses Flash, SDRAM, EEPROM memory.
Its family includes Tiny, Atmega, Xmega, special
purpose AVR. Its family includes ARMv4, 5, 6, 7 and series.
It is cheap and effective. It provides high speed operation.
Popular micro-controllers include Atmega8, 16, 32, Popular micro-controllers include LPC2148, ARM Cortex-M0 to
Arduino Community. ARM Cortex-M7, etc.

Harvard architecture was a von Neumann architecture until ARM9


INTRODUCTION TO ARDUINO
WHY ARDUINO ?
• IMPROVEMENT OVER OTHER MICRO-CONTROLLERS FOR
BEGINNER USAGE
• INEXPENSIVE
• IDE ON MULTIPLE PLATFORMS (MAC, PC, LINUX)
• SIMPLE, CLEAR PROGRAMMING ENVIRONMENT: “C”
• OPEN SOURCE AND EXTENSIBLE SOFTWARE/HARDWARE
• ARDUINO SHIELDS
• COMPATIBLE WITH EMBEDDED SYSTEM’S COURSE LABS
ARDUINO SHIELDS
• VGA CAMERA• Load Cell
• GPS • Accelerometer/
• LCD DISPLAYS Gyros
• ETHERNET • LED displays
• WIFI • Memory Cards
• MOTOR • Weather
CONTROL (DC, Sensors
STEPPER) • Relays
CONSTRUCTION : ATMEGA328P DIP / QFP
ATMEGA328P QFP
ARDUINO UNO / NANO
GENERAL PURPOSE INPUT/OUTPUT GPIO

• CAN BE USED AS DIGITAL INPUT OR OUTPUT


• EACH PIN UNIQUELY ASSIGNABLE
• “ANALOG” (PWM OUTPUT ON DIGITAL PINS 3,5,6,9,10,11)
• ANALOG PINS 0-5 CAN ALSO BE USED AS GPIO

You might also like