Microprocessor Control
and Application
yccheng@gmail.om
鄭雲謙 國立陽明交大
National Chiao-Tung University
國立交通大學機械工程學系
http://www.youtube.com/watch?v=Qp_FCbKgSxU
課程目標:現今工業界及消費性產品常用之微控制器
概念,以基本的MCS-8051為主(現在則進展到
ARM)。對各位同學在建立微控制器使用基礎及應
用於系統控制方法研究上有相當助益。
電器
單晶片 備註
數(最少)
電子鐘
1
數位相機
1
冷氣機
2
含遙控器
微處理機是一門實用,可以讓你靠寫程式讓機器動起來的課
預備知識與課程目標
• Prerequisite
Knowledge of computer, C language,
architecture/organization, assembly language,
electronics, electronics lab., digital circuits, intro.
to digital systems will be very helpful
• Objective
To understand and hands-on micro. computer
system about architecture, peripheral, timer,
counter, interrupt, I/O control and etc.
微處理機-課程架構
硬體:8051微處理機架構
軟體:C語言或者組合語言
想出有趣的題目並實作
微處理機成果發表
課程綱要 :
⚫ 微處理機架構及週邊元件 (電子學)
⚫ 微處理機系統軟硬體開發環境 (STM32)
⚫ 程式語言及程式設計(Assembly簡介, C語言實作)
⚫ ARM-M4 Micro-controller 應用實例, 實作練習
⚫ 期末專題實作
課程進行方式、課程要求及評分標準:
課堂講課, 實作練習,最後進行實作專題。
預期學到的微處理機基本功能(ARM-M4):
⚫ Registers
⚫ GPIO
⚫ 7-segment and keypad
⚫ Timer/Interrupt
⚫ ADC
⚫ USART
參考書目:
1.new E3 講義
2.new E3 參考資料 指令集 與周邊架構register等資料。
STM32 user manuals etc.
評分標準 :
⚫
小考, 上機練習和平時表現: 40%
- 八次上機練習每次完成4%, 加總32%。加分題一個
2%。
- 期末有小助教分數(加分)
- 小考or回答問題總共10%。
⚫
期中考: 30%
- block diagram
- Registers, Interrupts, memory structure
- C lab etc
⚫
期末書面報告與Powerpoint 專題簡報: 30%
- 自己想題目
微處理機期末專題成果1
機械手臂
溫控變頻電扇
抓住夢想 移動式鬧鐘
四軸飛行器
微處理機期末專題成果2
遙控變頻電扇
軌道車
蟑螂自走車
鯨魚告白音樂盒
微處理機期末專題成果ARM
鍵盤式跳舞機
0411016 王鵬翔 0411032 顏宇佑
飛行小鳥遊戲
0411036 彭宣儒 0411098 朱柏勳
溫控電扇
0411094 簡偉晉 0411009 柯宥安
Arm Idea, 實現創意有意思
• 報名日期:2019 6/14
• 報名網站:
http://www.armdesigncontest.com
• Arm活動小組聯繫方式:電話:02-27526890
• Email:arm.events@NEOact-imc.com
評分與時程
Ready for the Course?
請具備基礎的C語言或者至少Matlab語言能力再來修
你們聽不懂是我的責任,盡管來問或告訴我怎樣教比較清楚,but...
• 下次上課前請先分好組, 兩人一組
• 板子請愛惜使用, 期末繳還, 弄丟者扣總成績
十分
• 鼓勵各位同學自己購買一套教材
微處理機軟體
Peripheral
I/O
7-segment
Timer
Interrupt
Memory
微處理機硬體架構
Microcontroller Architecture
BUS 控制
Microprocessor vs Microcontroller
Microprocessor
Program
ROM
Data
RAM
I/O
USB
Timer/
Clock
Interrupt
I/O
Timer/
Clock
Interrupt
CPU
Program
ROM
Data
RAM
Microcontroller
From Diode to Micro Computer
System (Memory)
• Processor vs. computer
– Micro computer, mini computer, mainframe, super
computer, …
• Computer vs. controller
– integrated circuit semiconductor chip that performs the
bulk of the processing and controls the parts of a system;
"a microprocessor functions as the central processing unit
of a microcomputer"; "a disk drive contains a
microprocessor to handle the internal functions of the
drive"
– A microprocessor on a single integrated circuit intended to
operate as an embedded system. As well as a CPU, a
microcontroller typically includes small amounts of RAM
and PROM and timers and I/O ports (single chip computer)
ARM-Cortex M4 Structure
ARM Cortex-M4 Processor Structure
System Level
arithmetic logic unit (ALU)
Arithmetic Logic Unit (ALU)
AND Gate
AND Gate Circuit
BJT IC and Resistors on Board
BJT
MOS
Q1: 微處理機包含哪三個主要部分?
Q2:由大到小排列微處理器組成: Logic gates、
Microcontroller、BJT、ALU/Memory
A1:微處理機包含哪三個主要部分?
1.中央處理單元(CPU), 記憶單元(Memory), 輸入
輸出單元(I/O)
2.小美, 蠟燭, 單晶片
3.進擊的巨人, 進食的巨人, 進水的巨人
A2:
Microcontroller > ALU/Memory > Logic gates > BJT
Microcontroller Application
⚫ Printer
⚫ Small size LCD display
⚫ Home appliances: refrigerators, washing machines,
microwave oven
⚫ Personal Entertainment: CD player, MP3 player, Toys,
video gain player
⚫ Medical monitor: Glucose meter,
⚫ DIGITAL THERMOMETER, Fire detector,
⚫ Building control: access control, temperature sensing,
lighting, - fire detection
補充資料: 8051硬體架構、System on
Chip
Block diagram of 8051 core
External
interrupts
Counter
in
Block diagram of a simple CPU
Interrupt
Control
4K
ROM
0~7Fh
128 bytes
SRAM
Timer1
4 I/O ports
Serial
Port
Timer0
CPU
Bus
Control
8
Txd Rxd
P0 P2 P1 P3
{
Oscillator
16-bit Address
8-bit Data
External
memory
RS232C
System on Chip
[more than a microcontroller]
USB host
USB
OTG
PHI
Nand
Flash
Memory
(program)
Flash
Memor
y
I/F
USB OTG
Controller
DMA
Controlle
r
System
Microcontroller
8051
microcontroll
er SRAM
JTAG
I/F
GPIO
DataRAM
for DSP
DSP
Audio
decode
Instruction
-RAM for
DSP
Card Reader I/F
DC to DC controller
SD/MMC
card slot
1.5V battery
Debug ICE
ADC10
Keyboard/
Sensors
LCM I/F
controller
LCD
module
DAC10 +
pre-AMP
Headphone
,Speaker
PWM out
System
Power
Block diagram of a MP3 player SoC with 8051 microcontroller
• 下次上課前請先分好組, 兩人一組
• 板子請愛惜使用, 期末繳還, 弄丟者扣總成績
十分,或者自己買一套新的來還。