Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 18

ESE 350

Embedded Systems/Microcontroller
Laboratory

Lecture 1
Course Overview & Introduction to Microcontrollers

Professor Rahul Mangharam


Electrical and Systems Engineering
University of Pennsylvania
2
Course Prerequisites
Knowledge of C programming
ESE 350 is not a programming class.

You need to be able to wire up/breadboard your systems.


If you’ve taken
ESE 201 Principles of Digital Design Lab
ESE 205 Electrical Circuits and Systems I Lab
OR at a minimum
Be comfortable using a multimeter & doing simple calculations
such as V=IR (Ohm’s Law) and Voltage Division

PLEASE LET ME KNOW if you’re NOT.

3
Key Concepts in ESE 350
•Understand microcontroller operation at the Assembly
Language level
•Program microcontrollers (using C Language)
•Interface microcontrollers to actuators, sensors, and output
devices
•Apply interrupts
•Utilize timer functions to measure input signals and
generate output waveforms
•Communicate using the Serial Communication Interface
•Use the built-in Analog-to-Digital Converter to capture real
world analog signals
4
Tentative Schedule
Readings & lectures support the concepts in the lab projects.
Reading Lecture Lab
Week
1/14 Introduction to HCS12 Form lab groups
Assembly
1/21 C & CodeWarrior Environment Lab sessions begin
HCS12 Peripherals
1/28 Interfacing HCS12
2/4 Stack & Subroutines Lab 1-Switching Lights
Interrupts due
2/11 Timer & Input Capture
2/18 Output-Compare Lab 2-Morse Code
Detector due
2/25 Midterm Exam

5
Tentative Schedule-Continued
Reading Lecture Lab
Week
3/3 Serial Communication Interface Lab 3-Musical Keypad due
Motors & Pulse Width Modulation
3/10 Spring Break
3/17 Feedback
3/24 Analog-to-Digital Converter Lab 4-Motor Controller due
3/31 Operation Modes & Memory
4/7 Microcontroller Projects Lab 5-Sound Meter due
4/14 TBD
4/21 Presentations Final Project demonstrations

6
Lab Organization
Labs are performed in teams.
•Each team must consist of at least
1 EE/CTE major
1 Systems major
Maximum 3 students per group unless approved by ESE 350
staff-IDEALLY we want a team of 2 Students
•Each member of the team must
Participate in the labs
Be present during demonstrations
Submit a separate written lab report
•Code listings and circuit diagrams can be shared within the group
•If you are unable to find a partner/partners by next week, please inform
the staff
7
Microcontroller Lab Projects
There are 5 Labs and a Final Project. Each successive lab
builds upon a previous lab. There will be a Pre-lab Quiz.
Lab What you will do: What you will learn:

1. Interface a simple Gain familiarity with CodeWarrior,


Switching pushbutton input and an development board, HCS12 input/output
Lights LED bargraph output to a ports, and simple input/output devices.
microcontroller to switch
lights on/off.
2. Morse Build a decoder using a Understand how to apply interrupts and
Code simple switch as input timer functions to measure different time-
Decoder and LCD display as lengths using input captures for a real-time
output. input signal.

8
Labs-Continued
Lab What you will do: What you will learn:
3. Musical Build a programmable Understand how to use output compare
Keypad tone generator using a functions to generate waveforms and apply
keypad and piezoelectric real-time interrupts to implement a keypad
speaker scanning scheme
4. Motor Build motor control Be able to generate pulse width modulated
Controller systems that control the outputs, measure pulses using a pulse
speed of a DC motor and accumulator and apply feedback to control
position of a servo motor motors
5. Sound Build a system that Gain familiarity with the built-in analog-to-
Meter monitors the loudness of digital (A/D) converter
surrounding sounds

9
Definitions
I/O CPU Memory
I/O: Input/Output
CPU: Central Processing Unit

Microprocessor: Single-chip CPU


Microcomputer: Computer that uses a microprocessor
Microcontroller: Single-chip microcomputer (CPU+I/O+Memory)*
(single-chip implies that all circuits and systems pertaining to the unit
exist on one integrated circuit (IC) die)

Formally, a microcontroller is a dedicated single-chip microcomputer


that exists within the device/equipment/process that it controls. As
such, it becomes an embedded controller.

10
Computer System
CPU is the ”brain” of the computer
1. ALU-Arithmetic and Logic Unit, operates on data
2. Control-directs operation for ALU, fetches instruction from memory,
provides timing and control signals
CPU
Input/Output-Peripherals
ALU (Input: Keyboard, drives
Output: Printer, video monitor)
Input Control Output

Control
Memory
Data
Memory stores instructions and data Address
(ROM, RAM)
11
Simplified MC9S12C128 CPU
Simplified MC9S12C128 CPU
Buses: 3 Types-Address [16], Data [8], and Control [8]

CPU Registers: Dedicated memory locations within the CPU


Program counter [16] holds instruction addresses (program in memory)
Data Address Register [16] holds data (operand) addresses (data in
memory)
Instruction Register [8] holds the op code fetched from memory
Accumulator* [8]& Data Register [8] hold operands that ALU operates on
during program execution; Both receive data from memory but only
Accumulator can send data to memory

Timing & control logic generate sequence of control signals to execute


instruction.

[N] represents number of bits, *Accumulator A or B; D is 16 bits 13


MC9S12C128 Microcontroller Unit

14
MC9S12C128 Features
- 16-bit CPU
- 12,288 bytes SRAM
- 4096 bytes EEPROM
- 262,144 bytes Flash EEPROM
- 8 Input Capture/Output Compare Channels
- 16-bit Pulse Accumulator
- One Serial Communication Interface (SCI)
- One Serial Peripheral Interface (SPI)
- Real-Time Interrupt (RTI) circuit
- 8-channel 8-bit A/D converter
- Computer Operate Properly (COP) Watchdog System
Source: Course Text
15
MC9S12C128 Programmer’s Model
Internal registers that
programmer can control using
instruction set.

16
Microcontroller Applications
Utility metering
Portable medical and instrumentation
Intelligent sensing
Consumer electronics-remote, gaming, toys, home electronics
Security systems-smoke, motion and glass break detector
Low power wireless-wireless sensor networks
PC Peripherals
Building automation-light, temperature, process control

Source: TI MSP430 Application Brochures

Other microcontrollers and their application notes, see Digi-Key Corporation


17
Microcontroller in Portable Medical

Source: TI Medical Applications Guide 2007


18

You might also like