Professional Documents
Culture Documents
Microprocessors & Interfaces-CompleteNotes PDF
Microprocessors & Interfaces-CompleteNotes PDF
Prepared By:
SUDHA NAIR
LECTURER(E&TC)
R.C.E.T,BHILAI.
MYcsvtu Notes Rungta College of Engg. & Technology 1
UNIT- I
Microprocessor Architecture
Transistor count
Today's Intel® Core™2 Duo processors contain over
291 million transistors.
A human hair
The Intel 4004 microprocessor circuit line width was 10
microns or 10,000 nanometers.
Today Intel's microprocessors have circuit line widths
of .065 microns or 65 nanometers.
A nanometer is one billionth of a meter.
By comparison, a human hair is approximately 100
microns or 100,000 nanometers.
Manufacturing
Identification
Model name: i4004.
Supplier: Intel.
Component class: CPU.
Architecture
4 bit data bus.
12 bit address bus (multiplexed).
Separate address space for instructions and data
(Harvard architecture).
Physics
Manufacturing technology: PMOS.
Number of transistors: 2250.
Die size: 24 mm2.
Packaging: 16 pin CerDIP.
Dates
Introduction date: 1970.
First microprocessor ever built.
Compatibility
Intel i4004 CPU with extra features:
more instructions,
interrupt support.
Physics
Manufacturing technology: PMOS
Packaging: 24 pin CerDIP.
Dates
Introduction date: 1972
Physics
Manufacturing technology: PMOS.
Number of transistors: 3300.
Packaging: 18 pin CerDIP.
Dates
Introduction date: April 1972.
Generation
Generation: 8080.
Compatibility
Intel i8008 CPU with stack.
Architecture
8 bit data bus.
16 bit address bus.
Separate address space for instructions and data
(Harvard architecture).
Physics
Packaging: 40 pin CerDIP.
Introduction date: April 1974.
Generation
Generation: 8080.
Compatibility
Intel i8080 CPU upward instruction compatible.
Extra instructions:
SIM (Set Interrupt Mask)
RIM (Read Interrupt Mask)
Extra interrupt lines, including NMI (Non-Maskable
Interrupt).
Architecture
8 bit data bus.
16 bit address bus.
Data and address bus are multiplexed.
Separate address space for instructions and data .
Clock speed
Clock Model Manufactu
speed ring
technolog
y
Physics 3 MHz Intel I8085a NMOS
Control Logic
Registers, etc…
Memory
Input / Output interfaces
I/O devices:
Registers
Accumulator
The accumulator is an 8-bit register that is a part of
arithmetic/logic unit (ALU).
This register is used to store 8-bit data and to perform
arithmetic and logical operations.
The result of an operation is stored in the accumulator.
The accumulator is also identified as register A.
Flags
They are called Zero (Z), Carry (CY), Sign (S), Parity
(P), and Auxiliary Carry (AC) flags.
Address Bus
Data Bus and
Control Bus.
Data Bus:
Bus is bi-directional.
Size of the data bus determines what arithmetic can be
done.
If only 8 bits wide then largest number is 11111111 (255
in decimal).
Therefore, larger number have to be broken down into
chunks of 255.
This slows microprocessor.
READY :
HOLD :
Internal processing can continue.
Upon receipt of HOLD, the „ 85 will tri state its address,
data, and certain control lines, then generate HLDA.
This signals the other processor that it may proceed.
The „85 will remain off the buses until HOLD is negated.
HLDA :
HOLD ACKNOWLEDGE- indicates that the CPU has
received the Hold request and that it will relinquish the
buses in the next clock cycle.
HLDA goes low after the Hold request is removed.
The CPU takes the buses one half clock cycle after
HLDA goes low.
INTERRUPT REQUEST:
This line provides a vectored interrupt capability to the
8085.
INTR :
The interrupting device will jam a Restart (RST)
instruction onto the data bus, which the „85 uses to
locate an interrupt vector in low RAM. is used as a
general purpose interrupt.
INTR :
If it is active, the Program Counter (PC) will be inhibited
from incrementing and an INTA will be issued.
INTA :
INTERRUPT ACKNOWLEDGE- is used instead of (and
has the same timing as) RD during the Instruction cycle
after an INTR is accepted.
These lines have priority over the INTR line, and each
other.
TRAP:
RESET IN :
These lines provide for both MP and system reset.
The reset circuitry in the 8224, used with the 8080, has
been brought inside the MP.
The RESET IN line is generated asynchronously by
some sort of external circuit, such as an RC network or
Reset switch.
RESET IN :
Upon receipt of this signal, the „85 will internally
synchronize the Reset with the clock of the processor,
then generate RESET OUT for other devices in the
system.
Reset sets the Program Counter to zero and resets the
Interrupt Enable and HLDA flip flops.
RESET IN :
None of the other flags or registers (except the
instruction register) are affected.
X1, X2 :
Crystal or R/C network connections to set the internal
clock generator.
The input frequency is divided by 2 to give the internal
operating frequency.
These two pins provide connection for an external
frequency determining circuit to feed the 8085‟s clock.
X1, X2 :
This is normally a crystal, although other resonant
circuits may be used. X1 alone may be used as a single
input from an external oscillator.
CLK :
Clock Output for use as a system clock when a crystal
or R/ C network is used as an input to the CPU.
The period of CLK is twice the X1, X2 input period.
This line provides a system clock signal to external
circuits which need to be in synchronization with the
MP.
IO/M :
SID:
Serial input data line .
SOD :
Serial output data line.
These lines are brought into the device as D7, and may
be tested or set by the Read Interrupt Mask (RIM) or
Set Interrupt Mask (SIM) instructions.
Vcc:
+5 volt supply.
Vss:
Ground Reference.
Status Information
IO/M cycle status signal is provided directly also.
Status Information
S1 can be interpreted as R/W in all bus transfers. In the
8085A the 8 LSB of address are multiplexed with the
data instead of status.
The ALE line is used as a strobe to enter the lower half
of the address into the memory or peripheral address
latch.
This also frees extra pins for expanded interrupt
capability.
TRAP:
The TRAP interrupt is useful for catastrophic errors
such as power failure or bus error.
The TRAP input is recognized just as any other interrupt
but has the highest priority.
It is not affected by any flag or mask.
The TRAP input is both edge and level sensitive.
Instruction Cycle –
The time required by the 8085 to fetch and execute one
machine language instruction is defined as an
Instruction Cycle.
Instruction Cycle –
The 8085‟s method of instruction execution inside the
MP is more organized, however, and so the time
required to execute any instruction is more predictable
and more regular.
Machine Cycle –
Each instruction is divided into one to five Machine
Cycles.
Each machine cycle is essentially the result of the need,
by the instruction being executed, to access the RAM.
The shortest instruction would require just one machine
cycle, in which the instruction itself is obtained from
RAM.
OPCODE FETCH:
This is the first machine cycle of any instruction.
It is defined with S0 and S1 asserted high, and I-O/M
and /RD low.
It is a read cycle from RAM to obtain an instruction byte.
MEMORY READ:
This is a normal read cycle of any byte except the OP
code.
It is defined with S0 and S1 set to 0, 1 respectively, and
I-O/M and /RD low.
It is a read cycle from RAM to obtain a data or address
byte.
MEMORY WRITE:
This is a normal write cycle to memory.
It is defined with S0 and S1 set to 1, 0 respectively, and
I-O/M and /WR low.
It is a write cycle to RAM to store one byte in the
specified address
I/O READ:
This is a normal read cycle from an I/O device.
It is defined with S0 and S1 set to 0, 1 respectively, and
with I-O/M high and /RD low.
It is a read cycle which will bring one byte into the MP
from the input device specified.
I/O WRITE:
This is a normal write cycle to an I/O device.
It is defined with S0 and S1 set to 1, 0 respectively, and
with I-O/M high and /WR low.
It is a write cycle which will send one byte outbound
from the MP to the specified output device.
INTERRUPT ACKNOWLEDGE:
This is a response to an interrupt request applied to the
MP via the INTR line.
It is defined with S0 and S1 set to 1, 1 respectively, I-
O/M set high, and both /RD and /WR also high.
BUS IDLE:
This is an idle cycle in which no specific bus activity is
defined.
It occurs under three differently defined conditions:
Halt:
This idle cycle indicates that the MP has executed a
Halt instruction.
The I-O/M, /RD, and /WR lines are all tri stated, which
would allow them to be controlled by other devices.
INTA is held inactive, but not tri stated.
The Hold line is really the proper one to use for DMA or
multiple processors.
T-states-
Each of the machine cycles defined above, during
which an access of a RAM address or an I/O device is
made (except the idle cycles), is further divided into T-
states.
Each T-state, for an „85 with a 3 MHz clock, will be
about 333 nanoseconds in length.
The first machine cycle, during which the OP code is
being fetched, will be either 4 or 6 T-states in length.
T-states-
Whether 4 or 6 T-states are used depends upon
whether the instruction needs further information from
RAM, or whether it can be executed to completion
straight away .
If multiple accesses are needed, the cycle will be 4
states long; if the execution can run to completion, 6
states are required.
T1 STATE:
This state is the first of any machine cycle.
S0-S1 lines, I-O/M, A8-A15, and AD0-AD7 contains
whatever would be appropriate for the type of
instruction being executed.
T1 STATE:
The S0-S1 and I-O/M lines will define, at this early point
in the machine cycle, whether the MP is attempting to
address a RAM location or an I/O device.
.
MYcsvtu Notes Rungta College of Engg. & Technology 168
8085 Timings-T-states-
T1 STATE:
The Address Latch Enable (ALE) line will allow some
sort of external circuitry to catch and hold the contents
of the AD0-AD7 lines to be used as the low byte of the
address.
The /RD, /WR, and /INTA lines are all negated at this
time.
T1 STATE:
Since the AD0-AD7 lines are being used to present an
address byte, it would be inappropriate to move data on
the data bus; besides, it‟s too early to do so.
It‟s also too early for /INTA. ALE, however, is asserted,
since this is the time that the AD0-AD7 contents will
contain the lower address byte, which must be caught
and held outside the „85 for use by the following T-
states.
T2 STATE:
All lines except ALE (which will be inactive for the rest
of the machine cycle) will assume the proper level for
the type of instruction in progress.
The address lines retain the bit pattern selecting one
byte from RAM or an I/O device;
The AD0-AD7 lines will now prepare to either accept or
present a data byte (they are in a state of transition
during T2).
T2 STATE:
I-O/M and the S0, S1 lines are still displaying the
original settings of T1.
Either /RD or /WR will assert during T2, to indicate the
nature of the data transaction.
INTA will assert at T2 if an interrupt cycle has started.
WAIT STATE:
If the Ready line was negated during T2, a Tw is
inserted to allow the external circuitry more time to
prepare for data transmission.
A specific point in T2 is defined, after which a late
negation of Ready will not cause the Tw to be inserted.
This corresponds to the same actions in the 8080
device. All signals set up during T2 will remain constant
during Tw.
T3 STATE:
All lines set up during T2 will remain the same in T3,
except the AD0-AD7 lines, which will be conducting
data either into or out of the 8085.
At the end of T3, the /RD or /WR line will negate to
indicate the end of the active function.
This will cause the data byte standing on AD0-AD7 to
disappear
T4 - T6 STATES:
These states are required for time to permit the 8085 to
continue processing internally.
T4 - T6 STATES:
Since T4 through T6 will exist only on the first machine
cycle of an instruction, this corresponds correctly with
the Machine Cycle chart.
The AD0-AD7 lines are tri stated; the A8-A15 retain
their original setting; the /RD, /WR, and INTA lines are
all negated.
Special conditions:
In addition to the T-states described above, there are
also various conditions during states involved in Resets,
Halts, and Holds.
Special conditions:
These states tri state the address, AD, I-O/M, /RD, and
/WR lines to allow external devices to control them.
The other lines are held at inactive levels except the S0
& S1 lines, which do indicate what type of machine
cycle the system is in, i.e., whether it is a Reset, Hold,
or Halt
Load accumulator
LDA 16-bit address
The contents of a memory location, specified by a16-bit
address in the operand, are copied to the accumulator.
The contents of the source are not altered.
Example: LDA 2034H
Jump unconditionally
JMP 16-bit address The program sequence is
transferred to the memory location specified by the 16-
bit address given in the operand.
Example: JMP 2034H or JMP XYZ
Jump conditionally
Operand: 16-bit address
The program sequence is transferred to the memory
location specified by the 16-bit address given in the
operand based on the specified flag of the PSW as
described below.
Example: JZ 2034H or JZ XYZ
JC Jump on Carry CY = 1
JNC Jump on no Carry CY = 0
JP Jump on positive S = 0
JM Jump on minus S = 1
JZ Jump on zero Z = 1
JNZ Jump on no zero Z = 0
JPE Jump on parity even P = 1
JPO Jump on parity odd P = 0
CC Call on Carry CY = 1
CNC Call on no Carry CY = 0
CP Call on positive S = 0
CM Call on minus S = 1
CZ Call on zero Z = 1
CNZ Call on no zero Z = 0
CPE Call on parity even P = 1
CPO Call on parity odd P = 0
MYcsvtu Notes Rungta College of Engg. & Technology 226
Subroutine
RET none
The program sequence is transferred from the
subroutine to the calling program.
The two bytes from the top of the stack are copied into
the program counter, and program execution begins at
the new address.
Example: RET
RC Return on Carry CY = 1
RNC Return on no Carry CY = 0
RP Return on positive S = 0
RM Return on minus S = 1
RZ Return on zero Z = 1
RNZ Return on no zero Z = 0
RPE Return on parity even P = 1
RPO Return on parity odd P = 0
Complement carry
CMC none
The Carry flag is complemented.
No other flags are affected.
Example: CMC
No operation
NOP none
No operation is performed.
The instruction is fetched and decoded.
However no operation is executed.
Example: NOP
Disable interrupts
DI none
The interrupt enable flip-flop is reset and all the
interrupts except the TRAP are disabled.
No flags are affected.
Example: DI
Enable interrupts
EI none
The interrupt enable flip-flop is set and all interrupts are
enabled. No flags are affected.
After a system reset or the acknowledgement of an
interrupt, the interrupt enable flip flop is reset, thus
disabling the interrupts.
This instruction is necessary to enable the interrupts
(except TRAP). Example: EI
MYcsvtu Notes Rungta College of Engg. & Technology 254
Machine control instructions
Decrement SP by 1
Save most significant byte of register pair
Decrement SP by 1
Save least significant byte of register pair
Naturally a pop from the stack has just the opposite
effect:
Immediate addressing
Data is present in the instruction. Load the immediate
data to the destination provided.
Example: MVI R, data
Register addressing
Data is provided through the registers.
Example: MOV Rd, Rs
Direct addressing
Used to accept data from outside devices to store in the
accumulator or send the data stored in the accumulator
to the outside device.
Accept the data from the port 00H and store them into
the accumulator or Send the data from the accumulator
to the port 01H.
Example: IN 00H or OUT 01H
Indirect Addressing
This means that the Effective Address is calculated by
the processor and the contents of the address (and the
one following) is used to form a second address.
The second address is where the data is stored.
Note that this requires several memory accesses; two
accesses to retrieve the 16-bit address and a further
access (or accesses) to retrieve the data which is to be
loaded into the register.
ORG (origin)
org 20
The next block of instructions or data should be stored
in memory locations starting at 2010.
Either hex or decimal numbers are acceptable.
END
end
start end of assembly.
A HLT instruction may suggest the end of a program,
but does not necessarily mean it is the end of assembly.
"start" is the label at the beginning of the program*.
EQU
(equate)
lookup equ 2
The value of the term, lookup, is equal to 2.
lookup's value may be referred by name in the program.
Similar to a constant statement.
DB
(define byte)
data: db 34 or data: db 34
db A2,db 93
Initializes an area byte by byte.
Assembled bytes of data are stored in successive
memory locations until all values are stored.
The label is optional and may be used as the memory
location of the beginning of the data.
MYcsvtu Notes Rungta College of Engg. & Technology 272
8085 Assembler Directives
DW (define word)
long: dw 2050 Initializes an area two bytes at a time.
DS (define storage)
table: ds 10
Reserves a specified number of memory locations.In
this example,10 memory locations are reserved for
"table".
The label may be used as the memory location of the
beginning of the block of memory.
MYcsvtu Notes Rungta College of Engg. & Technology 273
Instruction Format
An instruction is a command to the microprocessor to
perform a given task on a specified data.
MOV rd, rs
rd <-- rs copies contents of rs into rd.
Coded as 01 ddd sss where ddd is a code for one of the
7 general registers which is the destination of the data,
sss is the code of the source register.
MVI r, data
r <-- data
Example: MVI A,30H coded as 3EH 30H as two
contiguous bytes.
MYcsvtu Notes Rungta College of Engg. & Technology 280
Instruction Format
ADI data
A <-- A + data
OUT port
where port is an 8-bit device address.
(Port) <-- A.
Since the byte is not the data but points directly to
where it is located this is called direct addressing.
For example:
Transfer the program sequence to the memory location
2085H.
JMP 2085H Rungta College of Engg. & Technology 282
MYcsvtu Notes
Instruction Format
C3 85 20
First byte Second Byte Third Byte
This instruction would require three memory locations to
store in memory.
Three byte instructions - opcode + data byte + data byte
Example:
LXI H,0520H coded as 21H 20H 50H in three bytes.
This is also immediate addressing.
LDA addr
A <-- (addr) Addr is a 16-bit address in L H order.
Example: LDA 2134H coded as 3AH 34H 21H.
This is also an example of direct addressing.
Sol 2
Program
MVI B, count H -7T
DELAY DCR B -4T
JNZ DELAY -10T/7T
RET -10T
Sol 3
Given frequency = 2 MHz
Count = (3480)H = (13440)d
T = (1/2*10^6) = .5 micro secs
Td= 10T+(6T+4T+4T+10T)* count-1
+(6+4+4+7)T+10T
Hence substituting the values of 1 T & count we have
Td = 161288.5 micro secs = 161.28 ms = .16 s
RRC
RRC
RRC
RRC
CALL ASCII
STAX D
INX D
MOV A,B
SUBROUTINE
SUI 30 H
CPI 0A H
RC
SUI 07 H
RET
PUSH B
PUSH D
MOV C,A
ANI OF H
MOV B,A
MOV A,C
SUM ADD E
DCR D
JNZ SUM
ADD B
POP D
POP B
RET
MVI D, 05
LXI B, 0015
LXI H, 0000
DAD B
DCR D
JNZ C008
HLT
MVI C , 09
LDA C001
LXI H, C002
ADD M
INX H
DCR C
JNZ D008
STA C100
HLT
Task
Why is character input slow?
There are different types of character input from a
keyboard.
There is an expected input by an application program in
response to a „read statement‟ of some kind that
requests input of data for the program, think about data-
entry into an expert system.
Task
How do you think a mouse action can act as an
interrupt?
Disks, printers, screens and other I/O devices operate
under the CPU program control.
VDUs and most printers are output devices, and the
output that is produced is determined by the program
undergoing execution.
Interface modules
Interface modules can be very simple and control a
single I/O device. Alternatively, interface modules can
be complex, controlling many I/O devices and may have
substantial built in intelligence
Data Lines
RAM ROM
Input Buffer WR
Address Address CS
CS
Lines Lines
Data Lines
Date
Lines
8085
CS
A15-A8
ALE
A9- A0 1K Byte
AD7-AD0 Latch Memory
A7- A0 Chip
WR RD IO/M D7- D0
RD WR
0000 H
4K EPROM
0FFF H
1000 H
4K RAM
1FFF H
2000 H
4K RAM
2FFF H
FFFF H
0FFF H
RAM
C000 H
COOO H
4K EPROM
CFFF H
FFFF H
2 KB = 2*2^10
= 2 ^ 11
Hence 11 address lines (A0-A10) are connected directly
to the memory chip and A15 to A11 are used for
selecting the chip
0000 H
Actual Address
03FF H
4000 H
43FF H
8000 H
Folded
Address83FF H
C000 H
C3FF H
FFFF H
Classification of Interrupts
Interrupts can be classified into two types:
Maskable Interrupts (Can be delayed or Rejected)
Non-Maskable Interrupts (Can not be delayed or
Rejected)
Interrupt
Main routine
Go to
service
Go back
routine
Get EI
original RET
program
counter Service routine
INTR Yes No
RST 5.5 Yes Yes
RST 6.5 Yes Yes
RST 7.5 Yes Yes
TRAP No Yes
TRAP
RST7.5
RST6.5
RST 5.5 8085
INTR
INTA
on the stack.
Then the microprocessor jumps to the address
lowest.
The 3 outputs carry the index of the highest priority
active input.
MYcsvtu Notes Rungta College of Engg. & Technology 427
Multiple Interrupts & Priorities using
Priority Encoder
Note that the op codes for the different RST instructions
follow a set pattern.
Bit D5, D4 and D3 of the op codes change in a
binary sequence from RST 7 down to RST 0.
The other bits are always 1.
M5.5
M7.5
M6.5
MSE
SDO
R7.5
SDE
XXX
RST5.5 Mask 0 - Available
Serial Data Out RST6.5 Mask
RST7.5
} 1 - Masked
Mask
Enable Serial Data
0 - Ignore bit 7 Mask Set Enable
1 - Send bit 7 to SOD pin 0 - Ignore bits 0-2
1 - Set the masks according
to bits 0-2
P5.5
SDI
IE
RST 6.5
M 6.5
RST 5.5
M 5.5
Interrupt Enable
MYcsvtu Notes Rungta College of Engg. & Technology Flip Flop 448
How RIM sets the Accumulator’s different
bits
7 6 5 4 3 2 1 0
M5.5
M7.5
M6.5
P6.5
P7.5
P5.5
SDI
IE
RST5.5 Mask
Serial Data In RST6.5 Mask
RST7.5 Mask
} 0 - Available
1 - Masked
Bits 0-2 show the current setting of the mask for each of
RST 7.5, RST 6.5 and RST 5.5
They return the contents of the three mask flip
flops.
They can be used by a program to read the mask
Flop.
It can be used by a program to determine whether
Level
INTR Yes DI / EI No No
Sensitive
DI / EI Edge
RST 7.5 Yes Yes Yes
SIM Sensitive
Level &
TRAP No None Yes No Edge
Sensitive
MYcsvtu Notes Rungta College of Engg. & Technology 457
Interrupt Programs
7 6 5 4 3 2 1 0
0
0
0
0
0
Program
EI
MVI A, 08 H
SIM
Features
2kbytes ROM(8355) / EPROM(8755)
Two bidirectional 8 bit I/O ports
Each port line individually programmable for I or O
Internal AD demux using ALE
Generates ready signal
Separate control lines for I/O section
Control Words
Mode Instruction
Mode instruction is used for setting the function of the
8251. Mode instruction will be in "wait for write" at either
internal reset or external reset. That is, the writing of a
control word after resetting will be recognized as a
"mode instruction."
Items set by mode instruction are as follows:
• Synchronous/asynchronous mode
• Stop bit length (asynchronous mode)
• Character length Rungta College of Engg. & Technology 473
MYcsvtu Notes
8251 USART
Parity bit
Baud rate factor (asynchronous mode)
Internal/external synchronization (synchronous mode)
Number of synchronous characters (Synchronous
mode)
Status Word
D 0 to D 7 (l/O terminal)
This is bidirectional data bus which receive control
words and transmits data from the CPU and sends
status words and received data to CPU.
WR (Input terminal)
This is the "active low" input terminal which receives a
signal for writing transmit data and control words from
the CPU into the 8251.
RD (Input terminal)
This is the "active low" input terminal which receives a
signal for reading receive data and status words from
the 8251.
CS (Input terminal)
This is the "active low" input terminal which selects the
8251 at low level when the CPU accesses.
Note: The device won‟t be in "standby status"; only
setting CS = High.
Block diagram
(RD) Read.
A “low” on this Input pin enables the 8255A to send the
data or status information to the CPU on the data bus.
In essence, it allows the CPU to “read from the 8255A.
(WR) Write.
A “ low” on the input pin enables the CPU to write data
or control words into the 8255A.
(RESET)
Reset
A “high” on this Input clears the control register and all
ports (A, B, C) are set to the Input mode
Control Group A –
Port A and Port C upper (C7 C4)
Control Group B – Port B and Port C lower (C3 C0)
Ports A, B, and C
The 8255A contains three 8-bit ports (A , B, and C).
Mode Selection
There are three basic modes of operation that can be
selected by the systems software:
Mode 0 – Basic Input/Output
Mode 1 – Strobed Input/Output
Mode 2 – Bi-Directional Bus
When the reset Input goes “high” all ports will be set to
the Input mode (i.e., all 24 lines will be in the high
Impedance state).
After the reset is removed the 8255A can remain in the
input mode with no additional Initialization required.
During the execution of the systems program any of the
other modes may be selected using a single output
Instruction.
This allows a single 8255A to service a variety of
peripheral devices with a simple software maintenance
routine.
MYcsvtu Notes Rungta College of Engg. & Technology 519
8255A OPERATIONAL DESCRIPTION
Operating Modes
Mode 0 (Basic Input/Output).
This functional configuration provides simple input
operations for each of the three ports.
No “handshaking” is required data is simply written to
or read from a specified port.
Output Operations
OBF (Output Buffer Full).
The OBF output will go “low” to indicate that the CPU
has written data out to port A. ACK (Acknowledge).
A “low” on this input enables the tri-state output buffer of
port A to send out the data.
Otherwise, the output buffer will be in the high
impedance state. INTE 1 (The INTE Flip-Flop
Associated with OBF).
Controlled by bit set/reset of PC6
MYcsvtu Notes Rungta College of Engg. & Technology 542
8255A Operating Modes
Input Operations
STB (Strobe Interrupt) STB (Strobed Input).
A “low” on this input loads data into the input latch.
IBF (Input Buffer Full F/F).
A “high” on this output indicates that data has been
loaded into the input latch.
INTE 2 (The INTE Flip-Flop Associated with IBF).
Controlled by bit set/reset of PC4.
A1 A0 Select
0 0 PA
0 1 PB
1 0 PC
1 1 CONTROL
REGISTER
MYcsvtu Notes Rungta College of Engg. & Technology 544
8255A Operating Modes
BSR mode
Bit set/reset, applicable
to PC only. One bit is
S/R at a time.
Control word:
D7 D6 D5 D4 D3 D2 D1 D0
0(0=B X X X B2 B1 B0 S/R(
SR) S=1,
R=0)
I/O mode
D7 D6 D5 D4 D3 D2 D1 D0
Input mode:
D4, D2: Set/Reset INTE using BSR. STB-bar input is
connected to external peripheral's strobe output (i.e.
PC2, PC4 pin to external strobe).
Output mode:
D6, D2: Set/Reset INTE using BSR. ACK-bar input is
connected to external peripheral's acknowledge output
(i.e. PC2, PC6 pin to external ack).
Mode 2
Only for PA
Status:
D7 D6 D5 D4 D3 D2 D1 D0
OBF- INTE IBF-A INTE INTR X X X
A-bar 1(O/P 2(I/P) -A
)/ /
ACK- STB-
A- A-Bar
BAR
D7 D6 D5 Function Purpose
D7 D6 D5 Function Purpose
011 Read Display Selects type of
display read and address
of the read.
100 Write Display Selects type of write and
address of the write.
101 Display write inhibit Allows half-
bytes to be blanked.
110 Clear Clears the display or FIFO
111 End interrupt Clears the IRQ signal to
microprocessor
DD Function
00 8-digit display with left entry
01 16-digit display with left entry
10 8-digit display with right entry
11 16-digit display with right entry
MMM field:
DD Function
000 Encoded keyboard with 2-key lockout
001 Decoded keyboard with 2-key lockout
010 Encoded keyboard with N-key rollover
011 Decoded keyboard with N-key rollover
100 Encoded sensor matrix101Decoded
sensor matrix
110 Strobed keyboard, encoded display scan
111 Strobed keyboard, decoded display scan
MYcsvtu Notes Rungta College of Engg. & Technology 564
Keyboard Interface of 8279
001PPPPP
The clock command word programs the internal
clock driver.
The code PPPPP divides the clock input pin (CLK) to
achieve the desired operating frequency, e.g.
100KHz requires 01010 for a 1 MHz CLK input.
010Z0AAA
The read FIFO control word selects the address
(AAA) of a keystroke from the FIFO buffer (000 to
111).
Z selects auto-increment for the address.
MYcsvtu Notes Rungta College of Engg. & Technology 567
Keyboard Interface of 8279
011ZAAAA
The display read control word selects the read
address of one of the display RAM positions for
reading through the data port.
100ZAAAA
Selects write address -- Z selects auto-increment so
subsequent writes go to subsequent display
positions.
MYcsvtu Notes Rungta College of Engg. & Technology 568
Keyboard Interface of 8279
1010WWBB
The display write inhibit control word inhibits writing
to either the leftmost 4 bits of the display (left W) or
rightmost 4 bits.
BB works similarly except that they blank (turn off)
half of the output pins.
1100CCFA
The clear control word clears the display, FIFO or
both.
Bit F clears FIFO and the display RAM status, and
sets address pointer to 000.
If CC are 00 or 01, all display RAM locations
become 00000000.
If CC is 10, --> 00100000, if CC is 11, -->
11111111.
1110E000 -End of Interrupt control word is issued to
clear IRQ pin in sensor matrix mode.
MYcsvtu Notes Rungta College of Engg. & Technology 570
Keyboard Interface of 8279
A1, A0:
The address inputs select one of the four internal
registers with the 8254 as follows:
CLK: The clock input is the timing source for each of the
internal counters.
It is often connected to the PCLK signal from the bus
controller.
CS: Chip Select enables the 8254 for programming, and
reading and writing.
G: The gate input controls the operation of the counter
in some modes.
Mode 5:
Hardware triggered one-shot.
G controls similar to Mode 1.
Sol-
Assume counter 0 is used to generate the square wave
and the addresses of counter 0 = 10 H and the control
register is 13 H
1
0
1
1
0
1
1
0
BCD counting
Select counter 0
Mode 3 square
wave generator
Select counter 0
load lsb first then msb Read load lsb first then msb
Reset (I)
The reset signal is a pulse provided by 8085 to initialize
the system.
Input high on this line resets the chip and initializes the
three I/O ports to input mode.
The width of reset pin should typically be 600ns.
AD0-AD7(I/O)
These are three address or data lines that interface with
the CPU lower 8 bit data/address bus.
The 8 bit address is latched into the address latch on
the falling edge of the ALE.
The address can be either for the memory section or
the I/O section depending on the polarity of IO/M(bar)
signal
The 8 bit data is either written into the chip or read from
the chip depending on the status of write and read
input signals
CE(bar) (I)
Chip enable
This pin is active low
RD(I)
Input low on this line with the chip enable active enables
the AD0-7 buffers,
If IO/M(bar) is low the RAM content will be read out to
the AD bus.
Otherwise the content of the selected I/O port will be
read to the AD bus.
WR(I)-
Input low on this line with the chip enable active causes
the data on the AD lines to be written to the Ram or I/O
ports depending on the polarity of IO/M(bar)
ALE(I)
Address latch enable
This control signal latches the address on the AD0-7
lines and the state of the chip enable and IO/M(bar) into
the chip at the falling edge of ALE.
PA0-PA7(I/O)
These 8 lines are general purpose IO lines.
PB0-PB7
These 8 lines are general purpose IO lines.
The in out direction is selected by programming the
command and status register
PC0-PC5(I/O)
These 6 pins can function as either input port , output
port or as control signal for Pa and PB.
Programming is done through the C/S register
When they are used as control signals they will provide
the following
Timer in (I)
This is the timer input to the control timer
VCC(I)
+5 volt power supply
VSS
Ground reference
Status register
It consists of seven latches, one for each bit.
6 bits(0-5) for the status of the port.
One (6) for the status of the timer.
The status of the timer and IO section can be polled by
reading the C/S register.
Bits 6-7 of the C/S register are used to start and stop
the counter
C/S7 C/S6 Function
0 0- NOP
0 1- STOP
1 0- STOP AFTER TC
1 1- START
Timer format