Download as pdf or txt
Download as pdf or txt
You are on page 1of 24

Course No.

ME 3121
Course Title: Basic Mechatronics

Microcontroller

Presented by
Prof. Dr. Md. Rokunuzzaman

Department of Mechanical Engineering


Rajshahi University of Engineering & Technology 1
Outline
 Learning Objectives
 Course Plan
 Distribution of Marks
 Microcontroller
 Parts of Microcontroller
 Microcontroller Vs Micro processor
 Types of μC
 Basic Architecture
 Pin Configuration
 References/Resources

Department of Mechanical Engineering


Rajshahi University of Engineering & Technology 2
Learning Objectives

Course Objective:
To introduce Microcontroller, Its programming and
Interfacing as a basic part of Mechatronic System

At the End of the class you will be able to understand…..


 what a Microcontroller is
 various parts of a μC
 the basic difference between μP and μC
 different types of μC
 the basic architecture of μC

Department of Mechanical Engineering


Rajshahi University of Engineering & Technology 3
Course Plan

Topics No. of
Class
Introduction to Course, Marks Distribution, References 01
Microcontroller: Overview, Basic architecture
ADC 01
Timer, Clock 01
PWM 01
USART/UART 01
I2C, Data Read/Write from EEPROM 01
Programming using C 02
I/O port programming 01
Interrupt handling 01
Interfacing with LCD display and Keypad 02
Example projects with Microcontrollers. 03
Smart sensors and Smart actuators 01
MEMS and Nanotechnology, Future Trends. 01

Department of Mechanical Engineering


Rajshahi University of Engineering & Technology 4
Distribution of Marks

Class Tests 15
Assignments 05
Attendance 08
Semester Exam 72
Total Marks 100

Department of Mechanical Engineering


Rajshahi University of Engineering & Technology 5
What is a Microcontroller ?

A microcontroller is a compact integrated circuit


designed to govern a specific operation in an embedded
system. A typical microcontroller includes a processor,
memory and input/output (I/O) peripherals on a single
chip.

Department of Mechanical Engineering


Rajshahi University of Engineering & Technology 6
Department of Mechanical Engineering
Rajshahi University of Engineering & Technology 7
Various parts of a μC

Department of Mechanical Engineering


Rajshahi University of Engineering & Technology 8
CPU
Central Processing Unit or CPU is the brain of the Microcontroller. It
consists of an Arithmetic Logic Unit (ALU) and a Control Unit (CU). A CPU
reads, decodes and executes instructions to perform Arithmetic, Logic
and Data Transfer operations.

Memory
Any Computational System requires two types of Memory: Program
Memory and Data Memory. Program Memory, as the name suggests,
contains the program i.e. the instructions to be executed by the CPU.
Data Memory on the other hand, is required to store temporary data
while executing the instructions.

Usually, Program Memory is a Read Only Memory or ROM and the Data
Memory is a Random Access Memory or RAM. Data Memory is
sometimes called as Read Write Memory (R/W M).

Department of Mechanical Engineering


Rajshahi University of Engineering & Technology 9
I/O Ports
The interface for the Microcontroller to the external world is provided by the I/O
Ports or Input/Output Ports. Inputs device like Switches, Keypads, etc. provide
information from the user to the CPU in the form of Binary Data.
The CPU, upon receiving the data from the input devices, executes appropriate
instructions and gives response through Output Devices like LEDs, Displays,
Printers, etc.

Bus
Another important component of a Microcontroller, but rarely discussed is the
System Bus. A System bus is a group of connecting wire that connect the CPU with
other peripherals like Memory, I/O Ports and other supporting components.

Timers/Counters
One of the important components of a Microcontroller are the Timers and Counters.
They provide the operations of Time Delays and counting external events.
Additionally, Timers and Counters can provide Function Generation, Pulse Width
Modulation, Clock Control, etc.

Department of Mechanical Engineering


Rajshahi University of Engineering & Technology 10
Serial Port
One of the important requirement of a Microcontroller is to communicate with other
device and peripherals (external). Serial Port proves such interface through serial
communication. Most common serial communication implemented in
Microcontrollers is UART.

Interrupts
A very important feature of a Microcontroller is Interrupts and its Interrupt
Handling Mechanism. Interrupts can be external, internal, hardware related or
software related.

ADC (Analog to Digital Converter)


Analog to Digital Converter or ADC is a circuit that converts Analog signals to
Digital Signals. The ADC Circuit forms the interface between the external Analog
Input devices and the CPU of the Microcontroller. Almost all sensors are analog
devices and the analog data from these sensors must be converted in to digital data
for the CPU to understand.

Department of Mechanical Engineering


Rajshahi University of Engineering & Technology 11
Difference between a Micro Processor (μP) and
a Microcontroller (μC)

Department of Mechanical Engineering


Rajshahi University of Engineering & Technology 12
Types of Microcontroller

Department of Mechanical Engineering


Rajshahi University of Engineering & Technology 13
History of Microcontrollers

1971 Texas Instrument calculator-on-a-chip


TMS 1000, which was a 4-bit microcontroller
with built-in ROM and RAM.

1977 Intel 8048 was one of Intel's


first microcontrollers.

1980 Intel 8051 followed in and became one of


the most popular microcontroller families.

1996 Atmel AVR was one of the first


microcontroller families to use on-chip flash
memory for program storage.

Department of Mechanical Engineering


Rajshahi University of Engineering & Technology 14
AVR Family
•TinyAVR
•0.5–32 KB program memory
•6–32-pin package
•Limited peripheral set
•MegaAVR
•4–256 KB program memory
•28–100-pin package
•Extensive peripheral set
•XMEGA
•16–384 KB program memory
•44–64–100-pin package (A4, A3, A1)
•DMA, "Event System", and crypto-
-graphy support
•Extensive peripheral set with ADCs
•Application-specific AVR
•MegaAVRs with special features not found on the other members of the AVR
family, such as LCD controller, USB controller, advanced PWM, CAN, etc.
Department of Mechanical Engineering
Rajshahi University of Engineering & Technology 15
Department of Mechanical Engineering
Rajshahi University of Engineering & Technology 16
Basic architecture of μC (AVR)

 The basic architecture of AVR was designed by two


students of Norwegian Institute of Technology (NTH),
Alf-Egil Bogen and Vegard Wollan, and then was bought
and developed by Atmel in 1996.
 The AVR stands for Advanced Virtual RISC, or Alf and
Vegard RISC
 The AVR is an 8-bit RISC single-chip microcontroller
with Harvard architecture.

Department of Mechanical Engineering


Rajshahi University of Engineering & Technology 17
Department of Mechanical Engineering
Rajshahi University of Engineering & Technology 18
RISC

Reduced Instruction Set Computer, or RISC , is one whose instruction


set architecture (ISA) allows it to have fewer cycles per instruction
(CPI) than a Complex Instruction Set Computer (CISC)

Department of Mechanical Engineering


Rajshahi University of Engineering & Technology 19
AVR Architecture

Department of Mechanical Engineering


Rajshahi University of Engineering & Technology 20
 RISC architecture with mostly fixed-length instruction, load-
store memory access and 32 general-purpose registers.
 A two-stage instruction pipeline that speeds up execution
 Majority of instructions take one clock cycle
 Up to 16-MHz clock operation
 Up to 12 times performance speedup over conventional CISC
controllers.
 Wide operating voltage from 2.7V to 6.0V
 Simple architecture offers a small learning curve to the
uninitiated.

Department of Mechanical Engineering


Rajshahi University of Engineering & Technology 21
ATmega16 Pin Configuration

Department of Mechanical Engineering


Rajshahi University of Engineering & Technology 22
References/Resources
 Books:
 Thomas Grace, Programming and Interfacing ATMEL® AVR® Microcontrollers,
Cengage Learning PTR, 2016
 Muhammad ali mazidi, AVR-Microcontroller-and-Embedded-Systems using
assembly and C, Prentice Hall, 2011
 Steven F. Barrett, Atmel AVR Microcontroller Primer: Programming and Interfacing,
Morgan& Claypool, 2008

 Tutorials/Online resources/Data Sheet Etc:


 Microcontroller Tutorials, TECHSHOP, Bangladesh
 AVR tutorials in Bangla: Part 1 and 2, Zulfikar Ali Jewel, Bangladesh
 http://www.avr-tutorials.com/
 Atmel Datasheet, ATMEL Corporation
 Lecture Notes of the Class

Department of Mechanical Engineering


Rajshahi University of Engineering & Technology 23
Appreciation to

Thank you for your patience

Department of Mechanical Engineering


Rajshahi University of Engineering & Technology 24

You might also like