Chapter 1 - Fundamental of Microcontroller
Chapter 1 - Fundamental of Microcontroller
CHAPTER 1
FUNDAMENTAL OF
MICROCONTROLLERS
HCMUT - 2017
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 : 30%
• 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: 30% (Using document TBD. Time for final
exam: 75 - 90 minutes)
2
2011 – Vo Tuong Quan
Review Questions
1. List the electrical/electronics standards?
2. Actuators? List some….
3. How many types of motors? What are the control
problems of motors?
4. Sensors and sensory systems?
3
2011 – Vo Tuong Quan
Introduction
Find the information about these following MCUs:
- PIC (Microchip)
- AVR (Adruino/ATmel)
- ARM (ST)
- MSP (Texas Instrument)
4
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).
5
2011 – Vo Tuong Quan
Introduction
Architecture of microcontroller Von Neumann Structure
Havard Structure
7
2011 – Vo Tuong Quan
Introduction
Typical structure of microcontroller
8
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.
9
2011 – Vo Tuong Quan
Introduction
PIC 16F877
10
2011 – Vo Tuong Quan
Introduction
PIC 16F877
11
2011 – Vo Tuong Quan
Introduction
What is Microprocessor ? Example?
What is the differences between Microcontroller and
Microprocessor?
12
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
13
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
14
2011 – Vo Tuong Quan
Introduction
15
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
16
2011 – Vo Tuong Quan
Introduction
Some typical memory IC
17
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.
18
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
20
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.
21
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
22
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
23
2011 – Vo Tuong Quan
Introduction
Some popular loading circuits
1. FD-ICP
Loading program:
WinPicPro
24
2011 – Vo Tuong Quan
Introduction
2. PIG-PG1
Loading program:
WinPicPro
25
2011 – Vo Tuong Quan
Introduction
2. PIG-PG2
Loading program:
WinPicPro
26
2011 – Vo Tuong Quan
Introduction
2. PIG-PG3
Loading program:
ICPro
27
2011 – Vo Tuong Quan
Introduction
Một số mạch nạp thông dụng
1. Pickit 2
28
2012 – Vo Tuong Quan
Introduction
2. Pickit 3
29
2012 – Vo Tuong Quan
Introduction
Microchip loading circuit
30
2012 – Vo Tuong Quan