0% found this document useful (0 votes)
14 views

Lect1 - Intro Microcomputer

Uploaded by

B ANIL KUMAR
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Lect1 - Intro Microcomputer

Uploaded by

B ANIL KUMAR
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 31

Microcomputer and Interfacing

(ECEg4161)

Lecture I

Text Book: PIC Microcontroller and Embedded Systems


By Ali Mazid, etal.
By Solomon N.
2008 E.C/2015 G.C
Microcomputer
• The term microcomputer is used to describe a system that
includes at minimum a microprocessor, program memory, data
memory, and an input-output (I/O) device. And sometimes it
includes support devices such as timers, counters, ADCs, and a
few more peripherals. Data or instructions are moved to/from
components using buses: (address, data and control buses)

• When these devices are on a single chip then it becomes


microcontroller, or sometimes embedded controller, since
most of the microcontrollers are built into (or embedded in)
the devices they control.

2
Microprocessor(1/2)
• The microprocessor (MPU) is a computing and logic device
that executes binary instructions in a sequence stored in
memory.

• It is the “brain” of a computer(CPU); its job is to fetch


instructions, decode them, and then execute them.

• It contains three units: ALU, Registers and Control unit.


– ALU performs computing tasks – manipulates the data/ performs
numerical and logical computations
– Registers are used for temporary storage
– Control unit is used for timing and other controlling functions –e.g. it
controls where/when data is to be written or read from memory.
3
Microprocessor(2/2)
Microprocessor have no built in
memory(ROM/RAM or
program /data memory), no I/O,
no timer and no any other support
device of its own on its chip. A
programmer who develops
microprocessor based system
must add this components by his
own to make the system
functional. Hence flexible but
complex system. We usually use
microprocessor in dynamic
systems like computers, tablets,
etc. 4
Microcontroller
• An integrated electronic computing and logic device, often
described as a ‘computer-on-a-chip’.
• It mainly consists three major components on a single chip
– Microprocessor (CPU)
– Memory
– I/O ports
• And additionally some support devices such as
– Timers
– A/D converter
– Serial I/O
– Parallel Slave Port
• All components are connected by common communication
lines called the system bus.
5
6
… cont’d
• A designer will use a
Microcontroller to:
‾ Gather input from various
sensors
‾ Process this input into a set
of actions
‾ Use the output mechanisms
on the microcontroller to do
something useful.

7
…cont’d
• The majority of microcontrollers in use today are embedded in
other machinery, such as automobiles, telephones, appliances,
and peripherals for computer systems. These are called
embedded system.
• E.g. DVD player, hi-fi, TV, air-conditioner, washing machine,
ECG (electrocardiogram), blood pump, blood pressure meter,
Alarm, remote sueveilance, smart card + reader , Motor speed
control, robot, Keyboard, printer, automotive ignition control,
Missile, torpedo, ejection seat, cell phones, modem, radio,
radar, satelite etc.

8
Illustrative Design Example(1/3)
• µP vs µC based system
– Assume we want to designing a temperature
monitoring system consisting LCD, temp. sensor,
fan, heater and flash memory to save temperature
readings in a constant interval generated by timer.
– Design the system
a) As a µP based system
b) As a µC based system

9
Illustrative …(2/3)
• µP Temperature System

10
Illustrative …(3/3)
• µC Temperature System

11
Types of Microcontroller
• Parallax Propeller
• Freescale 68HC11 (8-bit)
• Intel 8051
• Silicon Laboratories Pipelined 8051 Microcontrollers
• ARM processors (from many vendors) using ARM7 or
Cortex-M3 cores are generally microcontrollers
• STMicroelectronics STM8 (8-bit), ST10 (16-bit) and STM32
(32-bit)
• Atmel AVR (8-bit), AVR32 (32-bit), and AT91SAM (32-bit)
• Freescale ColdFire (32-bit) and S08 (8-bit)
• Hitachi H8, Hitachi SuperH (32-bit)
• Hyperstone E1/E2 (32-bit, First full integration of RISC and
DSP on one processor core [1996])
• Infineon Microcontroller: 8, 16, 32 Bit microcontrollers for
automotive and industrial applications.
12
… cont’d
• MIPS (32-bit PIC32)
• NEC V850 (32-bit)
• Microchip PIC (8-bit PIC16, PIC18, 16-bit dsPIC33/PIC24)
• PowerPC ISE
• PSoC (Programmable System-on-Chip)
• Rabbit 2000 (8-bit)
• Texas Instruments Microcontroller MSP 430 (16-bit), C2000
(32-bit), and Stellaris (32-bit)
• Toshiba TLCS-870 (8-bit/16-bit)
• Zilog eZ8 (16-bit), eZ80 (8-bit)
• etc
13
Choosing microcontroller
• Three major criterion to choose
microcontroller for your project or product are:
1. Meeting the computing needs of the task at hand
efficiently and effectively
2. Availability of software and hardware
development tools such as compiler, assembler,
debugger and emulator.
3. Wide availability and reliable source of the
microcontroller

14
Microchip PIC
• PIC is a family of Harvard architecture microcontroller
made by Microchip Technology. The name PIC initially
referred to "Peripheral Interface Controller“ . PIC
microcontrollers were the first RISC microcontroller.

• PICs are popular with both industrial developers and


hobbyists alike due to their low cost, wide availability,
large user base, extensive collection of application notes,
availability of low cost or free development tools, and
serial programming (and re-programming with flash
memory) capability.

15
PIC Microcontroller product family
• 8-bit microcontrollers • 32-bit microcontrollers
– PIC10 – PIC32
– PIC12
• 16-bit digital signal
– PIC14
controllers
– PIC16
– dsPIC30
– PIC17
– PIC18 – dsPIC33F
• 16-bit microcontrollers
– PIC24F
– PIC24H
16
PIC18F features(1/3)
• Common PIC18 features: High current (25mA) sink/source
– 77 instructions capability
Up to five capture/compare/PWM
– PIC16 source code compatible modules
– Program memory addressing up Master synchronous serial port
to 2Mbytes module (SPI and I2C modes)
– Data memory addressing up to Up to two USART modules
Parallel slave port (PSP)
4Kbytes
Fast 10-bit analog-to-digital
– DC to 40MHz operation
converter
– 8X8 hardware multiplier Programmable low-voltage
– Interrupt priority levels detection (LVD) module
– 16-bit-wide instructions, 8-bit- Power-on reset (POR), power-up
wide data path timer (PWRT), and oscillator start-
up timer (OST)
– Up to two 8-bit timers/counters Watchdog timer (WDT) with on-
– Up to three 16-bit chip RC oscillator
timers/counters  In-circuit programming
– Up to four external interrupts 17
PIC18F features(2/3)
• In addition, some microcontrollers in the PIC18F
family offer the following special features:
– Direct CAN 2.0 bus interface
– Direct USB 2.0 bus interface
– Direct LCD control interface
– TCP/IP interface
– ZigBee interface
– Direct motor control interface

18
PIC18F features(3/3)
•Address bus
– 21-bit address bus for program memory addressing capacity: 2 MB of
memory
– 12-bit address bus for data memory addressing capacity: 4 KB of memory
•Data bus
– 16-bit instruction/data bus for program memory
– 8-bit data bus for data memory
•Control signals
– Read and Write

19
Program Memory
The RESET vector
address is at 0000h and A 21-bit program counter is
the interrupt vector capable of addressing the 2-
addresses are at 0008h Mbyte program memory space.

and 0018h.

PIC18F452 each have 32


Kbytes of FLASH
memory.
This means that it can
store up to 16K of single Accessing a location
word instructions between the physically
implemented memory
and the 2-Mbyte
address will cause a
read of all ’0’s (a NOP
instruction).20
Data Memory Organization
• Data Memory up to 4k bytes 000h
Access
Access RAM
RAM
PIC16F8F2520/4520
07Fh
Register File Map
• Divided into 256 byte banks 080h
Bank
Bank 00 GPR
GPR
0FFh
• Half of bank 0 and half of 100h

bank 15 form a virtual bank Bank


Bank 11
GPR
GPR
that is accessible no matter 1FFh

which bank is selected 200h


Bank
Bank 22
Access Bank
• Not all PIC18F has 4k bytes of 2FFh
GPR
GPR
00h
data memory, e.g. PIC18F452 Access
Access RAM
RAM 7Fh

has 1792 bytes of data Access


Access SFR
SFR
80h
FFh
D00h
memory Bank
Bank 13
13 256 Bytes
GPR
GPR
• Every PIC device has at least DFFh

default 256 bytes of data E00h


Bank
Bank 14
14
RAM(memory) called access GPR
GPR
EFFh
bank. F00h
Bank
Bank 15
15 GPR
GPR
F7Fh
F80h
Access
Access SFR
SFR
FFFh
21
Data Memory with Access Banks
These registers are always
accessible regardless
GPR=General Purpose Reg. which bank is selected –
SFR=Special Function Reg. acting as a virtual memory
-

Data Memory also


known as “Register File”
or RAM
FFF=212=16x256=4096=4K

22
Registers
– Bank Select Register (BSR)
• 4-bit register used in direct addressing the data memory
– File Select Registers (FSRs)
• 16-bit registers used as memory pointers in indirect addressing data memory
– Program Counter (PC)
• 21-bit register that holds the program memory address while executing programs

23
Example: PIC 18FXX2 Architecture
• Consists four devices: PIC18F242, PIC18252, PIC18442,
PIC18452

24
.

PIC18F452 microcontroller DIP pin configuration

25
Block diagram of the PIC18F452 microcontroller

26
PIC18F452 I/O Ports
• Five I/O ports
– PORT A through PORT E
– Most I/O pins are multiplexed
– Generally have eight I/O pins with a few exceptions
– Addresses already assigned to these ports in the design stage
– Each port is identified by its assigned SFR

27
Parallel I/O ports Main Features
• Simple memory mapped access
• Can be configured through software as either
input or output
• Ability to set or reset individual bits
• Can have internal pull-ups
• Can drive small loads like LEDs
• Can be multifunction
• Different capability for pins (i.e. larger
current)
28
PIC Architecture
• Two architectures of microcomputer exists
– Harvard Architecture (-PIC uses this architecture)
– Von Neumann (Princeton) Architecture(-8086 µP and
other large percentage of µC use this architecture)

29
RISC vs CISC
Reduced Instruction Set Computer- Complex Instruction Set Computer-
RISC CISC

• Fixed instruction size • Varying instruction size


• More registers than more stack • More stacks and less
memories registers
• Small instruction set • Large instruction set
• Takes almost 1 clock cycle(only • More than 1 clock cycle
~5% of the set requires 2 clock
• Same buses for data &
cycle)
instruction(code)
• Separate buses for data &
instruction(code) • Microcode instructions
• Hardwired instructions • Data can be manipulated
• Data can’t be manipulated while while it is in memory too.
it is still in the memory(load and
store arch.) 30
Thank You!!

31

You might also like