5.4 Microcontrollers I: Introduction
Transcript of 5.4 Microcontrollers I: Introduction
5.4 Microcontrollers I:
Introduction
Dr. Tarek A. TutunjiMechatronics Engineering Department
Philadelphia University, Jordan
Microcontrollers: Introduction
Microprocessors were described in the last three sequences
In this presentation
• Microcontrollers will be introduced
• PIC microcontroller architecture will be highlighted
What is a microcontroller ?
A microcontroller (MCU) is a computer-on-a-chip IC fabricated using VLSI technology and used to control electronic devices.
Microcontrollers contain the following components:• Microprocessor - ranging from simple 8-bit to
sophisticated 64-bit processors
• Input/Output interface ports
• Timers and Interrupts
• RAM for data storage
• ROM, EEPROM or Flash memory for program storage
• Many include A/D converters and serial ports
Therefore, mcontrollers do not require much hardware support (compared to mprocessors) and are used for specific control applications
Microprocessor
I/OPorts
MemoryRAM / ROM
TimerInterrupts
Microcontroller as a computer
Microcontroller can provide all the main elements of a computer
For example, we can use 7-segment display (instead of a monitor) and keypad (instead of a keyboard) with a microcontroller to do simple word processing
MPU
1 2 34 5 67 8 9* 0 #
Clock
7-segment display
4x3Keypad
mcontroller
Select Control Select Control
Read Keys
Write character
Selection of Available
Microcontrollers Intel
• 8051 (8-bits)
• 8096 (16-bits)
• 80960 (32-bits)
Microchip • PIC 16Fxxx (8-bits)
Texas Instruments • TMS370
Motorola • 68HC11 (8-bits)
• 68HC16 (16-bits)
• MPC500 (32-bits)
Selecting a microcontroller
Different microcontrollers provide different combinations of features. The following features should be considered when choosing a microcontroller for your application:• Number of I/O pins• Type of Timers• Interrupt sources• Analog inputs• Maximum clock speed• Program memory size• Data bit size• Serial communication• Simulator• Emulator• Programmer• Price
Motorola 68HC11 Architecture
PIC microcontroller families 12Fxxx
8-pin package 6 I/O pins1 K word program memory 20 MHz clock8- and 16-bit timer Up to 4 analog inputs (10 bits)
16Fxxx14-40 pin packages 12-33 I/O pins1-8 K word program memory 20 MHz clock2x8- and 2x16-bit timers Up to 8 analog inputs (10 bits)Serial communication port 1/2 PWM output & compare in
18Fxxx18-80 pin package 13-68 I/O pins2-64 K word program memory 40 MHz clock2x8- and 3x16-bit timers Up to 16 analog inputs (10 bits)Serial communication port Up to 14 PWM out & compare in
Common Features of
PIC Architecture Harvard architecture
• Separate paths for the instructions and data
RISC instruction set• Small number of instructions
Flash program ROM• Easily re-programmed
Single Working register• Reduces the cumber of complexity of instructions
Multiple Interrupt sources• Variety of interrupts are available at one address
Hardware timers• 8- and 16-bit timers are available
Sleep mode• Power saving
Serial in-circuit programming• Common program downloading system
PIC Architecture
Programming Steps
Write Algorithm
Edit source code
Assemble program
Simulate code
Download code
Emulate in H/W
Stop
Start
Syntax error
Logical error
Functional error
Yes
Yes
Yes
PIC Development Board
After the PIC program is assembled and simulated, the hex code is downloaded on the PIC chip. This is done through serial (or parallel) connection between the computer and the development board
During the download, 14 Volts are applied to MCLR, the clock to RB6 and data to RB7
Summary
A microcontroller is a computer-on-a-chip IC fabricated using VLSI technology and used to control electronic devices
Microcontrollers contain microprocessors, memory, and I/O ports
When choosing which microcontroller to use, the following are to be considered: number of I/O pins, timers, interrupt sources, analog inputs, maximum clock speed, program memory size, and price
PIC microcontrollers made by Arizona microchip are very popular because of their special architecture that results in effective controllers with easy-to-use programs
Programming microcontrollers include assembling, simulating and emulating