w w w . e e e e x c l u s i v e . b l o g s p o t . c o m
Expt.No. Name of the experiment 1 Arithmetic operations using 8085 Microprocessor. 2a Sorting of numbers (Ascending & descending) using 8085 Microprocessor. 2b Number conversions (BCD HEX, HEX BCD). 3 Arithmetic operations using 8086 Microprocessor. 4a Interfacing 8 bit ADC Converter with 8085 Microprocessor. 4b Interfacing 8 bit DAC Converter with 8085 Microprocessor. 5 Traffic Light controller using 8085 Microprocessor. 6a Square Wave Generation using 8254 6b Serial Data Transmission using 8251 7 Interfacing 8279 with 8085 microprocessor 8 8 bit Arithmetic operations using 8051 Microcontroller. 9 Finding the smallest and largest number in an array of numbers using 8051 Microcontroller 10 Interfacing 8 bit DAC Converter with 8051 Microcontroller 11 Interfacing of Stepper Motor with 8051 Microcontroller 12 Interfacing Traffic Light Controller using 8051
w w w . e e e e x c l u s i v e . b l o g s p o t . c o m
EXPT NO 1 ARITHMETIC OPERATIONS USING 8085 AIM: To write the assembly language programs for performing the following arithmetic operations: a) 16 bit binary addition. b) 16 bit binary subtraction. c) 16 bit binary multiplication. d) 16 bit binary division.
APPARATUS REQUIRED: Microprocessor kit, Power supply.
PROBLEM STATEMENT:
Write an ALP in 8085 P to add and subtract two 16-bit binary numbers stored in the memory locations 4100 & 4101 and 4102 & 4103 and store the result starting from the memory location 4105H. Also provide an instruction in the above program to observe the carry also and store the carry in the memory location 4104H.
ALGORITHM: 16 BIT ADDITION: 1 Start. 1. Enter the two 16 bit data in two register pairs HL and DE. 2. Initialize a carry counter register B to zero. 3. Add the contents of register pairs. 4. If a carry is generated, increment the carry counter B. 5. Store the Carry in the B register and the sum, which is in the register pair HL in the memory. 6. Stop.
w w w . e e e e x c l u s i v e . b l o g s p o t . c o m
16 BIT SUBTRACTION: 1. Start. 2. Get the two 16 bit data in two of the register pairs. 3. Subtract the Low Order Byte of data1 from that of the data 2. 4. Subtract the How Order Byte of data1 along with borrow from that of the data2. 5. Store the result in memory. 6. Stop. PROBLEM STATEMENT: Write an ALP in 8085 P to multiply two 16-bit binary numbers stored in the memory locations 4100(LOB) & 4101(HOB) and 4102(LOB) & 4103(HOB) and store the result in the memory location 4104H & 4105H.Write instructions for performing 16-bit division also. 16 BIT MULTIPLICATION. 1. Start. 2. Initialize BC register pair to store the Carry. 3. Store the data 1 and data 2 in DE register pair and SP register. 4. Initialize the HL register pair to zero, to store the result. 5. Multiply by repeated addition of data 1 data 2 times. 6. If carry flag is set during addition., increment the carry register pair. 7. Store the product available in HL pair in memory. 8. Store the contents of the BC register pair which is the carry in memory. 9. Stop. 16 - BIT DIVISION 1. Start. 1. Store the dividend in HL register pair. 2. Store the divisor in BC register pair 3. Initialize the DE register pair to zero, to carry the quotient. 4. Perform repeated subtraction of divisor from dividend till the dividend is less than the divisor. 5. For every subtraction done, keep on incrementing the quotient register pair DE. 6. Store the remainder pair in memory. 7. Store the quotient in memory. w w w . e e e e x c l u s i v e . b l o g s p o t . c o m 8. Stop. FLOW CHART
16-BIT ADDITION 16-BIT SUBTRACTION
START INITIALISE CARRY REGISTER LOAD TWO NOS. IN REGISTER PAIRS ADD THE TWO NUMBERS ANY CARRY INCREMENT CARRY REGISTER STORE THE RESULT STOP NO YES START LOAD THE TWO NUMBERS INTIALIZE BORROW REGISTER SUBTRACT THE TWO NUMBERS ANY BORROW? INCREMENT CARRY REGISTER STORE THE RESULT STOP NO YES w w w . e e e e x c l u s i v e . b l o g s p o t . c o m 16-BIT MULTIPLICATION 16-BIT DIVISION
START GET MULTIPLIER AND MULTIPLICAND IN REGISTER PAIRS
PRODUCT=0000 REG. PAIR = REG. PAIR + MULTIPLICAND MULTIPLIER = MULTIPLIER 1 IS MULTIPLIER = 0? NO STORE REGISTER PAIR YES STOP START LOAD DIVISOR & DIVIDEND QUOTIENT = 0 DIVIDEND = DIVIDEND DIVISOR QUOTIENT = QUOTIENT + 1 IS DIVIDEND < DIVISOR YES NO STORE QUOTIENT STOP w w w . e e e e x c l u s i v e . b l o g s p o t . c o m EXPT NO 2 SORTING of NUMBERS USING 8085 (ASCENDING AND DESCENDING ORDER)
AIM: To write an Assembly Language Program (ALP) to sort a given array of numbers in ascending and descending order. APPARATUS REQUIRED: Microprocessor kit, Power supply. PROBLEM STATEMENT: An array of length 10 is stored from the location starting from 5000H. Sort it into descending and ascending orders and store the resultant starting from the location 5300H. ALGORITHM: SORTING IN ASCENDING ORDER: a. Start. b. Load the array count in a register. Initialize a carry flag FF to zero. c. Get the first two numbers. d. Compare the numbers and swap them if necessary so that the two numbers are in ascending order. If swapping is done, set the carry flag FF. e. Repeat the steps c and d till the array is completed. f. Repeat the steps c, d and e till carry flag FF remains Reset. f. Stop SORTING IN DESCENDING ORDER: a. Start. b. Load the array count in a register. Initialize a Carry Flag FF to zero. c. Get the first two numbers. w w w . e e e e x c l u s i v e . b l o g s p o t . c o m d. Compare the numbers and swap them so that the two numbers are in descending order. And set the Carry Flag FF. e. Repeat steps c and d till the array is completed. f. Repeat the steps c, d and e till the Carry Flag FF remains Reset. g. Stop.
POINTER = POINTER +1 COUNT = COUNT + 1 IS COUNT = 0 IS FLAG = 0 STOP YES YES NO NO NO YES START INITIALIZE POINTER COUNT = COUNT 1 FLAG = 0 IS POINTER POINTER + 1 TEMP = POINTER POINTER = POINTER + 1 POINTER + 1 = TEMP FLAG=FLAG+1 POINTER = POINTER +1 COUNT = COUNT + 1 IS COUNT = 0 IS FLAG = 0 STOP YES NO NO YES YES w w w . e e e e x c l u s i v e . b l o g s p o t . c o m EXPT NO 2b NUMBER CONVERSIONS USING 8085 (BCD TO HEXA AND HEXA TO BCD)
AIM: To write an Assembly language program for converting a two digit BCD number (maximum of 99) to hexadecimal and to convert a hexadecimal number (maximum of FFH) to BCD.
ALGORITHM: CONVERSION OF BCD TO HEXADECIMAL: 1. Start. 2. Separate the given 8 - bit packed BCD number into two 4 bit unpacked BCD nibbles(BCD1 and BCD2). 3. Multiply BCD2 the most significant nibble, by 10. 4. Add BCD1 to the answer from step3. 5. Store the result and Stop. CONVERSION OF BCD TO HEXADECIMAL: 1. Start. 2. Read the hexadecimal number. 3. Initialize a memory location to store the number of 100s. Find the number of 100s and store it in the memory. 4. Find the number of 10s from the remainder and store it in the next memory location. 5. The remainder now contains the number of 1s and store it in the next memory location. 7. Stop.
w w w . e e e e x c l u s i v e . b l o g s p o t . c o m
FLOW CHART:
BCD TO HEX HEXA TO BCD
START GET MOST SIGNIFICANT DIGIT(MSD) MSD = MSD x 10 HEX DATA = MSD + LSD (LEAST SIGNIFICANT DIGIT) STORE HEX DATA START START GET DATA CARRY =0 HUNDREDS =0 TENS=0 DATA =DATA -100 HUNDREDS =HUNDREDS + 1 IS CARRY =1 ? DATA =DATA +100 DATA =DATA - 10 IS CARRY = 1 ? DATA =DATA -10 UNITS =DATA STORE HUNDREDS , TENS , UNITS STOP TENS = TENS + 1 YES YES NO NO w w w . e e e e x c l u s i v e . b l o g s p o t . c o m EXPT NO: 4 A
INTERFACING 8 BIT ADC CONVERTER USING 8085
Aim: To obtain the digital output corresponding to the analog input.
Apparatus Required: 1. Microprocessor 8085 Trainer Kit 2. Display Interface Kit 3. Flat Cable Connector 4. Power Supply +5 V
Algorithm: 1. Start 2. Initialize control word of 8255 to enable ports A, B as output ports and port C as output port. 3. Initialize accumulator 4. Send contents of accumulator to DAC through port A 5. Obtain comparator output to port c. 6. If accumulator =0 go to step 5else goto step 9 7. Decrement contents of accumulator 8. Go to step 4 9. Call display subroutine to display digital output 10. Stop.
w w w . e e e e x c l u s i v e . b l o g s p o t . c o m
Flowchart START
ACTIVATE THE 8255 CONTROLLER
INITIALIZE ACCUMULATOR
SEND CONTENTS OF ACCUMULATOR TO DAC THROUGH PORT A
OBTAIN COMPARATOR OUTPUT TO PORT C
IS ACCUMULATOR = 0?
DECREMENT CONTENTS OF ACCUMULATOR NO CALL DISPLAY SUBROUTINE TO DISPLAY DIGITAL OUTPUT STOP YES w w w . e e e e x c l u s i v e . b l o g s p o t . c o m EXPT NO: 4 B INTERFACING 8 BIT DAC CONVERTER USING 8085
AIM:- To generate different types of waveforms by interfacing a DAC with a microprocessor trainer kit.
EQUIPMENT REQUIRED Intel 8085 based MPS 85 2 trainer kit, DAC interface card, 26 pin flat cable connector, CRO with probe. ALGORITHM:- SQUARE WAVE FORM 1. Initialize the control word register i.e., 8255 as input port. 2. Send 00 to port A of 8255 3. Call delay subroutine 4. Send FF to port A of 8255 5. Call delay subroutine 6. Repeat the step 2 onwards. SAW TOOTH WAVE FORM 1. Initialize the control word register. 2. Initialize the accumulator content 3. Send to port A of 8255 4. Increment the accumulator content 5. If zero flag is not set then repeat the step 3 onwards, otherwise repeat the step 2 onwards.
w w w . e e e e x c l u s i v e . b l o g s p o t . c o m FLOW CHART: Square Waveform: Saw tooth Waveform:
YES NO START ACTIVATE THE 8255 CONTROLLER SEND 00 TO PORT A CALL DISPLAY SUBROUTINE SEND FF TO PORT A CALL DISPLAY SUBROUTINE START ACTIVATE THE 8255 CONTROLLER ACC = 00 SEND ACC TO PORT A ACC = ACC + 1 IF Z =0 w w w . e e e e x c l u s i v e . b l o g s p o t . c o m
EXPT. NO:5
TRAFFIC LIGHT CONTROLLER USING 8085 MICROPROCESSOR
AIM:- To write an Assembly language Programme for traffic light controller. EQUIPMENT REQUIRED 8085 microprocessor kit and Power Supply. ALGORITHM:- 1. Start. 2. Write the control word to initialize 8255.Obtain the data for each direction and store in the memory. 3. Initialize a counter to indicate the number of directions. 4. Initialize HL Pair to the starting address of the data.. 5. Check the result. 6. Decrement the counter and repeat step 3 till counter becomes zero. 7. Stop. w w w . e e e e x c l u s i v e . b l o g s p o t . c o m FLOW CHART TRAFFIC CONTROLLER
START Write control word to initialize 8255 Initialize a counter. Initialize HL pair to 9000h Call Display Program Introduce a Delay of 4 Seconds Call Display Program
Introduce a Delay of 4 Sec. Decrement the counter Call Display Program COUNTER = 0? Introduce a Delay Of 4 Sec. NO YES w w w . e e e e x c l u s i v e . b l o g s p o t . c o m FLOW CHART DISPLAY PROGRAM
SEND CONTROL WORD TO ACC FROM MEMORY
INCREMENT HL REG. PAIR CONTENT SEND CONTROL WORD FROM MEMORY TO ACC. OUTPUT THE DATA TO PORT C DISPLAY SEND CONTROL WORD TO ACC FROM MEMORY
INCREMENT HL REG. PAIR CONTENT OUTPUT THE DATA TO A PORT OUTPUT THE DATA TO A PORT INCREMENT HL REG. PAIR CONTENT RETURN w w w . e e e e x c l u s i v e . b l o g s p o t . c o m EXPT. NO. : 6 A SQUARE WAVE GENERATION USING 8254
AIM: To interface 8254 with 8085 microprocessor and generate a square wave
ALGORITHM 1. Start 2. Write control word to initialize 8254 in mode 3 3. Load the LSB of the count and output in channel 0 4. Load the MSB of the count and output in channel 0 5. Stop. FLOW CHART
START
Write control word to initialize 8254 in mode 3
Output the LSB and MSB of the count in channel 0
STOP w w w . e e e e x c l u s i v e . b l o g s p o t . c o m EXPT. NO. : 6 B SERIAL DATA TRANSMISSION USING 8251
AIM: To interface 8251 with 8085 microprocessor and to check the transmission and reception of a character.
ALGORITHM
For transmitting the data
1. Start 2. Write control word to initialize 8254 in mode 3 3. Load the LSB of the count and output in channel 0 4. Load the MSB of the count and output in channel 0 5. Write mode instruction word and command instruction word for 8251. 6. Output the data to be transmitted to data register and enable an interrupt.
For Receiving the data
7. Read the data from the data register 8. Store the data to a memory location 9. Stop
w w w . e e e e x c l u s i v e . b l o g s p o t . c o m FLOW CHART For transmitting the data
START
Write control word to initialize 8254 in mode 3
Output the LSB and MSB of the count in channel 0
STOP Write mode instruction word and command instruction word for 8251 Output the data in data register
w w w . e e e e x c l u s i v e . b l o g s p o t . c o m FLOW CHART For receiving the data
START Read the data from data register Store the data in memory location
STOP w w w . e e e e x c l u s i v e . b l o g s p o t . c o m
EXPT. NO. : 7 INTERFACING 8279 WITH 8085 MICROPROCESSOR
AIM: To interface 8279 with 8085 microprocessor and display the rolling message HELP US
ALGORITHM 5. Start 6. Load the HL pair with the starting address of the message to be displayed and initialize a counter. 7. Initialize 8279 8. Output the data from memory to the data register 9. Call delay. 10. Increment the pointer and decrement the counter. 11. Repeat until counter becomes 0. 12. Stop.
w w w . e e e e x c l u s i v e . b l o g s p o t . c o m
FLOW CHART
START Load the HL pair with the starting address of the message to be displayed and initialize a counter.
Call Delay SUBROUTINE Initialize 8279 and Output the data from memory to the data register Increment the pointer Decrement the counter Is the counter value 0 Yes No w w w . e e e e x c l u s i v e . b l o g s p o t . c o m EXPT NO 8 8 BIT ARITHMETIC OPERATIONS USING 8051
AIM: To write the assembly language programs for performing the following arithmetic operations: a) 8 bit binary addition. b) 8 bit binary subtraction. c) 8 bit binary multiplication. d) 8 bit binary division.
APPARATUS REQUIRED: Microcontroller kit.
PROBLEM STATEMENT: Write an ALP in 8051 c to perform 8-bit arithmetic operations for the numbers stored in the memory location 4500H and 4501H and store the result in the memory location 4600H.Also provide an instruction in the above program to consider the carry also and store the carry in the memory location 4601H.
ALGORITHMS: 8 BIT ADDITION: 1. Start 2. Initialize carry register to zero. 3. Store data 1 in accumulator. 4. Store date 2 in B register. 5. Load the data pointer with external memory address 6. Add the contents of B register to that of the accumulator. 7. If a carry is generated, increment the carry counter. 8. Store the contents of the Accumulator, which is the sum in memory. 9. Move the carry register contents to Accumulator and store the same in memory. 10. Stop.
i. e x e w w w . e e e e x c l u s i v e . b l o g s p o t . c o m
8 BIT SUBTRACTION: 1. Start 2. Initialize Barrow register to zero. 3. Store data 1 in accumulator and date 2 in B register respectively. 4. Subtract the contents of B register to that of the accumulator. 5. Load the data pointer with external memory address 6. If a borrow is generated, increment the borrow counter. 7. Store the contents of the Accumulator, which is the difference in memory. 8. Move the barrow register contents to Accumulator and store the same in memory. 9. Stop.
8 BIT MULTIPLICATION: 1. Start. 2. Store data 1 in register Accumulator. 3. Store data 2 in register B. 4. Load the data pointer with external memory address 5. Multiply A and B register 6. Move the A and B register contents to the memory 7. Stop. 8 BIT DIVISION:
1. Start. 2. Store data 1 in register Accumulator. 3. Store data 2 in register B. 4. Load the data pointer with external memory address 5. Divide A and B register 6. Move the A and B register contents to the memory 7. Stop.
w w w . e e e e x c l u s i v e . b l o g s p o t . c o m
FLOWCHART:
8-BIT ADDITION 8-BIT SUBTRACTION
START SET UP COUNTER (CARRY) GET SECOND OPERAND TO A A = A + B STORE THE SUM START GET FIRST OPERAND TO A SUBTRACT SECOND OPERAND FROM MEMORY STORE THE DIFFERENCE STOP IS THERE ANY CARRY GET FIRST OPERAND TO B COUNTER = COUNTER + 1 STORE THE CARRY STOP SET UP COUNTER (CARRY) ANY CARRY? COUNTER = COUNTER + 1 STORE THE CARRY NO YES YES NO w w w . e e e e x c l u s i v e . b l o g s p o t . c o m
8-BIT MULTIPLICATION 8-BIT DIVISION
START GET MULTIPLIER IN A AND MULTIPLICAND IN B register Multiply the content of A and B register
STOP START STOP Load Data Pointer with External Memory Address Move the content of A and B to external Address GET DIVIDEND IN A AND DIVISOR IN B register Divide the content of A and B register Load Data Pointer with External Memory Address Move the content of A and B to external Address w w w . e e e e x c l u s i v e . b l o g s p o t . c o m EXPT NO 9 FINDING THE SMALLEST AND LARGEST NUMBER IN AN ARRAY OF NUMBERS USING 8051
AIM: To write Assembly Language Programs (ALP) to find the maximum and minimum of an array of numbers. APPARATUS REQUIRED: Microcontroller Kit PROBLEM STATEMENT: An array of length 10 is stored from the location starting from 4600H. Sort it into descending and ascending orders and store the resultant starting from the location 4700H. ALGORITHM: FINDING THE SMALLEST NUMBER OF THE ARRAY: 1. Start. 2. Load the array count in a register. 3. Get the first two numbers. 4. Compare the numbers and swap them if necessary so that the two numbers are in descending order. 5. Repeat the steps 3 and 4 till the array is completed. 6. Repeat the steps 3, 4 and5 and store the smallest number.. 7. Stop
w w w . e e e e x c l u s i v e . b l o g s p o t . c o m FINDING THE LARGEST NUMBER OF THE ARRAY: 1. Start. 2. Load the array count in a register. 3. Get the first two numbers. 4. Compare the numbers and swap them so that the two numbers are in ascending order. 5. Repeat steps 3 and 4 till the array is completed. 6. Repeat the steps 3, 4 and 5 and store the largest number as the result in memory. 7. Stop.
w w w . e e e e x c l u s i v e . b l o g s p o t . c o m
FLOW CHART: FINDING THE MINIMUM AND MAXIMUM NUMBER OF AN ARRAY
POINTER = POINTER +1 COUNT = COUNT + 1 IS COUNT = 0 STOP YES NO NO YES STORE THE POINTER RESULT STORE THE POINTER RESULT w w w . e e e e x c l u s i v e . b l o g s p o t . c o m
EXPT. NO: 10 INTERFACING DAC CONVERTER USING 8051 AIM:- To generate different types of waveforms by interfacing a DAC with a microcontroller.
ALGORITHM:- SQUARE WAVE FORM 1. Initialize the control word register i.e., 8255 as input port. 2. Send 00 to port A of 8255 3. Call delay subroutine 4. Send FF to port A of 8255 5. Call delay subroutine 6. Repeat the step 2 onwards. SAW TOOTH WAVE FORM 1. Initialize the control word register. 2. Initialize the accumulator content 3. Send to port A of 8255 4. Increment the accumulator content 5. If zero flag is not set then repeat the step 3 onwards, otherwise repeat the step 2 onwards.
w w w . e e e e x c l u s i v e . b l o g s p o t . c o m
FLOW CHART: Square Waveform: Saw tooth Waveform:
YES NO START ACTIVATE THE 8255 CONTROLLER SEND 00 TO PORT A CALL DISPLAY SUBROUTINE SEND FF TO PORT A CALL DISPLAY SUBROUTINE START ACTIVATE THE 8255 CONTROLLER ACC = 00 SEND ACC TO PORT A ACC = ACC + 1 IF Z =0 w w w . e e e e x c l u s i v e . b l o g s p o t . c o m
w w w . e e e e x c l u s i v e . b l o g s p o t . c o m