MICROCONTROLLER & INTERFACING LAB OBSERVATION
MICROCONTROLLER & INTERFACING LAB OBSERVATION
ENGINEERING COLLEGE
(An Autonomous Institution)
RSM NAGAR, KAVARAIPETTAI – 601 206
2022 REGULATION
NAME :
REG NO :
SECTION :
Vision of the Institution
PEO2: To provide students with strong foundational concepts and also advanced
techniques and tools in order to enable them to build solutions or systems of
varying complexity.
PEO3: To prepare students to critically analyze existing literature in an area of
specialization and ethically develop innovative and research oriented
methodologies to solve the problems identified.
PROGRAMME OUTCOMES:
12. Life-long learning: Recognize the need for, and have the preparation and
ability to engage in independent and life-long learning in the broadest
context of technological change.
COURSE OBJECTIVES:
• To examine the architecture and functionality of 8085 and 8086 Microprocessor
• To explore memory organization and various addressing modes of the 8051 Microcontroller
• To develop proficiency in assembly language programming for the 8051Microcontroller
• To design and develop the typical applications of microcontrollers
• To understand the architecture of PIC Microcontroller
LIST OF EXPERIMENTS:
1. Arithmetic and Logical Operations using 8085
2. Arithmetic and Logical Operations using 8086
3. One‟s and two‟s complement of a number using8051
4. Block data transfer using8051
5. Arithmetic and Logical Operations using 8051
6. Timer/Counter Interface using 8051
7. 7-Segment LED display using 8051
8. Stepper Motor Interfacing using 8051
9. Arithmetic operations using PIC Microcontroller
10.Logical operations using PIC Microcontroller
TOTAL: 75 PERIODS
COURSE OUTCOMES:
Aim:
To write an assembly language program for addition of two 8-bit data using 8085 microprocessor.
Apparatus required:
Algorithm:
Flow Chart:
Program:
INPUT OUTPUT
RESULT:
Thus, the program to perform 8-bit addition without carry using 8085 microprocessor kit has
been executed successfully.
EXPTNO: 1.b 8 BIT SUBTRACTION
Aim:
To write an assembly language program for subtraction of two 8-bit data using 8085 microprocessor.
Apparatus required:
Algorithm:
Flow Chart:
Program:
INPUT OUTPUT
RESULT:
Thus, the program to perform 8-bit subtraction without borrow using 8085 microprocessor
kit has been executed successfully.
EXPT NO: 1.c 8 BIT MULTIPLICATION
Aim:
To write an assembly language program for multiplication of two 8-bit data using 8085 microprocessor.
Apparatus required:
Algorithm:
Flow Chart:
Program:
INPUT OUTPUT
RESULT:
Thus, the program to perform 8-bit multiplication using 8085 microprocessor kit has been executed
successfully.
EXPT NO: 1.d 8 BIT DIVISION
Aim:
To write an assembly language program for division of two 8-bit data using 8085 microprocessor.
Apparatus required:
Algorithm:
INPUT OUTPUT
RESULT:
Thus, the program to perform 8-bit division using 8085 microprocessor kit has been executed
successfully.
EXPTNO: 1.e LOGICAL OPERATIONS
Aim:
To write an assembly language program for AND, OR, NOT and XOR using 8085 microprocessor
Apparatus required:
Algorithm:
Flow Chart:
Program:
AND OPERATION
INPUT OUTPUT
OR OPERATION
INPUT OUTPUT
INPUT OUTPUT
NOT OPERATION
HLT End
INPUT OUTPUT
RESULT:
Thus, the program to perform logical operations of AND, OR, XOR, NOT using 8085 microprocessor
kit has been executed successfully.
8086 MICROPROCESSOR EXPERIMENTS
ARITHMETIC AND LOGICAL OPERATIONS
EXPT NO: 2.a 16 BIT ADDITION WITH CARRY
Aim:
To write an assembly language program for addition of two16-bit with carry using 8086 microprocessor.
Apparatus required:
Algorithm:
4. Move the sum result from AX register into output memory location.
5. Move the carry result from CX register into output memory location
Flow Chart:
Program:
INPUT OUTPUT
RESULT:
Thus, the program to perform 16-bit addition using 8086 microprocessor kit has been executed
successfully.
EXPTNO: 2.b 16 BIT SUBTRACTION WITH BORROW
Aim:
To write an assembly language program for subtraction of two16-bit with borrow using 8086
microprocessor.
Apparatus required:
Algorithm:
4. Move the sum result from AX register into output memory location.
5. Move the carry result from CX register into output memory location
Flow Chart:
Program:
INPUT OUTPUT
RESULT:
Thus, the program to perform 16-bit subtraction with borrow using 8086 microprocessor kit
has been executed successfully.
EXPT NO: 2.c 16 BIT MULTIPLICATION
Aim:
To write an assembly language program for multiplication of 16-bit data using 8086 microprocessor.
Apparatus required:
Algorithm:
3. Store the lower order 16-bits of result from AX register in output memory location.
4. Store the higher order 16-bits of result from DX register in output memory location.
Flow Chart:
Program:
INPUT OUTPUT
RESULT:
Thus, the program to perform 16-bit multiplication using 8086 microprocessor kit has been executed
successfully.
EXPT NO: 2.d 16 BIT DIVISION
Aim:
To write an assembly language program for division of 16-bit data using 8086 microprocessor.
Apparatus required:
Algorithm:
3. Move quotient from AX to output memory location and remainder from DX to output
memorylocation.
Flow Chart:
Program:
INPUT OUTPUT
RESULT:
Thus, the program to perform 16-bit division using 8086 microprocessor kit has
been executed successfully.
EXPT NO: 1.e LOGICAL OPERATIONS
Aim:
To write an assembly language program for logical operations of AND, OR, NOT and XOR using
8086 microprocessor.
Apparatus required:
Algorithm:
Flow Chart:
Program:
INPUT OUTPUT
RESULT:
Thus the program to perform logical operations of AND, OR, XOR, NOT using 8086
microprocessor kit has been executed successfully.
8051 MICROCOTROLLER EXPERIMENTS
EXPT NO: 3 ONE’S AND TWO’S COMPLEMENT OF A NUMBER
Aim:
Apparatus required:
Algorithm:
1. Get two registers to move data from memory location.
2. Perform one’s and two’s complement of a number in single data.
3. Move the result from data pointer to memory registers.
4. Stop the program.
Flow Chart:
1’S COMPLEMENT
2’S COMPLEMENT
PROGRAM
INPUT OUTPUT
RESULT:
Thus, the program to perform one’s complement and two’s complement using 8051
microcontroller kit has been executed successfully.
EXPT NO: 4 BLOCK DATA TRANSFER USING 8051
Aim:
To write an assembly language program to transfers block of data between specified memory location
using 8051 microcontroller.
Apparatus required:
Algorithm:
EXAMPLE:
Let the array start at 4501 and let the of the array be in 4500. The program should move the contents
array starting at 4510.
Flow Chart:
Program:
RESULT:
Thus, the block of data transfer from source to destination location using 8051 microcontroller
kit was executed successfully.
EXPT NO: 5.a ARITHMETIC OPERATIONS
Aim:
To write an assembly language program for arithmetic operation using 8051 microcontroller.
Apparatus required:
Algorithm:
Flow Chart:
8 BIT ADDITION
Program:
INPUT OUTPUT
Program:
INPUT OUTPUT
Address Data
Address Data
8-BIT MULTIPLICATION
INPUT OUTPUT
Address Data Address Data
8 - BIT DIVISION
INPUT OUTPUT
RESULT:
Thus, the program to perform arithmetic operation using 8051 microcontroller kit has
been executed successfully.
EXPT NO: 5.b LOGICAL OPERATIONS
Aim:
To write an assembly language program for logical operations using 8051 microcontroller.
Apparatus required:
Algorithm:
FLOW CHART:
PROGRAM:
INPUT OUTPUT
Address Data
Address Data
OR OPERATION
INPUT OUTPUT
Address Data
Address Data
XOR OPERATION
INPUT OUTPUT
Address Data
Address Data
RESULT:
Thus, the program to perform logical operation using 8051 microcontroller kit has been
executed successfully.
EXPT NO: 6 TIMER/COUNTER INTERFACE USING 8051
AIM:
To write an assembly language program to generate time delays using the 8051's internal timers
and count external pulses or events using the 8051’s counter functionality.
APPARATUS REQUIRED:
1.8051microprocessor kit-1
2. Keyboard-1 and power chord.
a) TIMER
Timers in 8051 Microcontroller
Timers are essential components in microcontrollers, enabling time delay generation, event counting, and
signal generation. The 8051 microcontroller has two 16-bit timers/counters, Timer 0 and Timer 1, each
capable of operating in different modes. The primary function of a timer is to increment the timer register at
a fixed frequency derived from the microcontroller's clock.
Timer Modes:
Operation:
• The timer is started by setting the TR (Timer Run) bit in the TCON (Timer Control) register.
• Once the timer overflows, it sets the TF (Timer Flag) bit, which can be used to generate an interrupt
or a specific action in the program.
ALGORITHM
1. Select mode of timer
2. Select register and enter the data
3. Set timer
4. Clear timer flag
5. Clear timer register
6. Jump start
PROGRAM
b) COUNTER
Counters in the 8051 microcontrollers work similarly to timers but count external events or pulses instead of
internal clock cycles. By configuring a timer in counter mode, the microcontroller can count the number of
pulses received on the T0 or T1 pins.
Counter Modes:
Operation:
• The counter is enabled by setting the C/T (Counter/Timer) bit in the TMOD (Timer Mode) register
to 1.
• The external pulses are then counted, and upon overflow, the counter sets the TF bit, signalling an
event.
ALGORITHM
1. Configure Timer 0 as a counter in Mode 1.
2. Count external pulses from a push button or signal generator.
3. Display the count value on LEDs or monitor it via serial communication.
PROGRAM
RESULT
The LED toggling at regular intervals based on the timer delay is observed. Also, the count of external pulses
from a push button is counted and displayed on the onboard LEDs.
EXPT NO: 7 7 SEGMENT LED DISPLAY USING 8051
AIM :
To develop programs for displaying character ‘A’using 8051 Microcontroller.
APPARATUS REQUIRED:
ALGORITHM :
0 0 0 0 0 0 0 0
0 0 0 D D K K K
DD
000-2Key lockout.
d c b a dp g f e
Program:
RESULT:
Thus the program to display the character “A“ in the display was verified and executed
successfully.
EXPT NO: 8 STEPPER MOTOR INTERFACING USING 8051
AIM:
To control stepper motor in Clockwise and Anticlockwise direction using 8051 microcontroller.
APPARATUS REQUIRED:
STEPPER MOTOR
THEORY:
A motor in which the rotor is able to assume only discrete stationary angular position is a stepper
motor. The rotary motion occurs in a stepwise manner from one equilibrium position to the next two- phase
scheme: Any two adjacent stator windings are energized. There are two magnetic fields active in quadrature
and none of the rotor pole faces can be in direct alignment with the stator poles. A partial but symmetric
alignment of the rotor poles is of course possible.
ALGORITHM:
OUTPUT
OUTPUT
MEMORY MEMORY VAL
VALUE ADDRESS UE
ADDRESS
RESULT:
Thus, the assembly language program for rotating stepper motor using 8051 in Clockwise and anti-
clock directions was executed successfully.
EXPT NO: 9 ARITHMETIC OPERATIONS USING PIC MICROCONTROLLER
AIM
HARDWARE/SOFTWARE REQUIRED
1. MPLAB X IDE
2. MPLAB XC8 Compiler (Optional for C Programming)
3. MPASM Assembler
4. MPLAB SIM (Simulator)
5. Device-Specific Header Files and Libraries
PROCEDURE
Create a New Project:
• Copy and paste the above assembly code into the file.
• MPLAB IDE will compile your assembly code and generate a hex file.
• Verify the results of the arithmetic operations by checking the content of the registers using a
simulator or debugger in MPLAB IDE.
PROGRAM:
ADDITION SUBTRACTION & MULTIPLICATION
OUTPUT:
PROGRAM: DIVISION
N1 EQU 71
QUO EQU 72
REM EQU 73
ORG 30
MAIN: MOVLW D'20' ;W=20 ->Load WREG with the dividend value 20
MOVWF N1 ;N1=WREG -> Store WREG content to N1
MOVLW 07 ;W=20 ->Load WREG with the divisor value 07
CLRF QUO ;QUO-0
GOTO $
END
OUTPUT:
RESULT
Thus, the program for addition, subtraction, multiplication and division using PIC18 microcontroller
were performed and results were verified.
EXPT NO: 910 LOGICAL OPERATIONS USING PIC MICROCONTROLLER
AIM
To write an assembly language program to perform logical operations using PIC18 microcontroller.
HARDWARE/SOFTWARE REQUIRED
1. MPLAB X IDE
2. MPLAB XC8 Compiler (Optional for C Programming)
3. MPASM Assembler
4. MPLAB SIM (Simulator)
5. Device-Specific Header Files and Libraries
PROCEDURE
Create a New Project:
• Copy and paste the above assembly code into the file.
• MPLAB IDE will compile your assembly code and generate a hex file.
• Verify the results of the arithmetic operations by checking the content of the registers using a
simulator or debugger in MPLAB IDE.
PROGRAM:
MAIN: MOVLW 5A ;Load WREG with the value 5AH (first operand)
ANDLW 33 ;Perform logical AND with the value 33H (second operand)
MOVWF RAND ;Store the WREG content (AND result) into RAND
COMF RXOR,W
MOVWF RNOT ;Store the WREG content (NOT result) into RNOT
GOTO MAIN
END ; End of program
OUTPUT:
RESULT
Thus, the program for logical operations (AND, OR, XOR, NOT) using PIC18 microcontroller were
performed and results were verified.
EXPERIMENTS
BEYOND THE
SYLLABUS
EXPT NO: 11 7 SEGMENT LED DISPLAY USING 8086
AIM :
To develop programs for displaying fixed message and rolling message using 8086 Microprocessor.
APPARATUS REQUIRED:
ALGORITHM :
MEMORY VALUE
ADDRESS
RESULT:
Thus the program to display the rolling message “ HELP US “ in the display was verified and
executed successfully.
EXPT NO: 12 STEPPER MOTOR INTERFACING USING 8086
AIM:
To write an assembly language program in 8086 to rotate the motor at different speeds.
APPARATUS REQUIRED:
STEPPER MOTOR
PROGRAM
Memory Label Mnemonics comments
address
L1 MOV DI,1200 Initialize DI register as 1200
MOV CL,04 Assign count as 4
L2 MOV AL,[DI] Move the content of DI to AL
OUT C0,AL Move AL value to port C0
CALL DELAY Call delay
INC DI Increment DI register
LOOP L2 Go to loop L2
JMP L1 Jump to loop L3
DELAY MOV BX,0ABCD Speed of the motor is varied here
L3 DEC BX Decrement BX register
JNZ L3 Jump on no zero go to loop L3
RET Restart the system
OUTPUT
OUTPUT
MEMORY VALUE EMORY VALUE
ADDRESS ADDRESS
RESULT:
Thus, the program for stepper motor is rotated in clockwise and anticlockwise direction at
different speed is rotated successfully.