Professional Documents
Culture Documents
RAISONI COLLEGE OF ENGINEERING, NAGPUR Department of Electronics and Communication Engineering Branch: -7thSem [Electronics &Telecommunication] Subject: - Advanced Microprocessors & Microcontroller
___________________________________________________________________ CYCLE-1 1) Study of 8086 and basic programs. 2) Write a program to arrange a given string in ascending / descending order. 3) Write a program to multiply two matrices. 4) Write a program to compare a given string by using string related instruction. 5) Write a program to design a digital clock to display Hrs, Min & sec. 6) Write a program GHRCE on monitor screen by using DOS functions. CYCLE-2 7) Interface following ICs with 8086 a) 8255: Write a program to generate square wave on 8255 port and use logic analyzer to observe it b) Digital to Analog Converter: Write a program to generate given waveform. 8) Interface 8086 with 8251. Set the 8251in asynchronous mode as a transmitter & receiver with even parity enabled, 2 stop bits, 8-bit character length, with given frequency & baud rate. a) Write a program to transmit 100 bytes of data string starting at location DS: 2000h. b) Write a program to receive 100 bytes of data string and store it at 3000h 9) Study of 8051 Microcontroller & basic programs. Introduction to Keil Compiler. 10) Write a program to display WELCOME GHRCE. 11) Write a program for serial data transmission by using serial port of 8051. 12) Write a program to generate a delay of 1 Sec. By using Timer0 of 8051 in mode2. 13) Interface LCD display with 8051 & write a program to display Message on it ES:
List Of Experiments
Experiment No.- 1 Aim: Study of 8086 processor and basic programs. Problem: Write a sample program for
1) Addition of Two 16-bit numbers. 2) To find smallest no. from a given string.
II) Assembler: It is a software tool, which is used to convert source code (.ASM) into object code (.OBJ). Use following command D:\masm>MASM filename.asm (Press Enter key 4-times) Eliminate all sever error then proceed for next steps. III) Linker: Once source code is assembled, the resulting object file is passed to the linker. At this point, the linker may combine several object files into an executable program. The linker: 1) Combines segments according to the instructions in the object files, rearranging the positions of segments that share the same class or group. 2) Fills in placeholders for offsets (relocatable addresses). 3) Writes relocations for segments into the header of .EXE files 4) Writes the result as an executable program file. D:\masm>LINK filename.obj (Press Enter key 4-times) IV) Debugger: It is a software tool, which is used to load the .EXE file in RAM memory location and execute it in single stepping mode. D:\masm>AFDEBUG (Press Enter key 2-Times) There you will observe command prompt of debug window i.e. CMD Use different command for different operation. Press F4 key to view different command. (e.g. L operator is used to load the .EXE file to executable window) Execute the program by pressing F1 key.
Sample Program:
Step-1: Initialize the data memory segment where two 16-bit data are present. Step-2: Fetch 1st 16-bit data into any 16-bit general-purpose register (GPR). Step-3: Add the content of GPR and 2nd word (16-bit data) of data memory. Step-4: Observe 16-bit LSB result in GPR and carry status in CF. Step-5: Terminate the program by using DOS interrupt.
Conclusion:
The 8086 have been studied and the result of sample program is observed as follows.
Viva Questions:
1) 2) 3) 4) Explain the addressing modes of 8086 in brief. What is assembler directive? Explain assembler directives of 8086 Explain general-purpose register of 8086. Explain how physical address is formed in 8086.
Experiment No. - 2 Aim: Write a program to arrange a given string in ascending / descending order. Problem: The data string of 5 bytes is present in a data memory from location
DS: 6000. Arrange the given string in ascending/ descending order in same memory location (Data Given: 6aH, 78H, 0abH, 8cH, 0daH)
Procedure:
Step-1: Initialize the data memory segment from specified address. Step-2: Initialize the outer counter (counter-1) for repetitive action of finding smallest / largest no. among the string. Step-2: Fetch 1st data from data memory location into any general-purpose register (GPR). Step-3: Initialize the inner counter (counter-2) for identification of 1st smallest /largest no. among the string. Step-4: Increment data memory offset & compares data of memory with GPR. Step-5: Check the status of carry flag & swap the content of two memories depend upon requirement. Step-6: Decrement inner counter & check zero flag for 1st largest / smallest no. If ZF=0, repeat from step 4. If ZF=1 then decrement outer counter & check again ZF, whether the ring is arrange in ascending / descending order. If ZF=0, then repeat the procedure from step-2. Step-6: If ZF=1 then terminate the program by using DOS interrupt.
Conclusion:
The given data string is arranged in ascending/descending order and the result of program is observed as follows.
Viva Questions:
1. Explain importance of condition flag in 8086. 2. What are the advantages of segmentation? 3. Is overlapping of segment possible in 8086?
Experiment No. - 3 Aim: Write a program to multiply two matrixes. Problem: Multiply two matrices of 3 X 2 and 2 X 3 and stored the resultant matrix
from location ES:8000H
Procedure:
Step-1: Initialize the counter for no. of rows in Matrix1 (C3) Step-2: Initialize the offset addresses for matrices. (Matrix1, Matrix2 and Resultant Matrix) Step-3: Initialize the counter for no. of columns in Matrix2 (C2) Step-4: Initialize 16-bit register (R1) for storing the result of row-column multiplication and counter for no. of elements in single row of Matrix1 (C3) Step-5: Fetch data of matrix1 into AL register Step-6: Multiply content of AL register with 1st data of Matrix2 Step-5: Add the content of R1 and AX & stored result in R1. Step-6: Increment offset of Matrix1 and Matrix2 according to logic. Step-6: Decrement element counter (C3) and check zero flag. If ZF=0 then jump to step-5 Step-7: Store the content of R1 register into destination memory location & increment offset of destination offset register by 2. Step-8: Calculate offset for matrix1 (Same Row) and matrix2 (Next Column) according to logic. Step-9: Decrement counter for column of Matrix2 (i.e. C2) and check zero flag. If ZF=0 then jump to step-4. Step-10: Calculate offset for next row of Matrix1. Step-11: Decrement row counter of Matrix1 (i.e. C1) and jump to Step-3 if ZF=0.
Conclusion:
The given matrices have been multiplied and the resultant matrix is observed as follows.
Viva Questions:
1. Explain Loop instruction of 8086. 2. Explain assembler directive PTR. 3. Explain status signals in 8086.
Experiment No. - 4 Aim: Write a program to compare a given string by using string related instruction. Problem: Two strings are present from logical addresses 5000:2500h and
6000:2500h in DMS and EMS respectively. Compare the strings and if found equal, load register BL with FFh otherwise load 00h.
Procedure:
Step-1: Store the given strings from the offset addresses 2500h and 2500h in DMS and EMS respectively. Step-2: Initialize the data memory segment and Extra memory segment from specified address. Step-3: Load register CL with the count value. Step-4: Load the effective addresses in SI and DI registers respectively. Step-5: Using CMPSB instruction to compare individual character from DMS and EMS. Step-6: Check whether ZF=1. If ZF=1, then go to next step otherwise go to step 8. Step 7: Decrement the count value from register CL. Check whether the count is zero. If it is zero then load register BL=FFh and terminate otherwise go to step 5. Step 8: Load register BL=00h and terminate.
Conclusion:
If the given strings matches the value of register BL is found to be FFh otherwise BL=00h
Viva Questions:
1. Differentiate between CMPSB and CMPSW instructions. 2. Write the same program using conditional REPEAT instruction. 3. Explain the significance of DF (Direction Flag) for string instruction.
Experiment No. - 6 Aim: Write a program to display GHRCE on monitor screen by using DOS
functions.
Procedure:
Step-1: Store the given string fro the offset address 2000h. Step-2: Initialize the data memory segment from specified address. Step-3: Set the function value for the display AH=09h. Step-4: Load the offset address in register DX. Step-5: Invoke the interrupt INT 21h. Step-6: Return to DOS.
Conclusion:
The given data string is displayed on the screen which is the output of the program.
Viva Questions:
1. What are various services that are provided by INT 21h interrupt? 2. Why it is necessary to terminate a given string by $? 3. What is the ASCII value of $?
Problem: 1) Interface 8255 IC with 8086 kit from addresses 40H. Generate square
wave on port A of 8255 with duty cycle of 60%.
Procedure:
Step-1: Interface 8255 Ad-on card with 8086 kit and Port A pin with Logic analyzer Step-2: Initialize the Control Word Register (CWR) in I/O mode Step-3: Transfer 00H on Port A by using OUT instruction Step-3: Call a delay of Toff time period (40% of total time) Step-4: Transfer FFH on port A & call a delay of Ton time period (60% of Total Time). Step-5: Use unconditional jump and repeat the sequence from step-3
Conclusion:
The square wave has been observed on Logic analyzer with duty cycle of 60%
Viva Questions:
1. 2. 3. 4. Explain the basic modes of 8255. Which ports can be used in Mode-1? What is clock frequency of 8086 processor given on kit? Explain Mode-1 of 8255.
Experiment No. - 09 Aim: Study of 8051 Microcontroller & basic programs. Introduction to Keil
Compiler.
Problem: Register A has packed BCD; write a program to convert packed BCD to
Two ASCII numbers and place them in R2 and R6
Conclusion:
The study of 8051 & Keil compiler has been completed. The result of sample program is as shown below.
Viva Questions:
1. 2. 3. 4. Which are the general purpose registers in 8051? What is operating frequency of 8051? What is special function register? Explain its importance. What are the addresses of RAM, reserved for bit addressable?
Experiment No. - 11 Aim: Write a program for serial data transmission by using serial port of 8051 Problem: Write a program to transfer a message WELCOME GHRCE serially a
9600 baud, 8-bit data, 1-stop bit. Do this continuously.
Procedure:
Step-1: Load TMOD register with value 20H. (Set Timer-1, in mode-2). Step-2: TH1 is loaded with value to se baud rate Step-3: Initialize SCON register. Step-4: TR1 is set to 1 to start timer1, clear TI. Step-5: The character byte to be transferred serially is written into the SBUF register Step-6: Monitor TI bit to check whether character has been transferred or not. Step-7: To transfer next characters go to step-4.
Conclusion:
The given character string is transfer serially with the given baud rate.
Viva Questions:
1) 2) 3) 4) What is baud rate? What is importance of TI flag? In how many modes serial port is operated in 8051? Explain SCON register.
Experiment No. - 12 Aim: Write a program to design to generate a delay of 1 second Mode 2. Problem: The delay of 1 second is to be monitored on port 1 pin p1.0 which
connects an LED and is made off and on per second.
Procedure:
Step-1: Set initial value for the port bit P1.0. Step-2: Load the TMOD register. Step-3: Load the count in THx register. Step-4: Initiate the Timer Run Register. Step-5: Check the timer Flag. If it is 1 complement the port bit P1.0 otherwise keep monitoring the TF flag bit. Step-6: Clear the TF bit and jump to step 5.
Conclusion:
The program was executed and found that the LED connected to port bit P1.0 blinked every 1-second.
Viva Questions:
1. What is the significance of Timer Mode 2? 2. Why an odd frequency value is selected for 8051 Microcontroller? 3. Can we change the value of T=1.085 sec? How?
Experiment No. - 13 Aim: Write a program to display Microcontroller on LCD display. Problem: Interface LCD display with 8051 and display Microprocessor in the
first line of the display.
Procedure:
Step-1: Initiate a pointer (DPTR) to point the string Microprocessor (say from memory location 2000h) Step-2: Set a counter for 14 characters. (Say R1) Step-3: Initialize 2 lines 5x7 matrix. (Load 38h into command register) Step-4: Make LCD on and Cursor on. (Load 0Eh into command register) Step-5: Set the cursor at the beginning of the first line. (Load 80h in command register) Step-6: Take a character from memory into A and send it on the display.(Use data register) Step-7: Increment the pointer DPTR for next character. Step-8: Decrement the counter R1 and check whether it is zero. Step-9: If not zero jump to step 6 and if zero stop.
Conclusion:
The program was executed and found that the LCD display showed the string Microcontroller in the first line.
Viva Questions:
1. List some LCD command codes. 2. What are the steps that should follow when writing data and writing command?