You are on page 1of 29

MICROCONTROLLERS

CHAPTER 1
FUNDAMENTAL OF
MICROCONTROLLERS

Dr. Vo Tuong Quan

HCMUT - 2011
Class Rules
1. Class exercise: 20% (Students will submit the report in
class)
2. Homework: 20% (students have to submit the homework
report via ELearning system).
3. Teamwork project : 20%
• Each team includes maximum 4 students, each team will
present their research topic at the 3 final weeks of the
semester.
• English power point and english presentation in class are
encouraged.
4. Final exam: 40% (Using document  TBD. Time for final
exam: 75 - 90 minutes)

2
 2011 – Vo Tuong Quan
Introduction
Find the information about these following MCUs:
- PIC (Microchip)
- AVR (Adruino/ATmel)
- ARM (ST)
- MSP (Texas Instrument)

3
 2011 – Vo Tuong Quan
Introduction
What is a microcontroller ?
-Microcontroller is a programmable digital processor with
necessary peripherals.
- Both microcontrollers and microprocessors are complex
sequential digital circuits meant to carry out job according to
the program / instructions.
- Analog input/output interface makes a part of microcontroller
circuit of mixed mode(both analog and digital nature).

4
 2011 – Vo Tuong Quan
Introduction
Architecture of microcontroller Von Neumann Structure
Havard Structure

Microcontroller PIC, ATMega, TI:


RISC: Reduced Instruction Set Computer
Other Microcontroller:
CISC: Complex Instruction Set Computer
5
 2011 – Vo Tuong Quan
Introduction
Some popular PIC families:
Pic16xxxx
Pic18xxxx
dsPicxxxxx
Pic33xxxx
Some typical specifications of Pic families:
- Flash memory, I/O, Timer-Counter 8bits - 16bits;
- Communication: A/D, Rs232, SPI, I2C, CAN, LAN, USB,…
- Control: ExINT, Output Compare, Input Capture, PWM, QEI,…

6
 2011 – Vo Tuong Quan
Introduction
Typical structure of microcontroller

7
 2011 – Vo Tuong Quan
Introduction
Homework #1
Find the relationship equation between speed of motor (rpm:
round per minute), number of encoder’s pulse and the
frequency of the output signal from encoder.
Give the simple example.

8
 2011 – Vo Tuong Quan
Introduction
PIC 16F877

9
 2011 – Vo Tuong Quan
Introduction
PIC 16F877

10
 2011 – Vo Tuong Quan
Introduction
What is Microprocessor ?  Example?
What is the differences between Microcontroller and
Microprocessor?

11
 2011 – Vo Tuong Quan
Introduction
The Addressing Methods
Use to know the source address and destination address of
data
1. Register addressing
2. Direct addressing*
3. Indirect addressing*
4. Immediate addressing*
5. Relative addressing*
6. Absolute addressing*
7. Index addressing

 What is the register? REMEMBER !!!

12
 2011 – Vo Tuong Quan
Introduction
How to solve the addressing mode problem?
Review some popular IC using in addressing mode:
- 74139: decoding 2  4
- 74138: decoding 3  8
- Some logical gates: AND, OR, XOR, EX-OR, EX-NOR

13
 2011 – Vo Tuong Quan
Introduction

14
 2011 – Vo Tuong Quan
Introduction
ROM and RAM
Typical using in the addressing problem
A0 - An A0 - An

nCS
ROM D0 - Dm nCS
RAM D0 - Dm

nW

A: Address D: Data C: Control


The ability to addressing data is based on the number of
address bus. N line of address bus  management ability
is 2n.

15
 2011 – Vo Tuong Quan
Introduction
Some typical memory IC

16
 2011 – Vo Tuong Quan
Introduction
Solving the problem by examples:
Design the address decoding circuit using ROM and RAM.
The capacity of ROM is 16KB using pieces of 4KB ROM
and the capacity of RAM is 8KB using pieces of 4KB RAM.
The starting address of ROMs is 0000h and the address of
RAMs is following after the ending address of ROMs.
How to solve this kind of problem?
Step 1: Make the addressing table of all peripherals
Step 2: Choose suitable address line to be the input signal to
decoding ICs as 74138 or 74139 or 74142,...and decide
which output pins of the decoding ICs to connect to the
appropriate peripherals.
Step 3: Draw the circuit.
17
 2011 – Vo Tuong Quan
Introduction
Solution
A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0 Hex
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0000
ROM 1
0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0FFF
0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1000
ROM 2
0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1FFF
0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2000
ROM 3
0 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 2FFF
0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 3000
ROM 4
0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3FFF
0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4000
RAM 1
0 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 4FFF
0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 5000
RAM 2
0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 5FFF

Using IC 74138 with lines A12, A13, A14 to be the input of


74138. The output lines of 74138 are used to connect to
CS line of ROMs and RAMs (Y0 – Y3  connect to ROM1
– ROM4 ; Y4 – Y5  connect to RAM1 – RAM2) 18
 2011 – Vo Tuong Quan
Introduction
Address Decoding – Old Style
1. Design the address decoding circuit using ROM and RAM.
The capacity of ROM is 16KB using pieces of 8KB ROM
and the capacity of RAM includes 2 pieces of 4KB RAM
and 2 pieces of 2 KB RAM. The starting address of ROMs
is 0000h and the address of RAMs is following after the
ending address of ROMs
2. Design the address decoding circuit using ROMs and
RAMs. The capacity of ROM is 32KB using pieces of 8KB
ROM and the capacity of RAM is 4KB using pieces of 2KB
RAM. The starting address of RAMs is 0000h and the
address of ROMs is following after the ending address of
RAMs

19
 2011 – Vo Tuong Quan
Introduction
Think about the three types of problems
1. The starting addresses of each types of memory are given.
2. The capacity of the second type is bigger than the first type.
3. The capacity of the second type is smaller than the first
type.

20
 2011 – Vo Tuong Quan
Introduction
 Homework 1
1. Find at least 5 memory ICs uing in real circuits at present.
Request:
- IC Name or IC Code
- Communication standard – How to connect this IC to MCU
- Operation voltage

21
 2011 – Vo Tuong Quan
Introduction
Programing Language and Programing Softwares
-Programing Language: C, Basic, ASM,
-Programing Softwares:
•MPLAB (Microchip)  most popular  C language
•MikroC, HiTech C  C language
•PicBasic  Basic Language
-Compiler:
•C16, C18, C30, (Microchip)
•CCS-C
•HiTechC

22
 2011 – Vo Tuong Quan
Introduction
Some popular loading circuits
1. FD-ICP
Loading program:
WinPicPro

23
 2011 – Vo Tuong Quan
Introduction
2. PIG-PG1

Loading program:
WinPicPro

24
 2011 – Vo Tuong Quan
Introduction
2. PIG-PG2
Loading program:
WinPicPro

25
 2011 – Vo Tuong Quan
Introduction
2. PIG-PG3
Loading program:
ICPro

26
 2011 – Vo Tuong Quan
Introduction
Một số mạch nạp thông dụng
1. Pickit 2

27
 2012 – Vo Tuong Quan
Introduction
2. Pickit 3

28
 2012 – Vo Tuong Quan
Introduction
Microchip loading circuit

29
 2012 – Vo Tuong Quan

You might also like