0% found this document useful (0 votes)
39 views31 pages

MCU 01 Unlocked

Uploaded by

Sude Öztürk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views31 pages

MCU 01 Unlocked

Uploaded by

Sude Öztürk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

Microprocessors and Programming

Dr. Kadir Erkan

YILDIZ TEKNİK ÜNİVERSİTESİ

Fall : 2024
Microprocessors and Programming

Instructor : Dr. …
E-mail : …
Office : …

Teaching Assistant : Berke Oğulcan Parlak


: [email protected]
Office : E2-103

2
Lecture Slides / Notes

Lecture notes and slides will be


shared over Google Class Room

Invitation links will be given at


Lab. Class

GR:1 svfofsv
GR:2 fzgqqol

3
Course Description

The purpose of this course is to introduce the basics of microprocessors and


microcontrollers.

Therefore PIC 16FXXX series processors are used to introduce architecture,


software, and interfacing concepts.

Software

Microprocessors and programming

Hardware

4
Course Objectives

Upon completing this course, you should be able to:


 explain the microprocessor architecture and its components
 learn PIC16FXXX instruction set
 design and implement assembly language programs using PIC16FXXX
instruction set
 design and implement C language programs using PIC16FXXX
by CCS embedded functions
 recognise basic components and functionality of microcomputer
testing and development equipment.

5
Course Prerequisites

In this course, the students are expected to make distinctive term projects by

keeping good balance of software and hardware sides.

Therefore, basic knowledge of analog and digital electronics is mandatory and good

command of c programming skills are necessary.

6
Tentative Course Plan

Week Content (THEORETICAL) Content (APPLICATION)


1 Fundamentals of microprocessors and microcontrollers Online Lecture (Binary/Hexadecimal/Decimal Conversions)
2 Introduction to microcontrollers Online Lecture (Logic Gates and Logic Circuits)
3 PIC microcontrollers and PIC16FXXX Online Lecture (PIC16FXXX Port & Pins, CCS C, MPLAB & Proteus)
4 PIC16FXX assembly instruction set Online Lecture (Basic Commands in Assembly Language)
5 PIC 16FXX basic I/O programming LAB - 1 (Assembly Application - 1)
6 PIC 16FXX timer/counter programming LAB - 2 (Assembly Application - 2)
7 Introduction to PIC C programming and CCS C compiler LAB - 3 (Assembly Application - 3)
8 Midterm Week Midterm Week
9 Basic I/O programming CCS C functions LAB - 4 (C Application - 1)
10 Interrupt subroutine programming LAB - 5 (C Application - 2)
11 ADC and internal EEPROM programming LAB - 6 (C Application - 3)
Inter-microcontroller communications and PSP programming Timer/counter and PWM modüle programming
12
I2C and SPI interface programming Online LAB - 7 (C Application Assignment)
13 Project Presentations Project Presentations
14 Project Presentations Project Presentations
15 Final Week Final Week

7
Grading Policy

Activity Total Contribution %


Labs (1-6) 18
Lab 7 2
Evaluation System
Midterm 20
Final (Project) 20
Final (Exam) 40
* The student has the right to 2 absences for laboratory applications.

8
Recap

In the first 4 weeks, there will be a recap course in the lab classes.

• Bin/hex/Dec transforms

• Logic gates and logic circuts

• 16F887 ports &


Necessary softwares (Proteus, CCS C, MPLABX)

• Assembly instruction set for Pic16FX

9
Recommended Books

Mikrodenetleyiciler ve PIC Programlama, O. Altınbaşak, 2020. Altaş Yayıncılık

Mikrodenetleyiciler, H. H. Genç, 2019. Nobel Yayıncılık

PIC Mikrodenetleyiciler; A. Bayrak; 2018; Ekin Yayıncılık

CCS C ile PIC Programlama, Serdar Çiçek, 2009, Altaş Yayıncılık

Programming 8-bit PIC Microcontrollers in C with interactive Hardware


Simulation;M.P. Bates,2008, Newnes

PIC Programlama Teknikleri ve PIC16F877A; H. Şahin, A. Dayanık, C.


Altınbaşak, 2006, Altaş Yayıncılık

Embedded C Programming and the Microchip PIC,R. Barnett, L’O Cull and S.
Fox, 2004, thomson

PIC16F88x Data Sheet, Microchip Technology Inc.,


10
Recommended Books

11
Microcontroller to be used in course

Microchip
16F877A

12
Microcontroller to be used in course

Microchip
16F887

13
16F88x VS 16F87X

14
Microprocessor

• Microprocessor: is a single integrated circuit (IC) that accepts and


executes coded instructions (machine code or machine language)
for the purpose of manipulating data and controlling the associated
circuitry (RAM, ROM, and I/O ICs) in a digital system..

In the world of personal computers, the terms microprocessor


and CPU are used interchangeably.
15
Short History of CPUs

Intel 4004

Intel 8080

16
Short History of CPUs

17
Microprocessor

• A microprocessor (sometimes abbreviated µP) is a digital electronic


component with miniaturized transistors on a single semiconductor
integrated circuit (IC).

Three basic characteristics differentiate microprocessors:

1.Instruction set: The set of instructions that the microprocessor can execute.
2.Bus width : The number of bits processed in a single instruction.
3.Clock speed : Given in megahertz (MHZ) or Gigaheartz (GHz) the clock speed
determines how many instructions per second the processor can execute.

18
Microcomputer

 Microprocessors made possible the advent of the microcomputer.

A Microcomputer is an integrated system of computer components typically


containing data storage ICs, mass storage elements, and standard I/O devices,
capable of a wide variety of applications. Microcomputers contain a microprocessor
at the heart of the system, controlling data flow, manipulating data, and executing
instructions.

The term microcomputer is generally synonymous with personal computer, or a


computer that depends on a microprocessor.

19
Microprocessor

ROM Serial Interface

CPU I/O Ports

RAM Timers

Microprocessor chip only contains CPU which is central Processing Unit.


All the memory elements, I/O and serial interfaces are connected to it externally.

20
Microcontroller

ROM Serial Interface

CPU I/O Ports

RAM Timers

In microcontroller,
all the memory elements and I/O ports are integrated along with the CPU
inside a single chip.

21
Microprocessor & Microcontroller

Microcontrollers and Microprocessors can look like similar physically.

10/13/2024 22
Difference Between MicroController and Microprocessor

Application

Microprocessors Microcontroller

Tasks are not predefined Tasks are predefined

Gaming
web browsing
video editing Relationship between input and output is defined
Mathematical calculations
Simulations Performs predefined tasks according to inputs

23
Difference Between Microcontroller and Microprocessor

Microprocessor Microcontroller
Apllications General Computing Appliance,
(i.e. Pc, Notebooks) Specialized devices
Speed Very fast ~GHz Relatively slow ~MHz

External Parts Many Few

Cost High Low

Energy Use Medium to high Low

24
Software
 Machine Language (0-1)
 Binary Instructions
 Difficult to decipher and write
 Error-prone

 All programs converted into machine language for execution


 Mnemonic Machine Language (Assembly)
 Machine instructions represented in mnemonics
 One-to-one correspondence
 Efficient execution and use of memory
 Machine-specific

25
Software
 High-Level Languages
 BASIC, C, and C++
 Written in statements of spoken languages
 Machine independent
 Easy to write and troubleshoot
 Larger memory and less efficient execution

26
Internal Components of Microprocessors

27
Internal Components of Microprocessors

 Data Bus
It is a group of wires that is used to channel data (which to be processed or
after processed) from peripherals (memory or I/O devices) to CPU or vice
versa.

 Address Bus
It is a group of wires that is used to channel locations of data which will be or
has been processed.

 Control Bus
It is a group of wires that is used to send control signals (such as MEMW,
MEMR, IOR, IOW, interrupt and DMA) from CPU to peripheral (memory or I/O
devices) or vice versa.

28
Internal Components of Microprocessors

 ALU (Arithmetic Logic Unit)


It performs arithmetic task such as addition, deduction, multiplication and
division and logic task such as AND, OR, NOT and etc.

 ACC (Accumulator)
It is a register which can store data for temporary before sending to process in
ALU and also can store the processed data before sending to store in the memory
or display through peripheral output.
It is just like a “entrance” for a data to go in and come out from ALU.

 Flag register/PSW (Program Status Word ) register


This register contains information regarding the result of a process which has
been carried out by ALU.
It tells the user whether the result has Carry (CY), Auxiliary Carry (AC), Odd or
Even Parity (P) or Overflow (OV) or the other way round.
It also consists information regarding registers from which bank will be working
on.

29
Internal Components of Microprocessors

 Program Counter (PC)


It controls the sequence in which the instructions in a program are performed.
Normally, it does this by counting in the sequence, that is 0, 1, 2, 3, …
At any given time, the count indicates the location in memory from which the
next location of information/instruction is to be taken.

 Stack Pointer (SP)


This register will store the contains of Program Counter (location of memory)
for a short time when there is subroutine/sub-program occurs in the program.
This register will be taken place when some particular instructions, such as
PUSH, POP, CALL and RET are used in the program.

 Data Register
This register is a temporary storage location for data going to or coming from
the data bus.

30
Internal Components of Microprocessors

 Address Register
This register is another temporary storage location.
It holds the address of the memory location or I/O device that is used in the
operation presently being performed.

 Instruction Decoder
After an data is pulled from memory and placed in the data register, the data is
decoded by this circuit.
The decoder checks the code and decides which operation is to be performed.

 Controller-sequencer
This unit will produce a variety of control signals to carry out the instruction.
Since each instruction is different, a different combination of control signals is
produced for each instruction.

31

You might also like