G.H.RAISONI COLLEGE OF ENGINEERING,NAGPUR Department:-Electronics & Communication Engineering Branch:-5th Semester[Electronics & Telecommunication]
Subject:-Microprocessor and Interfacing
List of Experiments
CYCLE-I
1. Study of up 8085 and perform Addition of two 16-bit/32bit numbers.
2. Transfer the data block from one memory location to other. 3. Find the greatest/smallest number. 4. Find the even, odd and zero number.
5. Arrange the data block in the ascending /descending order.
6. Addition of 10 BCD numbers.
CYCLE-II
7. To study the 8 bit Multiplications. 8. To study the 8255 and transfer the Data block on the I/O ports.
9. To generate the square wave of period 1sec on sod pin.
10. To convert Hexadecimal number into its ASCII equivalent.
11. To interface DAC with up8085.
12. To interface ADC with up8085.
Experiment No-01 Aim: (a) Study of up 8085 and perform Addition of two 16-bit/32bit
numbers. Apparatus: Microprocessor (8085) Kit
Power supply Keyboard.
Theory: Architecture Of Microprocessor(8085):
Block Diagram Description- The microprocessor include the ALU, Timing and control unit Accumulator, Instruction Register, and Decoder, register Array, Interrupt control serial I/O control and stack pointer.
1) The Arithmetic and Logical unit(ALU) – The ALU perform the function it include the accumulator, the transforming register and arithmetic and logical circuit. And the different flags that the temporary register are used to load the data during and the arithmetic and logical operations and result is stored in the accumulator and the flags are the set ands reset according to the result of the operations. 2) Accumulator:- The accumulator is an the 8 bit register that is the part of the arithmetic and the logical unit(ALU) This register is used to stored the 8bit data and perform the arithmetic and the operation and the logical operations. the result of an the operations is stored in the accumulator the accumulator is also identical as the register A. 3) Temporary Register(TR)- The Register W and the Z are the Temporary .each are the 8 bit register having the 8 bit flip-flop. These register cannot be used by the programmer These are the used only by the microprocessor for the temporary storage of the perennial data .These register are thus called as the temporary Registers. 4) Flag Register:- The Flag are affected by the arithmetic and the logical operations in the ALU. The Flag register is an the 8 bit register having the 8 flip flop. The five bit positions out of 8 are used to stored the output of the five flip-flop. The flag are stored the 8 bit register in that the programmer can examine the flag by the accessing the register through an the interactions of the five status flag are. a)Carry Flag(CF)- If in the arithmetic operation the result in the carry then the carry flag is set other wise it is an reset in mode. It also carry they barrow form the subtraction . b)Auxiliary Carry Flag(AC)- In the AC flag an the BCD operation when the carry is generate by the digit D3 and pass on the D4 the AC flag is set. c)Parity Flag(PF)- In the parity flag after an the arithmetic and the logical operations if the result is an even number of the 1’s the flag is set and the or it is e reset if the number of the 1’s is odd . d)Zero Flag(ZF)- The zero flag is set if the ALU operations result in the zero and the flag is reset if the result is not zero. e) Sign Flag(SF)- After the execution of an the arithmetic or the logical operations if the bit D7 is the result calculating the accumulator is 1.The sign flag is set. This flag is the used with
the signed number as well as the number will then be viewed as a negative number if it is 0,then the number will be the considerer positive. Temporary register is used to hold the data during the arithmetic and the logical operations .The various arithmetic operations are performed are- 1) Additions and the substations of the binary number. 2) Additions of the BCD. 3) Increment and the Decrement of the binary number. 4) Comparison of the two 8 bit number.
The logical operation perform by the ALU are- 1) ANDing, ORing, X-ORing Inverting of the 8 bit number 2) Rotating the 8 bit data.- As ALU is 8 bit data in the microprocessor8085.it can perform the arithmetic and the logical operations of the 8-bit number.
General Purpose Register:-
The 8085 has the six general purpose register to perform the twist operation to stored the 8 bit data during the program executions These register are the identified the B,C,D,E,H,L. They can be combined as the register pair BC, DE, HL to perform the some 16 bit operations These register are the programmable i.e. the programmer can be used then the load or the copy data from the register by using the instructions.
Program Counter(PC)- This is the 16 bit register deals with the sequencing of the excitations of the instructions it is the function is to point to the memory address from the which is the next byte is to be the fetched. When a byte is being fetched then the program counter is incremented by the one to point to the next memory locations.
Stack Pointer(SP)- This is also the 16 bit register used as memory pointer initially it will be the called stack pointer register .It point to the memory location to the read write memory called the stack. The beginning of the stack is defined by the loading a 16 bit address in the stack pointer.
Timing and Control Unit- This unit of the microprocessor 8085 are the microprocessor operations with the clock and the generate the control signal necessary for the communications between the microprocessor and the peripheral The timing and the control unit is the 256 different control with the each circuit will be generate the different control signal which are the required the excited one instructions completely.
Instruction Register and the Instruction Decoder- The Instruction register is the 8 bit register having the 8F/F so that it can stored the 8 bit data. This 8 bit number is the applied to the input of the instruction decoder as the input to the decoder is the 8 number of the output will becomes the 256.Each output of the instructions decoder the ID is the connected to the 1 timing and the control
signal which is the required to that the execute the instruction completely. in this way when an the 8 bit number is stored in to the I then the applied the ID and the alone corresponding output of the ID become active. so one of the corresponding timing and the control unit is executes.
Pin Configration Of Microprocessor (8085):
Sample Program :
Aim: (b) Addition of two 16-bit/32bit numbers. Problem : 1. Write a program to perform addition of A95CH and A333H. Store the result in B-C- D registers. 2. Write a program to perform the addition of two 32-bit numbers which are present in memory location from address C900H and C904H. Store the result at F000H. Program:
Instruction Memory Location Mnemonic Operand
Opcode Comment
C000H C001H C002H
Logic: 16-bit addition:
1. Take the 16-bit no. directly given with the problem. 2. Perform addition of these two numbers using ADD instruction. 3. Store the result in corresponding registers.
32-bit addition: 1. Take the numbers from memory in registers. 2. Using memory related instructions, perform addition. 3. Store the result in corresponding given memory location.
Result: Viva Questions:
1. What is the function of ALU? 2. What is the function of instruction register? 3. What is the function of interrupt control unit? 4. What is the function of serial input output control? 5. What is the function of increment and decrement register? 6. What is the function of accumulator? 7. What is the function of stack pointer? 8. What is the function of program counter? 9. What is the function of flag register? 10. Explain the term ROM? 11. Explain the term R/WR? 12. What is the nibble? 13. What is an instruction? 14. What is Mnemonic?
Experiment No-02 Aim: Transfer the 10 bytes of bank1 to bank2. Problem: Write a program to transfer 10 bytes from memory bank1 to memory bank2. The starting address of bank1 and bank2 are F000H and C500H.. Program:
Instruction Memory Location Mnemonic Operand
Opcode Comment
C000H C001H C002H
Logic:
1. Initialize counter of 10 bytes. 2. Take the data of 1st location of bank1 in accumulator and transfer it to the 1st
location of bank2. 3. Repeat the same procedure for other numbers till counter become to zero.
Result: Viva Questions:
1. What is the function of instruction decoder unit? 2. What is the function of timing and control unit? 3. What is the function of temporary register? 4. What is the function of address buffer? 5. What is the function of data buffer?
Experiment No-03 Aim: Find the smallest number. Problem Statement: A block of 10 bytes is present in memory from address A000H. Find the smallest byte and store it at A090H. Program:
Instruction Memory Location Mnemonic Operand
Opcode Comment
C000H C001H C002H
Logic:
1. Initialize counter of 10 bytes. 2. Using CMP instruction compare the data of 1st and 2nd location. 3. Keep on comparing the other numbers and find the smallest number. Store it in
accumulator and at A090H. Result: Viva Questions:
1. Explain the term LSI? 2. How many bytes make a word of 32 bit? 3. What is difference between machine language and the assembly language of
the microprocessor? 4. What is an assembler? 5. Explain the term BUS?
Experiment No-04
Aim: Find the even, odd and zero number. Problem: A block of 10 byte is present in memory from address E980H. Find the even, odd and zero numbers and store them at F000H and F900H Program:
Instruction Memory Location Mnemonic Operand
Opcode Comment
C000H C001H C002H
Logic:
1. Take the first data of memory location in accumulator. 2. Use Rotate instruction RRC ie rotate right without carry. 3. Check the carry flag. If CF=1, the number is even and if CF=0, the number is odd
and check zero flag, if it is 1 that means the number is zero. 4. Store the result in corresponding memory locations.
Result: Viva Questions:
1. What is program? 2. What is a complier? 3. Why data bus is bi-directional? 4. Specifies the function of address bus and the direction of address bus? 5. How many memory location can be addressed by a microprocessor with the
14 address lines?
Experiment No-05 Aim: Arrange the data block in the ascending /descending order. Problem : A block of 10 bytes is present in memory from address D000H. Arrange these 10 bytes in ascending (increasing) order from address E000H. Program:
Instruction Memory Location Mnemonic Operand
Opcode Comment
C000H C001H C002H
Logic: The program can be divided into two parts.
1. Main program: It will be used to arrange the data from E000H to E009H. 2. Subprogram: It will be used to find the smallest byte in the data block from
F000H to F009H. The smallest byte should be stored in accumulator and address of the corresponding memory location should be stored in register pair DE.
Result: Viva Questions:
1. What are the different addressing mode? 2. What is the immediate addressing mode? 3. What is the register direct addressing mode? 4. What is the direct addressing mode? 5. What is the register indifferent addressing mode?
Experiment No-06 Aim: Addition of 10 BCD numbers. Problem Statement: A block of 10 BCD bytes is present in memory from address D000H. Add all these BCD bytes and store 16-bit BCD result into memory after the end of this data block. Program:
Instruction Memory Location Mnemonic Operand
Opcode Comment
C000H C001H C002H
Logic:
1. Initialize the block of 10 bytes in memory from address D000H and also initialize counter.
2. Using ADD instruction, add the accumulator data and memory data. Using DAA instruction adjust accumulator data.
3. Store the 16-bit BCD result into two memory locations after the end of data blocks.
Result: Viva Questions:
1. What is a microprocessor? 2. What is the difference between microprocessor and cpu? 3. What is difference between microprocessor and microcomputer? 4. Explain the term SSI? 5. Explain the term MSI?
Experiment No-07 Aim: To study the 8 bit Multiplications. Problem : Write a program to perform multiplication of 8-bit binary no. 25H and 37H. Store 16-bit result into memory from address F998H. Program:
Instruction Memory Location Mnemonic Operand
Opcode Comment
C000H C001H C002H
Logic: In up 8085, multiplication is perform by using repetitive addition.
25H * 37H = 25H + 25H + 25H + 25H +……….+ 37H times.
Result: Viva Questions:
1. What is the implicit addressing mode? 2. How many address line present in microprocessor? 3. How many data line present in microprocessor? 4. How many control line present in microprocessor? 5. How microprocessor fetch the instruction?
Experiment No. 8 Aim : To study the architecture of 8255 PPI and to glow the alternate LEDS of port B. Interfacing Diagram :
Up 8085
IC 8255
A15
A1
A0 A0
A1
CS
RESET
RD
WR
MEMR
RESET OUT
MEMW
PA0-PA7
PC7-PC4
PC3-PC0
PB0-PB7
Fig. Interfacing diagram of IC 8255 with up 8085
Block Diagram of 8255:
Pin Diagram:
Architecture Description: The internal block diagram of 8255 PPI is given in the figure. 8255 is a 40 pin INTEL IC which consist of input and output ports.
1. The 8255 PPI consists of 8 bit ports A and B. 2. It consists of two 4 bit ports, port C upper and port C lower. If they are used
together then it becomes one 8bit port C. 3. 8255 PPI consists of 8 bit control word register (CWR). By transforming 8bit
number into CWR using program, we can define different ports of 8255 PPI either at input or as output. Hence 8255 PPI is called programmable IC.
Modes of Operation of 8255 PPI: BSR[Bit Set Reset Mode]: BSR mode is used to set (1)/reset(0) any one out of 8 pins of only port C (PC7 to PC0).To reset/set any one pin of port C we have to transfer 8 bit control word from up to CWR of 8255 in the format given below. 0 X X X A2 A1 A0 S/R For BSR mode D7 will be always zero. A2 A1 A0 will give 8 bit address of port C pin to be selected. If D0=0/1 then the selected port C pin is set/reset respectively. A) IO Mode: Format of CWR for IO mode is
1 MA1 MA0 PA PCup MB PB PClow
To define the different modes and operations of 8255 in parallel IO mode, we have to transfer 8 bit number into CWR of 8255 in the format given above. For parallel IO mode D7 will be always 1. MA1, MA0 bits are used to define modes of portA. MB bit is used to define mode of port B. PA, PCup, PB, PC low bits are used to define the operation of port A, port Cup, port B, port C low resp. If PA=1/0, then port A gets defined as input/output port respectively.
Logic:
1. Define the control word according to the problem. 2. Store the data in accumulator, which will be transferred on IO ports. 3. OUT accumulator data.
Result: Viva Questions:
1. What is function of WR signal? 2. What is function of ALE signal?
Experiment No. 9 Aim: To generate the square wave. Problem: To generate the square wave of period 1sec on sod pin. Program:
Instruction Memory Location Mnemonic Operand
Opcode Comment
C000H C001H C002H
Logic:
1. Load accumulator with 40H. 2. Set interrupt mask ie SIM. 3. Load accumulator with C0H. 4. Set interrupt mask ie SIM. 5. Call delay. 6. Load accumulator with 40H. 7. Set interrupt mask ie SIM. 8. Repeat the procedure from 3.
Result: Viva Questions:
1. What is function of RESET IN signal? 2. What is function of RESET OUT signal?
3. What is function of INTR signal? 4. What is function of SID signal? 5. What is function of SOD signal? 6. What is addressing mode of JPO.
Experiment No. 10 Aim: To convert Hexadecimal number into its ASCII equivalent. Problem: Write a program to convert hexadecimal number into its ASCII equivalent. The no. is stored at 7500H and store the result from 7501H. Program:
Instruction Memory Location Mnemonic Operand
Opcode Comment
C000H C001H C002H
Logic:
1. Load accumulator with the data of memory location. 2. Compare with 10 3. If there is a carry, go to next otherwise add offset 7 for letters. 4. Add offset for ASCII 5. Store the result.
Result: Viva Questions:
1. What is addressing mode of SIM. 2. What is addressing mode of DAA. 3. What is addressing mode of EI. 4. What is addressing mode of DI. 5. What is addressing mode of CMA. 6. What is addressing mode of NOP.
Experiment No. 11 Aim: To interface DAC with up8085 and generate Triangular wave. Problem : Interface DAC with up 8085 and write a program to generate triangular wave. Circuit Diagram : Program:
Instruction Memory Location Mnemonic Operand
Opcode Comment
C000H C001H C002H
Fig. Interfacing DAC0808 with 8085
cs
I/P2
GND
8255 PC7
PC0
PA7-PA0
D0-D7
B1-B8
DAC 0808
+5V
5K
V0 741
Vcc
0.01uF
0.1uF
-12V
2.5K
2.5K
+5V
Logic:
1. Initialize control word register. 2. Initialize register B by FFH and A by 00H. 3. Select port A as Output port. 4. Give output through port A. 5. Increment A by 1 and decrement B by 1. 6. Repeat the same procedure from step 3 until counter become zero.
Result: Viva Questions:
��� ���������� ����������� ���������������� ������� ������������������������ ���������������������� ���������������� ��� ���� ���� ! ������"#$��������������������� �����!�����%�!� ��&�"#$������!��'�� �����
6. ��� ����� ���� ! ������������&����������������
Experiment No. 12 Aim: To interface ADC with up8085. Problem Statement: Interface ADC with up 8085. Write a program to interface ADC with up 8085. Circuit Diagram: Program:
Instruction Memory Location Mnemonic Operand
Opcode Comment
C000H C001H C002H
diff
A1
A0
cs
20
RESET
RD
WR
I/P2
GND
A B C
OE
ALE
EOC
SOC
8255
PC7
PC0
PA7-PA0
PB0
PB2
PB1
A0
D0-D7
O7-O0
ADC 0808
Vref Vref
Vcc
A1
+5V
+5V
Fig. Interfacing ADC 0808 with 8085
Logic:
1. Initialize 8255 ports A, B input and C(upper) output, c(lower) input. 2. Initialize stack pointer. 3. Set PC4 bit high, then reset PC4 pulse. 4. Set port B input, set PC6(start conversion) . 5. Read Port C status. 6. Check PC1 end of conversion. PC1 not low jump back. 7. To check PC1 – HIGH then read data 8. Read digital output data.
Result: Viva Questions:
1. What is function of ORA M. 2. What is function of ORI 8bit data. 3. What is function of XRA R. 4. What is function of XRA M. 5. What is function of XRI 8 bit data. 6. What is function of CMA.