MP Project
MP Project
EXP.N
NAME OF THE EXPERIMENT
O
1. Study of 8085 Microprocessor trainer kit
Arithmetic Operations with
a. 8-bit numbers (Addition, Subtraction, Multiplication,
2 Division)
b. 16- bit numbers (Addition, Subtraction, Multiplication,
Division)
Block Operations
a. Block Initialization
b. Block Move
c. Block Copy
d. Block Compare
3
e. Block Interchange
f. Block Insert
g. Block Delete
h. Block Search
Code Conversion
a. BCD to Binary
4 b. Binary to BCD
c. Binary to ASCII
d. ASCII to Binary
12 Music Synthesizer
AIM:
To study the entire structure, parts and architecture of 8085 microprocessor trainer
kit.
APPARATUS REQUIRED:
BASIC FEATURES:
24 TTL Lines
Hardware single stepping
RS 232-C compatible serial port
Bus Expansion for interfacing VBMB series of add-on cards and 24-TTL input-
output lines.
SPECIFICATIONS:
HARDWARE SPECIFICATIONS:
2. Memory:
3. Input/Output:
Parallel:
48 TTL I/O lines using two members of 8255
(only 24 I/O lines available in micro-85 EB1)
Serial:
One number of RS232C compatible serial interfaces using 8251A
USART.
Timer:
4. Display:
6 digit, 0.3”, 7 segment red LED display with filter.
4 digits for address display and 2 digits for data display.
5. Keyboard:
This facility allows the user to execute programs at machine cycle level
using a separate switch.
SOFTWARE SPECIFICATION:
1. Monitor program – 8 K
21 KEYS:
16-KEYS – HEX, COMMAND, REGISTER KEYS remaining are stand alone
keys.
KEYS:
1. Hex Keys ‘0’, ‘1’, ‘2’, ‘3’,…………., ‘F’
2. Command Keys
3. Register Key ‘E’, ‘D’, ‘C’, ‘B’, ‘F’, ‘A’, ‘L’, ‘H’, ‘I’, ‘PL’, ‘PH’, ‘SL’, ‘SH’
RES – This key allows you to terminate any present activity and to return to an initialized
state.
EXEC – Execute a particular program after selecting the address through GO command.
NEXT – Increment address by one and display its content or Display the next register
content.
TW – Writes data from memory on to the audio tape TR – Retries data from an audio
tape to memory.
F2 – Function Key.
PC – Program Counter
H – High
L – Low
F3 – Function key
SP – Stack Pointer
USER DEVELOPMENT
USART (8251)
JUMPER KEYS:
J3 AND J4 – RAM
J5 – EPROM
J3 J4 J5
Pressing the NEXT after entry of desired data will put the entered data to
memory location desired them.
2. REGISTER COMMAND:
To examine the register content.
5. SINGLE STEP:
This command helps the user to execute programs in steps (i.e .,)
Instruction by instruction
Useful while debugging
SNG - address - NEXT
6. FILL COMMAND:
This command moves permits a block of Ram memory to be filled with
desired data type.
GO NEXT EXEC
8. COMPARE COMMAND:
This command compares the contents of two blocks of memory locations
and display address whose contents are not identical.
9. INSERT COMMAND:
This command inserts the specified bytes in desired memory location
DEL - block start address- NEXT - block end address - NEXT - program end NEXT
Address
The block starting from (block and address +1) to the program end address will be
moved to the block starting address from block start address.
BLOC - starting add- NEXT - ending add - NEXT - byte - NEXT - INT
ARCHITECTURE OF 8085:
i. Registers
ii. Arithmetic and logic unit
iii. Instruction decoder and machine cycle encoder
iv. Address buffer
v. Address/Data buffer
vi. Incrementer/Decrementer address latch
vii. Interrupt control
viii. Serial I/O control
ix. Timing and control circuitry
(i) REGISTERS:
It has 8 addressable 8-bit registers A, B, C, D, E, H, L, F and two 16 bit
register PC and SP.
These registers can be classified as:
1. General purpose registers.
2. Temporary registers
a. Temporary data register
b. W and Z registers
3. Special purpose registers
a. Accumulator
b. Flag registers
c. Instruction register
4. Sixteen bit registers
a. Program Counter (PC)
b. Stack Pointer (SP)
1. General purpose registers:
The ALU has two inputs. One input is supplied by the Accumulator
and other from temporary data register. The programmer cannot access this
temporary data register. However, it is internally used for execution of most
of the arithmetic and logical instructions.
This instruction adds the contents if register A and register B and stores
the result in A.
b. W and Z Registers:
a. Register A (ACCUMULATOR)
b. Flag Registers:
i. S-Sign flag:
The zero flag sets if the result of operation in ALU is zero and
flag resets if result is non-zero. The zero flag is also set if a certain
register content becomes zero following an increment or decrement
operation of that register.
This flag is set if there is an overflow out of bit 3 i.e. carry from
lower nibble to higher nibble(D3 to D7 bit) and it is not available for the
programmer.
v. CY-Carry flag:
This flag is set if there is an overflow out of bit7. The carry flag
also serves as a borrow flag for subtraction.
RST5.5
____ INTA RST7.5
INTR SID SOD
TRAP
RST5.5
MULTIPLEXER
B REGISTER C REGISTER
FLAG (5)
FLIP FLOPS
INSTRUCTION DECODER AND MACHINE CYCLE ENCODING D REGISTER E REGISTER
H REGISTER L REGISTER
ALU
STACK POINTER
PROGRAM COUNTER
INC/DEC ADDRESS LATCH
+5V
POWER SUPPLY
GND
___ ___ __
RD WR IO/M
CLKOUT READY ALE S0 S1 HOLD ________
RESETIN
HLDA RESETOUT
RESULT:
Thus, the entire structure of 8085 has been studied.
Exp. No: 02 ARITHMETIC OPERATIONS
AIM:
AIM:
ALGORITHM:
RESULT:
Thus the 8 bit numbers stored at 4500 &4501 are added and the result stored at 4502 & 4503.
PROGRAM:
INPUT OUTPUT
4500 21 4502 23
4501 02 4503 00
4500 FE 4502 02
4501 04 4503 01
OBSERVATION:
INPUT OUTPUT
4500 4502
4501 4503
2 (B). 8 BIT DATA SUBTRACTION
AIM:
ALGORITHM:
RESULT:
Thus the 8 bit numbers stored at 4500 &4501 are subtracted and the result stored at
INPUT OUTPUT
4500 37 4502 F7
4501 40 4503 01
4500 23 4502 21
4501 02 4503 00
OBSERVATION:
INPUT OUTPUT
4500 4502
4501 4503
2 (C). 8 BIT DATA MULTIPLICATION
AIM:
To multiply two 8 bit numbers stored at consecutive memory locations and store the
result in memory.
ALGORITHM:
RESULT:
Thus the 8-bit multiplication was done in 8085p using repeated addition method.
PROGRAM:
ADDRESS OPCODE LABEL MNEMONICS OPERAND COMMENT
4100 START LXI H, 4500 Initialize HL reg. to
4101 4500
4102
Transfer first data to
4103 MOV B, M
reg. B
Increment HL reg. to
4104 INX H point next mem
ocation.
4105 MVI A, 00H Clear the acc.
4106
4107 MVI C, 00H Clear C reg for carry
4108
Add multiplicand
4109 L1 ADD M
multiplier times.
410A JNC NEXT
Jump to NEXT if there
410B
is no carry
410C
410D INR C Increment C reg
410E NEXT DCR B Decrement B reg
410F JNZ L1
Jump to L1 if B is not
4110
zero.
4111
Increment HL reg. to
4112 INX H point next mem.
Location.
Transfer the result from
4113 MOV M, A
acc. to memory.
Increment HL reg. to
4114 INX H point next mem.
Location.
Transfer the result from
4115 MOV M, C
C reg. to memory.
4116 HLT Stop the program
SAMPLE INPUT AND OUTPUT:
INPUT OUTPUT
4500 20 4502 40
4501 02 4503 00
OBSERVATION:
INPUT OUTPUT
4500 4502
4501 4503
2 (D). 8 BIT DIVISION
AIM:
ALGORITHM:
RESULT:
Thus an ALP was written for 8-bit division using repeated subtraction method and
MNEMO OPERA
ADDRESS OPCODE LABEL COMMENTS
NICS ND
4100 MVI B,00
Clear B reg for quotient
4101
4102 LXI H,4500
Initialize HL reg. to
4103
4500H
4104
4105 MOV A,M Transfer dividend to acc.
4106 INX H Increment HL reg. to point
next mem. Location.
4107 LOOP SUB M Subtract divisor from dividend
4108 INR B Increment B reg
4109 JNC LOOP
Jump to LOOP if result does
410A
not yield borrow
410B
410C ADD M Add divisor to acc.
410D DCR B Decrement B reg
410E INX H Increment HL reg. to point
next mem. Location.
410F MOV M,A Transfer the remainder from
acc. to memory.
4110 INX H Increment HL reg. to point
next mem. Location.
4111 MOV M,B Transfer the quotient from B
reg. to memory.
4112 HLT Stop the program
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
4500 03 4502 05
4501 15 4503 00
OBSERVATION:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
4500 4502
4501 4503
2 (E). 16 BIT DATA ADDITION
AIM:
ALGORITHM:
RESULT:
Thus an ALP program for 16-bit addition was written and executed in 8085p using
special instructions.
PROGRAM:
ADDRESS OPCODE LABEL MNEMONICS OPERAND COMMENT
8000 START LHLD 8050H
8001 Load the augend in DE
8002 pair through HL pair.
8003 XCHG
8004 LHLD 8052H
Load the addend in HL
8005
pair.
8006
8007 MVI A, 00H Initialize reg. A for
8008 carry
Add the contents of HL
8009 DAD D Pair with that of DE
pair.
800A JNC LOOP If there is no carry, go
800B to the instruction
800C labeled LOOP.
Otherwise increment
800D INR A
reg. A
800E LOOP SHLD 8054H Store the content of HL
800F Pair in 8054H(LSB of
8010 sum)
8011 STA 8056H Store the carry in
8012 8056H through Acc.
8013 (MSB of sum).
8014 HLT Stop the program.
INPUT OUTPUT
ADDRES DATA ADDRESS DATA
S
8050H A1 8054H 56
8051H 78 8055H 1E
8052H B5 8056H 01
8053H A5
OBSERVATION:
INPUT OUTPUT
ADDRES DATA ADDRESS DATA
S
8050H 8054H
8051H 8055H
8052H 8056H
8053H
AIM:
ALGORITHM:
RESULT:
Thus an ALP program for subtracting two 16-bit numbers was written and executed.
PROGRAM:
MNEMO OPER
ADDRESS OPCODE LABEL COMMENTS
NICS AND
8000 START MVI C, 00
Initialize C reg.
8001
8002 LHLD 8050H
8003 Load the subtrahend in DE reg.
8004 Pair through HL reg. pair.
8005 XCHG
8006 LHLD 8052H
Load the minuend in HL reg.
8007
Pair.
8008
Move the content of reg. L to
8009 MOV A, L
Acc.
Subtract the content of reg. E
800A SUB E
from that of acc.
Move the content of Acc. to
800B MOV L, A
reg. L
Move the content of reg. H to
800C MOV A, H
Acc.
Subtract content of reg. D with
800D SBB D
that of Acc.
Transfer content of acc. to reg.
800E MOV H, A
H
800F SHLD 8054H
Store the content of HL pair in
8010
memory location 8504H.
8011
8012 JNC NEXT
If there is borrow, go to the
8013
instruction labeled NEXT.
8014
8015 INR C Increment reg. C
NEXT Transfer the content of reg. C to
8016 MOV A, C
Acc.
8017 STA 8056H
Store the content of acc. to the
8018
memory location 8506H
8019
801A HLT Stop the program execution.
OBSERVATION:
INPUT OUTPUT
ADDRES DATA ADDRESS DATA
S
8050H 43 8054H C1
8051H 87 8055H 03
8052H 82 8056H 00
8053H 83
AIM:
ALGORITHM:
RESULT:
Thus the 16-bit multiplication was done in 8085p using repeated addition method.
PROGRAM:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
8050 A1 8054 56
8051 78 8055 1E
8052 B5 8056 01
8053 A5 8057 00
OBSERVATION:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
8050 8054
8051 8055
8052 8056
8053 8057
2(H). 16- BIT DIVISION
AIM:
To divide two 16-bit numbers and store the result in memory using 8085 mnemonics.
ALGORITHM:
RESULT:
Thus the 16-bit Division was done in 8085p using repeated subtraction method.
PROGRAM:
MNEM OPERA
ADDRESS OPCODE LABEL COMMENTS
ONICS ND
8000 START LHLD 8052
8001 Load the first No. in stack pointer
8002
through HL reg. pair
8003 XCHG
8004 LHLD 8050
8005 Load the second No. in HL reg.
pair
8006
& Exchange with DE reg. pair.
8007 LXI B, 0000H
8008
8009 Clear BC reg. pair.
800A LOOP MOV A, L Move the content of reg. L to Acc.
800B SUB E Subtract reg. E from that of Acc.
800C MOV L, A Move the content of Acc to L.
800D MOV A, H Move the content of reg. H Acc.
800E SBB D Subtract reg. D from that of Acc.
800F MOV H, A Move the content of Acc to H.
8010 INX B Increment reg. Pair BC
8011 JNC LOOP
If there is no carry, go to the location
8012
labeled LOOP.
8013
8014 DCX B Decrement BC reg. pair.
8015 DAD D Add content of HL and DE reg. pairs.
8016 SHLD 8054
Store the content of HL pair in 8054 &
8017
8055.
8018
8019 MOV A, C Move the content of reg. C to Acc.
801A STA 8056
Store the content of Acc. in memory
801B
8056
801C
801D MOV A, B Move the content of reg. B to Acc.
801E STA 8057
Store the content of Acc. in memory
801F
8057.
8020
8021 HLT Stop the program execution.
SAMPLE INPUT AND OUTPUT:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
8050 02 8054 01
8051 00 8055 00
8052 01 8056 80
8053 01 8057 00
OBSERVATION:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
8050 8054
8051 8055
8052 8056
8053 8057
Exp. No: 03 BLOCK OPERATIONS
AIM:
AIM:
ALGORITHM:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
8000 05 (no of inputs) 8000 00
8001 11 8001 00
8002 22 8002 00
8003 EE 8003 00
8004 FF 8004 00
8005 DD 8005 00
OBSERVATION:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
8000 (no of inputs) 8000 -
8001 8001
8002 8002
8003 8003
8004 8004
8005 8005
AIM:
ALGORITHM:
RESULT:
Thus the contents of a block of memory have been moved to another place.
PROGRAM:
INPUTS OUTPUTS
INPUTS OUTPUTS
AIM:
ALGORITHM:
RESULT:
Thus the contents of block of memory have been copied to another place.
PROGRAM:
INPUTS OUTPUTS
ADDRES ADDRES ADDRES ADDRES
DATA DATA DATA DATA
S S S S
9000 05 8060 05
9001 1A 8061 A1 9001 1A 8061 1A
9002 2A 8062 A2 9002 2A 8062 2A
9003 3A 8063 A3 9003 3A 8063 3A
9004 4A 8064 A4 9004 4A 8064 4A
9005 5A 8064 A5 9005 5A 8065 5A
OBSERVATION:
INPUTS OUTPUTS
ADDRES ADDRES ADDRES ADDRES
DATA DATA DATA DATA
S S S S
9000 8060
9001 8061 9001 8061
9002 8062 9002 8062
9003 8063 9003 8063
9004 8064 9004 8064
9005 8064 9005 8065
3 (C). BLOCK COMPARE
AIM:
ALGORITHM:
RESULT:
INPUTS OUTPUTS
ADDRESS DATA ADDRESS DATA ADDRESS DATA
8000 05 8200 05 8001 -
8001 AA 8201 AA 8002 00
8002 1A 8202 12 8003 FF
8003 BB 8203 BB 8004 00
8004 C2 8204 C2 8005 00
8005 2C 8205 35 8006 FF
OBSERVATION:
INPUTS OUTPUTS
ADDRESS DATA ADDRESS DATA ADDRESS DATA
8000 8200 8001 -
8001 8201 8002
8002 8202 8003
8003 8203 8004
8004 8204 8005
8005 8205 8006
3 (D). BLOCK INTERCHANGE
AIM:
ALGORITHM:
RESULT:
INPUTS OUTPUTS
ADDRES ADDRES ADDRES ADDRES
DATA DATA DATA DATA
S S S S
8000 05 8500 05
8001 1A 8501 A1 8001 A1 8501 1A
8002 2A 8502 A2 8002 A2 8502 2A
8003 3A 8503 A3 8003 A3 8503 3A
8004 4A 8504 A4 8004 A4 8504 4A
8005 5A 8505 A5 8005 A5 8505 5A
OBSERVATION:
INPUTS OUTPUTS
ADDRES ADDRES ADDRES ADDRES
DATA DATA DATA DATA
S S S S
8000 8500
8001 8501 8001 8501
8002 8502 8002 8502
8003 8503 8003 8503
8004 8504 8004 8504
8005 8505 8005 8505
3 (D). BLOCK INSERT
AIM:
ALGORITHM:
RESULT:
OBSERVATION:
INPUTS OUTPUTS
ADDRES ADDRES ADDRES ADDRES
DATA DATA DATA DATA
S S S S
8000 8500
8001 8501 8001 8501
8002 8502 8002 8502
8003 8503 8003 8503
8004 8504 8004 8504
8005 8505 8005 8505
6(A). LARGEST ELEMENT IN AN ARRAY
AIM:
To find the largest element in an array.
ALGORITHM:
1. Place all the elements of an array in the consecutive memory locations.
2. Fetch the first element from the memory location and load it in the accumulator.
3. Initialize a counter (register) with the total number of elements in an array.
4. Decrement the counter by 1.
5. Increment the memory pointer to point to the next element.
6. Compare the accumulator content with the memory content (next
element).
7. If the accumulator content is smaller, then move the memory content
(largest element) to the accumulator. Else continue.
8. Decrement the counter by 1.
9. Repeat steps 5 to 8 until the counter reaches zero
10. Store the result (accumulator content) in the specified memory location.
RESULT:
Thus the largest number in the given array is found out.
PROGRAM:
OBSERVATION:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
8100 8105
8101
8102
8103
8104
6(B). SMALLEST ELEMENT IN AN ARRAY
AIM:
To find the smallest element in an array.
ALGORITHM:
1. Place all the elements of an array in the consecutive memory locations.
2. Fetch the first element from the memory location and load it in the accumulator.
3. Initialize a counter (register) with the total number of elements in an array.
4. Decrement the counter by 1.
5. Increment the memory pointer to point to the next element.
6. Compare the accumulator content with the memory content (next
element).
7. If the accumulator content is smaller, then move the memory content
(largest element) to the accumulator. Else continue.
8. Decrement the counter by 1.
9. Repeat steps 5 to 8 until the counter reaches zero
10. Store the result (accumulator content) in the specified memory location.
RESULT:
Thus the smallest number in the given array is found out.
PROGRAM:
OBSERVATION:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
8100 8105
8101
8102
8103
8104
7(A).ASCENDING ORDER
AIM:
To sort the given number in the ascending order using 8085 microprocessor.
ALGORITHM:
RESULT:
Thus the ascending order program is executed and thus the numbers are arranged in
ascending order.
PROGRAM:
OBSERVATION:
INPUT OUTPUT
MEMORY DATA MEMORY DATA
LOCATION LOCATION
8100 8100
8101 8101
8102 8102
8103 8103
8104 8104
7(B). DESCENDING ORDER
AIM:
To sort the given number in the descending order using 8085 microprocessor.
ALGORITHM:
RESULT:
Thus the descending order program is executed and thus the numbers are arranged in
descending order.
PROGRAM:
OBSERVATION:
INPUT OUTPUT
MEMORY DATA MEMORY DATA
LOCATION LOCATION
8100 8100
8101 8101
8102 8102
8103 8103
8104 8104
8(A). CODE CONVERSION –DECIMAL TO HEX
AIM:
ALGORITHM:
RESULT:
Thus an ALP program for conversion of decimal to hexadecimal was written and
executed.
PROGRAM:
RESULT:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
8100 8101
8(B). CODE CONVERSION –HEXADECIMAL TO DECIMAL
AIM:
ALGORITHM:
RESULT:
Thus an ALP program for conversion of hexadecimal to decimal was written and
executed.
PROGRAM:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
8100 8101
8102
INTRODUCTION:
The keyboard segment can be connected to a 64-contact key matrix. Keyboard entries are
debounced and stored in the internal FIFO memory; an interrupt signal is generated with each
entry.
The display segment can be provide a sixteen character scanned display interface with
such device as LED’s. This segment has 16/8 R/W memory (RAM), which can be used to
read/write information for display purposes. The display can be set up in either right-entry of
left-entry format.
KEYBOARD SECTION:
This section has 8 lines (RL0-RL7) that can be connected to eight columns of a keyboard,
plus two additional lines: Shift and CNTL/STB (Control/Strobe). The keys are automatically
debounced and the keyboard can operate in 2 modes: Two Key Lockout or N-key rollover.
In the two-key lockout mode, if two keys are pressed almost simultaneously, only the
first key is recognized. In the N-key roll-over mode, simultaneous keys are recognized and
their codes are stored in the internal buffer; it can also be set up so that no key is recognized
until only one key remains pressed.
The keyboard section also includes an 8*8 FIFO RAM. The FIFO RAM consists of eight
registers that can store and keyboard entries; each is then read in the order of entries. The
status logic keeps track of the number of entries and provides an IRQ signal when the FIFO is
not empty.
SCAN SECTION:
Page No:
DISPLAY SECTION:
A0-A3
B0-B3
These lines can be used, either as a group of eight lines or as two groups of four, in
conjunction with the scan lines for a multiplexed display. The display can be blanked by using
the BD line. This section includes 16*8 displays RAM. The microprocessor can read from or
write into any of these registers.
This section includes 8-bit directional data lines (DB0-DB7), one interrupt request line
(IRQ), and 6 lines for interfacing, including the buffer address line (A0). When A0 is high,
signals are interrupted as data. The IRQ line goes high whenever data entries are stored in the
FIFO. This signal is used to interrupt the microprocessor to indicate the availability of data.
KEYBOARD:
The keyboard in this design is an input port with keys assigned in the matrix format.
When a key is pressed, the keyboard routine should provide a binary equivalent of the key.
This can be accomplished in obvious ways.
One of the software approaches, where by a key closer is sensed, debound and identified and
the key code is obtained by using the software.
The other is the hardware approach, whereby all these key functions are performed through a
programmable keyboard encoder.
8279 is the keyboard interface controller. Location is 010. The keys are divided into 2 groups.
The I/O control section controls the flow of data to/from the 8279. The data buffers
interface the external bus of the system with internal bus of 8279. Architecture and Signal
Descriptions of 8279
The I/O section is enabled only if CS is low. The pins A0, RD and WR select the
command, status or data read/write operations carried out by the CPU with 8279.
The scan counter has two modes to scan the key matrix and refresh the display. In the
encoded mode, the counter provides binary count that is to be externally decoded to provide
the scan lines for keyboard and display (Four externally decoded scan lines may drive upto 16
displays). In the decode scan mode, the counter internally decodes the least significant 2 bits
and provides a decoded 1 out of 4 scan on SL0-SL3( Four internally decoded scan lines may
drive upto 4 displays). The keyboard and display both are in the same mode at a time.
This section for a key closure row wise. If a key closer is detected, the keyboard
debounce unit debounces the key entry (i.e. wait for 10 ms). After the debounce period, if the
key continues to be detected. The code of key is directly transferred to the sensor RAM along
with SHIFT and CONTROL key status.
In keyboard or strobed input mode, this block acts as 8-byte first-in-firstout (FIFO)
RAM. Each key code of the pressed key is entered in the order of the entry and in the mean
time read by the CPU, till the RAM become empty. The status logic generates an interrupt
after each FIFO read operation till the FIFO is empty. In scanned sensor matrix mode, this unit
acts as sensor RAM. Each row of the sensor RAM is loaded with the status of the
corresponding row of sensors in the matrix. If a sensor changes its state, the IRQ line goes
high to interrupt the CPU.
The display address register holds the address of the word currently being written or
read by the CPU to or from the display RAM. The contents of the registers are automatically
updated by 8279 to accept the next data entry by CPU.
SIGNALS:
DB0-DB7 :
These are bidirectional data bus lines. The data and command words to and from the
CPU are transferred on these lines.
CLK :
This pin is used to reset 8279. A high on this line reset 8279. After resetting 8279, its in
sixteen 8-bit display, left entry encoded scan, 2-key lock out mode. The clock prescaler is set
to 31.
Page No:
CS : Chip Select
A low on this line enables 8279 for normal read or write operations. Otherwise, this pin
should remain high.
A0 :
A high on this line indicates the transfer of a command or status information. A low on
this line indicates the transfer of data. This is used to select one of the internal registers of
8279.
RD, WR :
These input pins enable the data buffers to receive or send data over the data bus.
IRQ :
This interrupt output lines goes high when there is a data in the FIFO sensor RAM.
The interrupt lines goes low with each FIFO RAM read operation but if the FIFO RAM
further contains any key-code entry to be read by the CPU, this pin again goes high to
generate an interrupt to the CPU.
Vss, Vcc :
These are the ground and power supply lines for the circuit.
SL0-SL3-Scan Lines :
These lines are used to scan the key board matrix and display digits. These lines can
be programmed as encoded or decoded, using the mode control register.
These are the input lines which are connected to one terminal of keys, while the other
terminal of the keys are connected to the decoded scan lines. These are normally high, but
pulled low when a key is pressed.
SHIFT :
The status of the shift input lines is stored along with each key code in FIFO, in
scanned keyboard mode. It is pulled up internally to keep it high, till it is pulled low with a key
closure.
BD – Blank Display :
This output pin is used to blank the display during digit switching or by a blanking
Page No:
In keyboard mode, this lines is used as a control input and stored in FIFO on a key
closure. The line is a strobed lines that enters the data into FIFO RAM, in strobed input mode.
It has an interrupt pull up. The lines is pulled down with a key closer.
KEYS:
I. RES : The RES key allows you to terminate any present activity and to
return your “Micro-85EB” to an initiated state. When pressed the µ85 sign-
on message operates in the display for few seconds and monitors will display
command promt “_” in the left most digit.
II. INT : Maskable interrupt connected to CPU’s RST 7.5, RST 6.5, RST 5.5.
III. DEC : Decrement the address by one and display its content ordisplay the previous
register content.
IV. EXEC : Execute particular program after selecting the address through GO command.
V. NEXT : Increment address by one and display its content or display the next register
contents.
VI. SUB : Substitute memory content SUB key used for starting address to the program.
Page No:
There are totally 21 keys on keyboard. !6 keys are Hex keys and 5 function keys.
The 8279 is a complex device that can accept, 8 different commands to perform
various functions. The initialization commands can specify:
Thus the various parts of 8279 Programmable Keyboard/Display Interface has been studied.
Page No:
AIM:
INTRODUCTION:
The 8251 is a programmable chip designed for synchronous and asynchronous serial
data communication packaged in a 28 pin DIP ( Dual Inline Package).
The 8251 is the enhanced version of its predecesion, the 8051 and its compatible with
the 8251. The block diagram of 8251 A includes Read/Write control logic. Transmitter,
Receiver, Database buffer and MODEM control.
The control logic interfaces the chip with the microprocessor. Determines the
functions of the chip according to the control word in its register and monitors the data flow.
The transmitter section converts a parallel word received from the microprocessor into serial
bits and transmits them over the Txp line to a peripheral.
The receiver sections receive serial bits from a peripheral converts them into a parallel
word and transfers the word to the microprocessor. The modern control is used to establish
data communication through modems over telephone lines.
This section includes R/W control logic, six input signal control logic and three
buffer registers: data register, control register and status register, The input signals to the
control logic are as follows.
INPUT SIGNALS:
___
CS – Chip Select:
When the signal goes low, the 8251 A is selected by the microprocessor for
communication. This is usually connected to a decoded address bus.
_
C/D – Control / Data:
___ When this signal is high, the control register and the status register are differentiated by
WR and RD signals, respectively.
___
WR – WRITE:
When this signal goes low, the microprocessor either writes in the control register or
sends output to the data buffer. This is connected to IOW or MEMW.
Page No:
___
RD _ READ:
When this signal goes low, the microprocessor either reads a status from the status
register can accept (inputs) data from the data buffer. This is connected to either IOR or
MEMB.
RESET – Reset:
A high on this input reset the 8251 A and forces it into the idle node.
CLK – Clock:
This is the clock input, usually connected to the system clock. This clock does not
control either the transmission on the reception rate - the clock is necessary for communication
with microprocessor.
CONTROL REGISTER:
This is 16 bit register for a control word consists of two independent bytes. The first
byte called the “mode instruction” (word) and the second byte is called “command
instruction”. This register can be accessed as an output port when the C/D pin is high.
STATUS REGISTER:
This input register checks the ready status of a peripheral. This register is addressed as
an input part. When the C/D pin is high. It has same part address as the control registers.
This 3-state bidirectional, 8-bit buffer is used to interface the 8251A to the system data
bus. Data is transmitted or received by the buffer upon execution of input or output
instructions of the CPU. Control works, command words and status information are also
transferred through the data bus buffer. The command status, Data-in and data-out registers
are separate, 8-bit registers communicating with the system bus through the Data Bus Buffer.
This functional block accepts inputs from the system Control bus and generates control
signals for overall device operation. It contains the Control Word Register and Command
Word Register that store the various control formats for the device functional definition.
MODEM CONTROL:
The 8251A has a set of control inputs and outputs that can be used to simplify the
interface to almost any modem. The modem control signals are general purpose in nature and
can be used for functions other than modem control if necessary.
____
DSR (Data Set Ready):
____
The DSR input signal is a general-purpose, 1-bit inverting input port. Its condition can
be tested by the CPU using a Status Read operation. The DSR input is normally used to test
modem conditions such as Data Set Ready.
Page No:
____
DTR (Data Terminal Ready) :
___
The DTR output signal is a general-purpose, 1-bit inverting output port. I t can be set
“low” by programming the appropriate bit in the Command Instruction word. The DTR output
signal is normally used for modem control such as Data Terminal Ready.
___
RTS (Request to Send) :
The RTS output signal is a general-purpose, 1-bit inverting output port. It can be set
“low” by programming the appropriate bit in the Command Instruction word. The RTS output
signal is normally used for modem control such as Request To Send..
____
CTS (Clear to Send) :
A “low” on this input enables the 8251A to transmit serial data if the Tx Enable bit n
the command byte is set to a “one”. If either a Tx Enable off or CTS off condition occurs
while the Tx is in operation, the Tx will transmit all the data in the Usart, written prior to Tx
Disable command before shutting down.
TRANSMITTER SECTION
The transmitter accepts parallel data from the microprocessor and converts them into
serial data. It has two registers a buffer to hold eight bits and a output register to convert eight
bits into a stream of serial bit.
The microprocessor writes a bytes in the buffer registers. This section transmits data on
the TxD with the approvable froming bits (start and stop). Three output signals and one input
signal are associated with the transmitter section.
This input signal controls the rate at which bits are transmitted by the USART. The
clock frequency can be 16 or 64 times the board.
This is an output signal, it is high, it indicates that buffer registers is empty and the
USART is ready to accept a byte. It can be used either to interrupt the microprocessor or to
indicate the status. This signal is reset when a data byte is loaded into the buffer.
This is an output signal. On this line indicates that the output registers is empty. This
signal is reset when a byte is transferred from the buffer to the output register.
Page No:
RECEIVER SECTION:
The receiver accepts the serial data on the RxD line from a peripheral and converts
them into parallel data. This section has two registers and the buffer registers.
When the RxD lines goes low, the control logic assumes it is a start bit, waits for half a
bit time and samples the line again. If the line is still low, the input register accepts the
following bits, forms a character and loads it into the buffer register.
This is a clock signal that controls the rate of which bits are received by the USART. In
the asynchronous mode, the clock can be set to 1, 16 or 64 times are based.
This is an output signal. It goes high when the USART has a character in the buffer
register and is ready to the microprocessor. This line can be used either to indicate the status or
the interrupt in the microprocessor.
To implement serial communication, the MPU must inform the 8251A of all details, such
as mode, baud, Stop bits, parity, etc. Therefore, prior to data transfer, a set of control words
must be loaded into the 16-bit control register of the 8251A. In addition, the MPU must check
the readiness of a peripheral by reading the status register. The control words are divided into
two formats: mode words and command words. The mode word specifies the general
characteristics of operation, the command word enables data transmission and/or reception, and
the status word provides the information concerning register status and transmission errors.
To initialize the 8251A in the asynchronous mode, a certain sequence of control words
must be followed. After a Reset operation, a mode word must be written in the control register
followed by a command word. Any control word written into the control register immediately
after a mode word will be interpreted as a command word; that means a command word can be
changed anytime during the operation. However, the 8251A should be reset prior to writing a
new mode word, and it can be reset by using the Internal Reset bit (D6) in the command word.
Page No:
RESULT:
Thus the entire structure of 8251A- Programmable Communication Interface has been studied.
PIN DIAGRAM
D2 D1
D3 D0
RxD Vcc
GND RxC
D4
I DTR
C
D5 RTS
8
D6 DSR
2
D7 5 RESET
1
TxC CLK
A
WR TxD
CS Tx EMPTY
CD CTS
RD SYDET/BD
RxRDy TxRDY
Page No:
STUDY OF 8253 PROGRAMMABLE INTERVAL TIMER
AIM:
INTRODUCTION:
The 8253 includes three identical 16-bit counter that can be operate independently in
any one of the six modes. It is packaged in a 24-pin DIP and required a single +5V power
supply. To operate a counter, a 16-bit count is loaded in its register and, on command, begins
to decrement the count until it reaches 0. At the end of the count, it generates a pulse that can
be used to interrupt the MPU. The counter can count either in binary or BCD. In addition, a
count can be read by the MPU while the counter is decrementing.
PIN DESCRIPTION:
D7 – D0 :
Bi-directional three state data bus lines, connected to system data bus.
CLK 0 :
Clock input of Counter 0
OUT 0 :
Output of Counter 0.
GATE 0:
Gate input of Counter 0.
GND :
Power supply connection.
VCC :
A 5V power supply connection.
___
WR :
This input is low during CPU write operations.
___
RD :
This input is low during CPU read operations.
__
CS : __ ___
Page No:
A1, A0 :
Used to select one of the three Counters or the Control Word Register for read
or write operations. Normally connected to the system address bus.
A1 A0 Selects
0 0 Counter 0
0 1 Counter 1
1 0 Counter 2
1 1 Control Word Register
CLK 2 :
Clock input of Counter 2.
OUT 2 :
Output of Counter 2.
GATE 2 :
Gate input of Counter 2.
CLK 1 :
Clock input of Counter 1.
GATE 1 :
Gate input of Counter 1.
OUT 1:
Output of Counter 1.
ARCHITECTURE OF 8253:
This 3-state, bi-directional, 8-bit buffer is used to interface the 8253 to the system bus,
Block Diagram Showing Data Bus Buffer and Read/Write Logic Functions.
READ/WRITE LOGIC :
The Read/Write Logic accepts inputs from the system bus and generates control signals
for the other functional blocks of the 8253. A1 and A0 select one of the three counters or the
Control Word Register to be read from/written into.
A ``low'' on the RD input tells the 8253 that the CPU is reading one of the counters.
A ``low'' on the WR input tells the 8253 that the CPU is writing either a Control Word
or an initial count. Both RD and WR are qualified by CS; RD and WR are ignored
unless the 8253 has been selected by holding CS low.
Control Word Register and is interpreted as a Control Word used to define the operation of
the Counters. The Control Word Register can only be written to; status information is
available with the Read-Back Command.
The Counters are fully independent. Each Counter may operate in a different Mode.
The Control Word Register is shown in the figure; it is not part of the Counter itself, but
its contents determine how the Counter operates.The status register, contains the current
contents of the Control Word Register and status of the output and null count flag.
Both are normally referred to as one unit and called just OL. These latches normally
``follow'‘ the CE, but if a suitable Counter Latch Command is sent to the 8253, the latches
``latch'' the present count until read by the CPU and then return to ``following'' the CE.
One latch at a time is enabled by the counter's Control Logic to drive the internal bus.
This is how the 16-bit Counter communicates over the 8-bit internal bus. Note that the CE
itself cannot be read; whenever you read the count, it is the OL that is being read.
Similarly, there are two 8-bit registers called CRM and CRL (for ``Count Register'').
Both are normally referred to as one unit and called just CR.
When a new count is written to the Counter, the count is stored in the CR and later
transferred to the CE. The Control Logic allows one register at a time to be loaded from the
internal bus. Both bytes are transferred to the CE simultaneously.
CRM and CRL are cleared when the Counter is programmed. In this way, if the
Counter has been programmed for one byte counts (either most significant byte only or least
significant byte only) the other byte will be zero.
Note that the CE cannot be written into, whenever a count is written, it is written into
the CR.
Counters are programmed by writing a Control Word and then an initial count.
The Control Words are written into the Control Word Register, which is selected when
A1,A0 = 11. The Control Word itself specifies which Counter is being programmed.
A1,A0 = 11, CS = 0, RD = 1, WR = 0.
By contrast, initial counts are written into the Counters, not the Control Word Register. The
A1,A0 inputs are used to select the Counter to be written into. The format of the initial count
is determined by the Control Word used.
Page No:
Write Operations:
The programming procedure for the 8253 is very flexible. Only two conventions
need to be remembered:
1) For each Counter, the Control Word must be written before the initial count is written.
2) The initial count must follow the count format specified in the Control Word (least
significant byte only, most significant byte only, or least significant byte and then
most significant byte).
Since the Control Word Register and the three Counters have separate addresses
(selected by the A1,A0 inputs), and each Control Word specifies the Counter it applies to
(SC0,SC1 bits), no special instruction sequence is required.
A new initial count may be written to a Counter at any time without affecting the
Counter's programmed Mode in any way. Counting will be affected as described in the
Mode definitions. The new count must follow the programmed count format.
Read Operations:
It is often desirable to read the value of a Counter without disturbing the count in
progress. This is easily done in the 8253.
• There are three possible methods for reading the counters:
a simple read operation, the Counter Latch Command, and the Read-Back Command.
• Each is explained below. The first method is to perform a simple read operation. To
read the Counter, which is selected with the A1, A0 inputs, the CLK input of the
selected Counter must be inhibited by using either the GATE input or external logic.
• Otherwise, the count may be in the process of changing when it is read, giving an
undefined result.
• The second method uses the ``Counter Latch Command''. Like a Control Word, this
command is written to the Control Word Register, which is selected when A1,A0 =
11. Also like a Control Word, the SC0, SC1 bits select one of the three Counters, but
two other bits, D5 and D4, distinguish this command from a Control Word.
• The selected Counter's output latch (OL) latches the count at the time the Counter Latch
Command is received. This count is held in the latch until it is read by the CPU (or
until the Counter is reprogrammed).
• The count is then unlatched automatically and the OL returns to ``following'' the
counting element (CE).
• This allows reading the contents of the Counters ``on the fly'' without affecting counting
in progress.
• Multiple Counter Latch Commands may be used to latch more than one Counter. Each
Page No:
• Counter Latch Commands do not affect the programmed Mode of the Counter in any
way.
• If a Counter is latched and then, some time later, latched again before the count is read,
the second Counter Latch Command is ignored. The count read will be the count at
the time the first Counter Latch Command was issued.
• With either method, the count must be read according to the programmed format;
specifically, if the Counter is programmed for two byte counts, two bytes must be read.
The two bytes do not have to be read one right after the other, read or write or
programming operations of other Counters may be inserted between them.
• Another feature of the 8253 is that reads and writes of the same Counter may be
interleaved.
• Read-back command: The third method uses the Read-Back Command. This command
allows the user to check the count value, programmed Mode, and current states of the
OUT pin and Null Count flag of the selected counter (s).
• The command is written into the Control Word Register. The command applies to the
counters selected by setting their corresponding bits D3, D2, D1 = 1.
• The read-back command may be used to latch multiple counter output latches (OL) by
setting the COUNT bit D5 = 0 and selecting the desired counter (s). This single
command is functionally equivalent to several counter latch commands, one for each
counter latched.
• Each counter's latched count is held until it is read (or the counter is reprogrammed).
• The counter is automatically unlatched when read, but other counters remain latched until
they are read. If multiple count read-back commands are issued to the same counter
without reading the count, all but the first are ignored; i.e., the count which will be read
is the count at the time the first read-back command was issued.
• The read-back command may also be used to latch status information of selected counter
(s) by setting STATUS bit D4 = 0. Status must be latched to be read; status of a counter
is accessed by a read from that counter.
• Bits D5 through D0 contain the counter's programmed Mode exactly as written in the last
Mode Control Word. OUTPUT bit D7 contains the current state of the OUT pin.
• This allows the user to monitor the counter's output via software, possibly eliminating
some hardware from a system. NULL COUNT bit D6 indicates when the last count
written to the counter register (CR) has been loaded into the counting element (CE).
• The exact time this happens depends on the Mode of the counter and is described in the
Mode Definitions, but until the count is loaded into the counting element (CE), it can't
be read from the counter.
AIM:
To write a program to perform the operation of a stepper motor using interface.
EQUIPMENTS REQUIRED:
1. 8085 microprocessor kit
2. Stepper motor interfacing.
ALGORITHM:
(i) Load HL pair and move 20 to C register.
(ii) Call the subroutine rotate.
(iii) Decrement the C register, check if C is zero. If it is not go to the loop.
(iv) Call the subroutine for stop.
(v) Step 1-4 is forward motion and repeat the step 1-4 for reverse rotation.
(vi) Jump to step1.
STEPPER MOTOR
RESULT:
Thus the stepper motor was rotated in forward and reverse direction.