Вы находитесь на странице: 1из 23

Microprocessors and

Programming
Dr. Kadir ERKAN
Department of Mechatronics Engineering
Fall : 2013

10/11/16

Teaching Assistants

:Beytullah OKUR
Hasan Fatih ERTURUL

Classroom
Office

: A-506
:E2-BlokNo:24

E-mail

:kerkandersler@gmail.com

Web
Office Hours

: www.yildiz.edu.tr~kerkan
: Monday 15:00~17:00
Friday 15:00~17:00

10/11/16

Course Description
The purpose of this course is to introduce the students to the basics of
microprocessors and microcontrollers. Therefore PIC 16FXXX series
processorsareusedtointroducearchitecture,software,and
interfacingconcepts.

Software

Microprocessors and programming


Hardware

10/11/16

Course Objectives
Uponcompletingthiscourse,youshouldbeableto:
explainthemicroprocessorarchitectureanditscomponents
learnPIC16FXXXinstructionset
designandimplementassemblylanguageprogramsusingPIC16FXXX
instructionset
designandimplementClanguageprogramsusingPIC16FXXX
byCCSembeddedfunctions
recognisebasiccomponentsandfunctionalityofmicrocomputer
testinganddevelopmentequipment.

10/11/16

Course Prerequisites
Inthiscourse,thestudentsareexpectedtomakedistinctivetermprojectsby
keepinggoodbalanceofsoftwareandhardwaresides.Therefore,basicknowledge
ofanaloganddigitalelectronicsismandatoryandgoodcommandofcprogramming
skillsarenecessary.

10/11/16

Tentative Course Plan

10/11/16

Recommended Books
Embedded C Programming and the Microchip PIC,R.Barnett,LO
CullandS.Fox,2004,thomson
PIC Programlama Teknikleri ve PIC16F877A;H.ahin,A.Dayank,
C.Altnbaak,2006,AltaYaynclk
CCS C ile PIC Programlama,Serdariek,2009,AltaYaynclk
Programming 8-bit PIC Microcontrollers in C with interactive
Hardware Simulation;M.P.Bates,2008,Newnes
Mikrodenetleyiciler ve PIC Programlama,O.Altnbaak,2001.Alta
Yaynclk,stanbul.
PIC16F87x Data Sheet,MicrochipTechnologyInc.,2001.
Embedded Design with the PIC18F452 Microcontroller;JohnB.
Peatman;2003;PrenticeHall
10/11/16

Grading Policy

10/11/16

Microprocessor
Microprocessor:isasingleintegratedcircuit(IC)thatacceptsand
executescodedinstructions(machinecodeormachinelanguage)forthe
purposeofmanipulatingdataandcontrollingtheassociatedcircuitry
(RAM,ROM,andI/OICs)inadigitalsystem..Intheworldofpersonal
computers,thetermsmicroprocessorandCPUareusedinterchangeably.
Amicroprocessor(sometimesabbreviatedP)isadigitalelectronic
componentwithminiaturizedtransistorsonasinglesemiconductor
integratedcircuit(IC).
Oneormoremicroprocessorstypicallyserveasacentralprocessingunit
(CPU)inacomputersystemorhandhelddevice.
Microprocessorsmadepossibletheadventofthemicrocomputer.

10/11/16

Microprocessor
Attheheartofallpersonalcomputersandmostworkingstationssitsa
microprocessor.
Microprocessorsalsocontrolthelogicofalmostalldigitaldevices,fromclock
radiostofuel-injectionsystemsforautomobiles.
Threebasiccharacteristicsdifferentiatemicroprocessors:

1.Instructionset:Thesetofinstructionsthatthemicroprocessorcanexecute.
2.Buswidth:Thenumberofbitsprocessedinasingleinstruction.
3.Clockspeed:Giveninmegahertz(MHz),theclockspeeddetermineshowmany
instructionspersecondtheprocessorcanexecute.

10/11/16

10

Microcomputer
AMicrocomputerisanintegratedsystemofcomputercomponentstypically
containingdatastorageICs,massstorageelements,andstandardI/Odevices,
capableofawidevarietyofapplications.Microcomputerscontainamicroprocessor
attheheartofthesystem,controllingdataflow,manipulatingdata,andexecuting
instructions.
Thetermmicrocomputerisgenerallysynonymouswithpersonalcomputer,ora
computerthatdependsonamicroprocessor.
Microcomputersaredesignedtobeusedbyindividuals,whetherintheformof
PCs,workstationsornotebookcomputers.

10/11/16

11

Microcomputer
Amicrocomputersystemconsistsofthefollowingcomponents:
PeripheralInput
PeripheralOutput
PeripheralStorage
CentralProcessingUnit
PeripheralInput:Itisatooltobeusedtopreparedataorinformationwhichwill
beprocessedbyCentralProcessingUnit.Example:Joystick,Keyboard,Sensor,
Scanner
PeripheralOutput:Itisatooltobeusedtodisplaydataorinformationwhichhas
beenprocessedbyCentralProcessingUnit.Example:Monitor,Printer,Speaker
PeripheralMemory:Itisatooltobeusedtostoredataorinformationwhichwill
beprocessedorhasbeenprocessedbyCentralProcessingUnit.Example:Hard
disk,CD-ROM,RAM,ROM,Pendrive
CentralProcessingUnit(CPU):Itisthemostimportantpartinmicrocomputer
system.Itactsasabrainofamicrocomputersystem.Itisalsocalled
Microprocessor.
10/11/16

12

Internal Components of Microprocessors

10/11/16

13

Internal Components of Microprocessors


ALU(ArithmeticLogicUnit)
Itperformsarithmetictasksuchasaddition,deduction,multiplicationand
divisionandlogictasksuchasAND,OR,NOTandetc.
ACC (Accumulator)
Itisaregisterwhichcanstoredatafortemporarybeforesendingtoprocessin
ALUandalsocanstoretheprocesseddatabeforesendingtostoreinthememory
ordisplaythroughperipheraloutput.
ItisjustlikeaentranceforadatatogoinandcomeoutfromALU.
Flag register/PSW (Program Status Word ) register
Thisregistercontainsinformation regardingtheresultofaprocesswhichhas
beencarriedoutbyALU.
IttellstheuserwhethertheresulthasCarry (CY),Auxiliary Carry (AC),Odd or
Even Parity (P)orOverflow (OV)ortheotherwayround.
Italsoconsistsinformationregardingregistersfromwhichbankwillbeworking
on.

10/11/16

14

Internal Components of Microprocessors


Program Counter (PC)
Itcontrolsthesequenceinwhichtheinstructionsinaprogramareperformed.
Normally,itdoesthisbycountinginthesequence,thatis0,1,2,3,
Atanygiventime,thecountindicatesthelocation inmemoryfromwhichthe
nextlocationofinformation/instructionistobetaken.
v. Stack Pointer (SP)
ThisregisterwillstorethecontainsofProgramCounter(locationofmemory)
forashorttimewhenthereissubroutine/sub-programoccursintheprogram.
Thisregisterwillbetakenplacewhensomeparticularinstructions,suchas
PUSH,POP,CALLandRETareusedintheprogram.
vi. Data Register
Thisregisterisatemporarystoragelocationfordatagoingtoorcomingfrom
thedatabus.
vii. Address Register
Thisregisterisanothertemporarystoragelocation.
ItholdstheaddressofthememorylocationorI/Odevicethatisusedinthe
operationpresentlybeingperformed.
10/11/16

15

Internal Components of Microprocessors


Instruction Decoder
Afterandataispulledfrommemoryandplacedinthedataregister,thedatais
decodedbythiscircuit.
Thedecoderchecksthecodeanddecideswhichoperationistobeperformed.
Controller-sequencer
Thisunitwillproduceavarietyofcontrolsignalstocarryouttheinstruction.
Sinceeachinstructionisdifferent,adifferentcombinationofcontrolsignalsis
producedforeachinstruction.
Data Bus
Itisagroupofwiresthatisusedtochanneldata(whichtobeprocessedor
afterprocessed)fromperipherals(memoryorI/Odevices)toCPUorviceversa.
Address Bus
Itisagroupofwiresthatisusedtochannellocations ofdatawhichwillbeor
hasbeenprocessed.
Control Bus
Itisagroupofwiresthatisusedtosendcontrolsignals(suchasMEMW,
MEMR,IOR,IOW,interruptandDMA)fromCPUtoperipheral(memoryorI/O
devices)orviceversa.
10/11/16

16

Microprocessor Based System

10/11/16

Address bus
Unidirectional
MemoryandI/OAddresses
Data bus
Bidirectional
TransfersBinaryDataandInstructions
Control lines
ReadandWritetimingsignals

17

MPU-Based Time and Temperature System

MPUbasedsystemincludesmicroprocessor,memory,I/Oports,andsupportdevices
(suchastimers)onasinglesemiconductorchip
Busesaregenerallynotavailabletoasystemdesigner
I/Oportsaregenerallymultiplexedandcanbeprogrammedtoperformdifferent
functions
10/11/16

18

Software
MachineLanguage(0-1)

BinaryInstructions
Difficulttodecipherandwrite

Error-prone

Allprogramsconvertedintomachinelanguageforexecution

MnemonicMachineLanguage(Assembly)

10/11/16

Machineinstructionsrepresentedinmnemonics
One-to-onecorrespondence
Efficientexecutionanduseofmemory
Machine-specific

19

Software
High-LevelLanguages

10/11/16

BASIC,C,andC++
Writteninstatementsofspokenlanguages
Machineindependent
Easytowriteandtroubleshoot
Largermemoryandlessefficientexecution

20

Operation of CPU

Fetch cycle (phase):


oTheCPUputstheaddressoftheinstructiontobeexecutedontheaddressbus.The
addressinformationcomesfromtheprogramcounter(PC)maintainedbythecontrolunit.
oThecontrolbusholdstheinformationforreadingthememorylocationandthedatabus
holdstheinstructionfromthememorywhichisstoredintotheinstructionregister(IR)
oPCisupdatedtopointtothenextinstruction.
Execute cycle (phase):
oInstructionintheIRisdecoded
oTherequireddatatransferandtherequiredlogicalandarithmeticoperationare
performed
oTheresultiswrittenbackeithertooneoftheregistersormemoryorI/Odevice
10/11/16

21

Short History of CPUs


Date Transi stors Microns

Clock
speed

Data
width

MIPS

8080

1974

6,000

2MHz

8bits

0.64

8088

1979

29,000

5MHz

16bits
8-bit
bus

0.33

80286

1982

134,000

1.5

6MHz

16bits

80386

1985

275,000

1.5

16MHz 32bits

80486

1989

1,200, 000

25MHz 32bits

20

Pentium

1993

3,100, 000

0.8

60MHz

32bits
64-bit
bus

100

PentiumII

1997

7,500, 000

0.35

233
MHz

32bits
64-bit
bus

~300

PentiumIII

1999

9,500, 000

0.25

450
MHz

32bits
64-bit
bus

~510

Pentium4

2000 42,000,000

0.18

32bits
1.5GHz 64-bit ~1,700
bus

Pentium4
"Prescott"

2004 125,000,000

0.09

32bits
3.6GHz 64-bit ~7,000
bus

Name

10/11/16

Intel4004

Intel8080

22

Short History of CPUs

10/11/16

23

Вам также может понравиться