Microprocessors and Microcontrollers
Microprocessors and Microcontrollers
Microcontrollers
Prof. Vinay J. Patel
Professor, Mechanical Engineering Department
Birla Vishvakarma Mahavidyalaya (Engineering College)
Vallabh Vidyanagar – 388120. Gujarat, INDIA
General form of microprocessor system Microprocessor Systems
• Digital signals move from one section to another along paths called buses.
• Parallel conductress
• Shared by all chips in the system
• When one chip puts data on the bus, the other chips have to wait their turn until
the data transfer is complete
• Typically a bus has 16 or 32 parallel connection
• There are three forms of bus in a microprocessor system
1. Data bus
2. Address bus
3. Control bus
Buses
Address bus
• Carries signals which indicate where data is to be found – memory
location.
• Each storage location within a memory device has a unique identification,
termed as address.
• Each input/output interface also has an address.
• When a particular address is selected by its address being placed on the
address bus, only that location is open to the communications from the
CPU. The CPU is thus able to communicate with just one location at a time.
• For example, the size of address bus by a 16-bit-wide address bus is 216 =
Buses
Control bus
• The signals relating to control actions are carried by the control bus.
• For example, it is necessary for the microprocessor to inform memory
devices whether they are to read data from an input device or write data
to an output device.
• The term READ is used for receiving a signal and WRITE for sending a
signal.
• The control bus is also used to carry the system clock signals; they are to
synchronise all the actions of the microprocessor system.
• The clock is a crystal-controlled oscillator and produces pulses at regular
Buses
intervals.
The arithmetic and logic unit is responsible for performing the data manipulation.
Registers
Internal data that CPU is currently using is temporarily held in a group of registers
while instructions are being executed. These are memory locations within the
microprocessor and are used to store information involved in program execution.
Control Unit
The control unit determines the timing and sequence of operations. It generates
the timing signals used to fetch a program instruction from memory and execute
it. The Motorola 6800 uses a clock with a maximum frequency of 1 MHz, i.e. a
clock period of 1 𝜇𝑠, and instruction require between two and twelve clock
cycles. Operations involving the microprocessor are reckoned in terms of the
number of cycles they take.
There are a number of types of register, the number, size and types registers
varies from one microprocessor to another.
The constituent of a microprocessor
Accumulator Register
The accumulator register (A) is where data for an input to the arithmetic and
logic unit is temporarily stored.
Supply the address of the required memory word using the address bus.
Since only one memory location can be addressed at once, temporary
storage has to be sued when, for example, numbers are combined.
For example, in the addition of two numbers, one of the number is fetched
from one address and placed in the accumulator register while the CPU
fetches the other number from the other memory address. Then the two
numbers can be processed by the arithmetic and logic section of the CPU.
The result is then transfer back into the accumulator register.
This contains information concerning the result of the latest process carried
out in the arithmetic and logic unit. It contains individual bits (flags) with
each bit having special significance. The status of the latest operation is
indicated by each flag with each flag being set or reset to indicate a specific
status.
Flag Set, i.e. 1 Reset, i.e. 0
Z Result is zero Result is not zero
N Result is negative Result is not negative
C Carry is generated Carry is not generated
V Overflow occurs Overflow does not occur
I Interrupt is ignored Interrupt is processed normally
register contains the address of the memory location that contains the next program
instruction.
As each instruction is executed, the program counter register updated so that it contains
the address of memory location where the next instruction to be executed is stored.
The program counter is incremented each time so that the CPU executes instructions
sequentially unless an instruction, such as JUMP or BRANCH, changes the program
counter out of that sequence.
Memory Address Register (MAR)
This contains address of data.
For example, in the summing of two numbers the memory address register is loaded
with the address of the first number. The data at the address is then moved to the
accumulator. The memory address of the second number is then loaded into the memory
address register. The data at this address is then added to the data in the accumulator.
The result is then stored in a memory location addressed by the memory address
register.
This stores an instruction. After fetching an instruction from the memory via the
data bus, the CPU stores it in the instruction register. After each such fetch, the
microprocessor increments the program counter by one with the result that the
program counter points to the next instruction waiting to be fetched.
General-purpose Register
These may serve as temporary storage for data or addresses and be used in
operations involving transfers between other registers.
Stack Pointer Register (SP)
The contents of this register form an address which defines the top of the stack in
RAM. The stack is a special area of the memory in which program counter values
can be stored when a subroutine part of a program is being used.
more integrated circuits. The data may be program instruction codes of numbers being operated
on.
The
10
size of a memory unit is specified in terms of number of storage location available; 1𝐾 is
2 = 1024 location
ROM
Read-Only-Memory (ROM) stores data permanently.
ROMs are programmed with required contents during the manufacture of the integrated circuit.
ROMs do not lose their memory when power is removed.
PROM
Programmable ROM (PROM) – ROMs that can be programmed by the user.
Initially every memory cell has a fusible link which keeps its memory at 0. The 0 is permanently
changed to 1 by sending a current through the fuse to open it permanently. Once the fusible link
has been opened the data is permanently stored in the memory and cannot be further changed.
Input/Output
The constituent of a microprocessor
Buses
• The 8085 is an 8-bit general purpose microprocessor that can address 64K
Byte of memory.
• It has 40 pins and uses +5V for power. It can run at a maximum frequency
of 3 MHz.
• The pins on the chip can be grouped into 6 groups:
• Address Bus.
• Data Bus.
• Control and Status Signals.
• Power supply and frequency.
Intel 8085
The ALU
A closer look at the 8085 Architecture
S Z X AC X P X C
Sign Carry
Zero Parity
Auxiliary
Carry
X-
Unspecified
There is also a flag register whose bits are affected by the arithmetic & logic operations.
• S-sign flag
The sign flag is set if bit D7 of the accumulator is set after an arithmetic or logic operation.
• Z-zero flag
Set if the result of the ALU operation is 0. Otherwise is reset. This flag is affected by operations on the
accumulator as well as other registers. (DCR B).
• AC-Auxiliary Carry
This flag is set when a carry is generated from bit D3 and passed to D4 . This flag is used only internally for BCD
operations.
• P-Parity flag
After an ALU operation, if the result has an even # of 1s, the p-flag is set. Otherwise it is cleared. So, the flag can
be used to indicate even parity.
• CY-carry flag
This flag is set when a carry is generated from bit D7 after an unsigned operation.
• OV-Overflow flag
This flag is set when an overflow occurs after a signed operation.
Interrupt sources 6 8 6
serial port control register SCON at address 98H is used to control the
various modes of operations.
Boarduino Kit
Different Arduino Boards
Arduino LilyPad
DIY Arduino
Arduino Uno
and version 1.0 will be the reference versions of Arduino, moving forward. The Uno is the latest in a
series of USB Arduino boards, and the reference model for the Arduino platform.
• EEPROM: 1 KB (ATmega328)
• Clock Speed: 16 MHz
18-Oct-21 Microprocessor and Microcontrollers: Prof. Vinay J. Patel 49
USB
PWR IN
(to Computer)
RESET
SCL\SDA
(I2C Bus)
POWER
5V / 3.3V / GND
Arduino Board
Digital I\O
PWM(3, 5, 6, 9, 10, 11)
Analog
INPUTS
• The CPU speed of Raspberry Pi varies from 700 MHz to 1.2 GHz. Also, it has on-
board SDRAM that ranges from 256 MB to 1 GB.
• Raspberry Pi also provides on-chip SPI, I2C, I2S and UART modules.