0% found this document useful (0 votes)
7 views

MICROCONTROLLER & INTERFACING LAB OBSERVATION

R.M.D. Engineering College aims to provide quality technical education and research, focusing on developing competent Electronics and Communication Engineers. The department's mission includes fostering academic excellence, promoting industry collaboration, and encouraging innovative teaching methods. The course on Microcontroller and Interfacing covers microprocessor architecture, assembly language programming, and practical experiments to enhance students' technical skills.

Uploaded by

nikshi773
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

MICROCONTROLLER & INTERFACING LAB OBSERVATION

R.M.D. Engineering College aims to provide quality technical education and research, focusing on developing competent Electronics and Communication Engineers. The department's mission includes fostering academic excellence, promoting industry collaboration, and encouraging innovative teaching methods. The course on Microcontroller and Interfacing covers microprocessor architecture, assembly language programming, and practical experiments to enhance students' technical skills.

Uploaded by

nikshi773
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 62

R.M.D.

ENGINEERING COLLEGE
(An Autonomous Institution)
RSM NAGAR, KAVARAIPETTAI – 601 206

GUMMIDIPOONDI TALUK, THIRUVALLUR DISTRICT.

DEPARTMENT OF ELECTRONICS AND COMMUNICATION


ENGINEERING

22EC502 –MICROCONTROLLER AND INTERFACING


(LAB INTEGRATED)

2022 REGULATION

III YEAR – V SEM

NAME :

REG NO :

SECTION :
Vision of the Institution

RMDEC aspires to be a premier institution offering quality technical education and


research with application expertise in Engineering and Technology.

Mission of the Institution

• Develop the students as outstanding professionals by creating an environment that


would nurture creativity, academic excellence, professionalism, high standard of ethics,
sense of responsibility and respect for individuals.
• Provide an efficient academic and research environment.
• Interact with corporate, industries and research institutions to work on collaborative
projects and sponsored research.
• Establish center of excellence to impart Domain Specific industry skills.
• Encourage the faculty to excel in their teaching and research careers.
• Contribute more to the education and training of rural folk as societal obligation.

Vision of the Department

To offer effective technical education to contribute to the global industrial development


and socio -economic well-being of competent Electronics and Communication Engineers.

Mission of the Department

• To produce competent engineers to face challenges of the society by providing


conducive academic learning environment.
• To facilitate and encourage the students and faculty members to excel in research
activities.
• To promote industry institute collaboration and develop the application skills of
the students.
• To adopt innovative teaching and learning methodologies that leads to self-
improvement of students.
• To develop sound technical knowledge, professional ethics, entrepreneurial and
leadership skills among students.
PROGRAMME EDUCATIONAL OBJECTIVES:
PEO1: To enable graduates to pursue research, or have a successful career in
academia or industries associated with Electronics and Communication
Engineering, or as entrepreneurs.

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:

Engineering Graduates will be able to:

1. Engineering knowledge: Apply the knowledge of mathematics, science,


engineering fundamentals, and an engineering specialization to the solution
of complex engineering problems.

2. Problem analysis: Identify, formulate, review research literature, and


analyze complex engineering problems reaching substantiated conclusions
using first principles of mathematics, natural sciences, and engineering
sciences.

3. Design/development of solutions: Design solutions for complex


engineering problems and design system components or processes that meet
the specified needs with appropriate consideration for the publichealth and
safety, and the cultural, societal, and environmental considerations.

4. Conduct investigations of complex problems: Use research-based


knowledge and research methods including design of experiments, analysis
and interpretation of data, and synthesis of the information to provide valid
conclusions.

5. Modern tool usage: Create, select, and apply appropriate techniques,


resources, and modern engineering and IT tools including prediction and
modeling to complex engineering activities with an understanding of the
limitations.

6. The engineer and society: Apply reasoning informed by the contextual


knowledge to assess societal, health, safety, legal and cultural issues and the
consequent responsibilities relevant to the professional engineering practice.
7. Environment and sustainability: Understand the impact of the
professional engineering solutions in societal and environmental contexts,
and demonstrate the knowledge of, and need for sustainable development.
8. Ethics: Apply ethical principles and commit to professional ethics and
responsibilities and norms of the engineering practice.

9. Individual and team work: Function effectively as an individual, and as a


member or leader in diverse teams, and in multidisciplinary settings.

10. Communication: Communicate effectively on complex engineering


activities with the engineering community and with society at large, such
as, being able to comprehend and write effective reports and design
documentation, make effective presentations, and give and receive clear
instructions.

11. Project management and finance: Demonstrate knowledge and


understanding of the engineering and management principles and apply
these to one’s own work, as a member and leader in a team, to manage
projects and in multidisciplinary environments.

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.

PROGRAM SPECIFIC OBJECTIVES (PSOs)

1. To analyze, design and develop solutions by applying foundational


concepts of electronics and communication engineering.
2. To apply design principles and best practices for developing quality
products for scientific and business applications.
3. To adapt to emerging information and communication technologies (ICT)
to innovate ideas and solutions to existing/novel problems.
22EC502 MICROCONTROLLER AND INTERFACING (LAB INTEGRATED) LTPC
3 043

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:

On successful completion of this course, the student will be able to


CO1: Acquire knowledge on the architecture of 8085 and 8086 Microprocessor.
CO2: Analyze the architecture, addressing modes and instruction set of 8051 Microcontroller.
CO3: Evaluate the program of 8051 in assembly language for the given operations.
CO4: Interpret the program by using timer, interrupt and serial ports/parallel ports.
CO5: Interface the memory and I/O devices to 8051 Microcontroller.
CO6: Explore the architecture of PIC Microcontroller.
INDEX
EXPT DATE TITLE OF THE EXPERIMENT PAGE SIGNATURE
NO NO
8085 Microprocessor Experiments
1 Arithmetic and Logical operations using 8085
1.a 8 Bit addition
1.b 8 Bit subtraction
1.c 8 Bit multiplication
1.d 8 Bit division
1.e Logical operations

8086 Microprocessor Experiments


2 Arithmetic and Logical operations using 8086
2.a 8 Bit addition
2.b 8 Bit subtraction
2.c 8 Bit multiplication
2.d 8 Bit division
2.e Logical operations

8051 Microcontroller Experiments

3 One’s and two’s complement of a number using 8051


4 Block data transfer using 8051
5 Arithmetic and Logical Operations using 8051
5.a Arithmetic Operations
5.b Logical Operations

Interfacing with 8051


6 Timer/Counter Interface using 8051
7 7-Segment LED display using 8051
8 Stepper Motor Interfacing using 8051

PIC Microcontroller Experiments


9 Arithmetic operations using PIC Microcontroller
10 Logical operations using PIC Microcontroller

Experiments Beyond the Syllabus


11 7-Segment LED display using 8086
12 Stepper Motor Interfacing using 8086
8085 MICROPROCESSOR EXPERIMENTS
ARITHMETIC AND LOGICAL OPERATIONS

EXPT NO: 1.a 8 BIT ADDITION

Aim:

To write an assembly language program for addition of two 8-bit data using 8085 microprocessor.

Apparatus required:

1. 8085 microprocessor kit.

2. Keyboard and power chord.

Algorithm:

1. Clear the register C


2. Initialize the memory pointer to data location.
3. Get the first Data from memory Location and move to register A.
4. Get the second data from memory location.
5. Add first and second data.
6. If carry the increment the register C by one.
7. Store the result to memory location.

Flow Chart:
Program:

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

MVI C,00 Clear the “C” Register


LXI H,4200 Initialize the memory pointer
MOV A,M Move the First Data to A Register
INX H Increment the memory pointer
ADD M Add First and Second Data
JNC L1 Jump if No Carry to loop1
INR C Increment the “C” register by one
L1 STA 4203 Store the Result
Move the Carry result to Register
MOV A,C “A”
STA 4204 Store the Carry Result
HLT Stop the program

INPUT OUTPUT

Address Data Address Data

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:

1. 8085 microprocessor kit-1

2. Keyboard and power chord-1

Algorithm:

1. Clear the register “C”


2. Initialize the memory pointer to data location.
3. Get the first Data from memory Location and move to register “A”.
4. Get the second data from memory location.
5. Subtract the first and second data.
6. If occur carry the increment the register ‘c’ by one.
7. Store the result to memory location.

Flow Chart:
Program:

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

MVI C,00 Clear the “C” Register


LXI H,4200 Initialize the memory pointer
MOV A,M Move the First Data to A
Register
INX H Increment the memory pointer
SUB M Subtract First and Second Data
JNC LOOP Jump if No Carry to loop1
INR C Increment the “C” register by
One
LOOP STA 4203 Store the Result
MOV A,C Move the Carry result to
Register “A”
STA 4204 Store the Carry Result
HLT Stop the program

INPUT OUTPUT

Address Data Address Data

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:

1. 8085 microprocessor kit-1

2. Keyboard and power chord-1.

Algorithm:

1. Clear the register “A”


2. Initialize the memory pointer to data location.
3. Get the first Data from memory Location and move to register “C”.
4. Get the second data from memory location.
5. Add the Memory Data and A Register.
6. Decrement the register ‘c’ by one
7. Check the register “C’ is Zero otherwise repeat step 5.
8. Store the result to memory location.

Flow Chart:
Program:

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

MVI A,00 Clear the “A” Register


LXI H,4200 Initialize the memory pointer
MOV C,M Move the First Data to C Reg
INX H Increment the memory pointer
LOOP ADD M Add First and Second Data
DCR C Decrement C register by one
JNZ LOOP Jump if No Zero to loop1
STA 4203 Store the Result
HLT Stop the program

INPUT OUTPUT

Address Data Address Data

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:

1. 8085 microprocessor kit-1

2. Keyboard and power chord-1.

Algorithm:

1. Clear the Register “C”.


2. Initialize the Memory Pointer.
3. Get the First Data from memory to Accumulator ( Dividend)
4. Get the Second Data from memory (Divisor)
5. Compare Register “A” and “M”
6. If No carry, Subtract Divisor from Dividend [(A)-(M)]
7. Increment Register “C” by one.
8. Compare Register “A” and “M”
9. If No Carry go to step 6
10. Store the result to memory location.
Flow Chart:
Program:

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

MVI C,00 Clear the “C” Register


LXI H,4200 Initialize the memory pointer
MOV A,M Move the First Data to A
Register
INX H Increment the memory pointer
CMP M Compare register A and M
data’s
JC L1 If carry jump to loop1
L2 SUB M Subtract register A and M Data
INR C Increment C register by one
CMP M Compare register A and M
data’s
JNC L2 Jump if No Carry to loop2
L1 STA 4203 Store the Quotient Result
MOV A,C Move register C to A
STA 4204 Store the Remainder Result
HLT Stop the program

INPUT OUTPUT

Address Data Address Data

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:

1. 8085 microprocessor kit-1

2. Keyboard and power chord-1

Algorithm:

1. Get two input data.

2. Perform all logical operation between two data.

3. Move the result from A register to output memory location.

4. Stop the program.

Flow Chart:
Program:

AND OPERATION

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

LDA 4500 Load the first data in A register


MOV B,A Move the A register content to B
register
LDA 4501 Load the second data

ANA B Perform AND operation


STA 4502 Store the A register value in 4502
HLT End

INPUT OUTPUT

Address Data Address Data

OR OPERATION

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

LDA 4500 Load the first data in A register


MOV B,A Move the A register content to B
register
LDA 4501 Load the second data

ORA B Perform OR operation


STA 4502 Store the A register value in 4502
HLT End

INPUT OUTPUT

Address Data Address Data


AND OPERATION

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

LDA 4500 Load the first data in A register


MOV B,A Move the A register content to B
register
LDA 4501 Load the second data

XRA B Perform XOR operation


STA 4502 Store the A register value in 4502
HLT End

INPUT OUTPUT

Address Data Address Data

NOT OPERATION

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

LDA 4500 Load the data in A register


CMA Complement A register content
STA4501 Store the result in 4501

HLT End

INPUT OUTPUT

Address Data Address Data

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:

1. 8086 microprocessor kit.

2. Keyboard and power chord.

Algorithm:

1. Get two input data.

2. Perform addition operation between two data.

3. If there is no carry jump on loop L1, else increment CX register.

4. Move the sum result from AX register into output memory location.

5. Move the carry result from CX register into output memory location

6. Stop the program.

Flow Chart:
Program:

Memory Label Mnemonics Comments


Address
MOV CX,0000H Initialize counter CX
MOV AX,[1200H] Get the first data in AX register
MOV BX,[1202H] Get the second data in CX register
Add first data and second data
ADD AX,BX and store it in AX register
JNC L1 Check for carry
INC CX If carry exists, increment the CX
L1 Store the sum from AX register
MOV [1204H],AX into 1204 output memory
location
Store the carry from CX register
MOV [1206H],CX into 1206 output memory
location
HLT Stop the program

INPUT OUTPUT

Address Data Address Data

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:

1. 8086 microprocessor kit-1

2. Keyboard and power chord-1

Algorithm:

1. Get two input data.

2. Perform subtraction operation between two data.

3. If there is no carry jump on loop L1, else increment CX register.

4. Move the sum result from AX register into output memory location.

5. Move the carry result from CX register into output memory location

6. Stop the program.

Flow Chart:
Program:

Memory Label Mnemonics Comments


Address
Initialize counter CX
MOV CX,0000H
Get the first data in AX register
MOV AX,[1200H]
Get the second data in BX
MOV BX,[1202H]
register
SUB AX,BX Subtract first data and second
data and store it in AX register
JNC L1 Check for carry
INC CX If carry exists, increment the CX
NOT AX 1‟s complement of AX register
INC AX Increment AX
L1 Store the sum from AX register
MOV [1300H],AX
into 1300 output memory location
Store the carry from CX register
MOV [1302H],CX
into 1302 output memory location
HLT Stop the program

INPUT OUTPUT

Address Data Address Data

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:

1. 8086 microprocessor kit-1

2. Keyboard and power chord-1.

Algorithm:

1. Move the input data from memory to registers AX and BX.

2. Perform multiplication operation between two data.

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.

5. Stop the program.

Flow Chart:
Program:

Memory Label Mnemonics Comments


Address
MOV AX,[1100] Get the first data and move it to
AX register.
MOV BX,[1102] Get the second data and move it to
BX register.
MUL BX Multiply AX and BX.
MOV [1200],AX Store the lower order 16-bits of
result in 1200 memory location.
MOV [1202],DX Store the higher order 16-bits of
result in 1202 memory location.
HLT Stop the program

INPUT OUTPUT

Address Data Address Data

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:

1. 8086 microprocessor kit-1

2. Keyboard and power chord-1.

Algorithm:

1. Get 16-bit dividend in AX register and 16 bit divisor in BX register.

2. Perform division operation between AX and BX.

3. Move quotient from AX to output memory location and remainder from DX to output
memorylocation.

4. Stop the program.

Flow Chart:
Program:

Memory Label Mnemonics Comments


Address
MOV AX,[1100] Move the dividend lower orderto
AX register
MOV BX,[1102] Move the dividend higher orderto
BX register.
DIV BX Divide by BX data
MOV [1200],AX Move the quotient from AX to
1200 memory location
MOV [1202],DX Move the remainder from DX to
1202 memory location.
HLT Stop the program

INPUT OUTPUT

Address Data Address Data

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:

1.8086 microprocessor kit-1

2. Keyboard and power chord-1

Algorithm:

1. Get two input data.

2. Perform all logical operation between two data.

3. Move the result from AX register to output memory location.

4. Stop the program.

Flow Chart:
Program:

Memory Label Mnemonics Comments


Address
MOV AX,[1500] Get the first data and move to AX
MOV BX,[1502] Get the second data and move toBX

MOV CX,AX Move from AX reg to CX reg


AND AX,BX Perform AND operation
MOV [1504],AX Move the result from AX to 1504
output memory location
MOV AX,CX Move data from CX to AX reg
OR AX,BX Perform OR operation
MOV [1506],AX Move the result from AX to 1506
output memory location
MOV AX,CX Move data from CX to AX
XOR AX,BX Perform XOR operation
MOV [1508],AX Move the result from AX to 1508
output memory location
NOT AX Take 1‟s complement of AX reg
MOV [150A],AX Move NOT result from AX to 150A
output memory location
HLT End the program

INPUT OUTPUT

Address Data Address Data

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:

To perform one’s and two’s complement of a number using 8051 microcontroller.

Apparatus required:

1. 8051 microcontroller kit.

2. Keyboard and power chord.

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

Memory Label Mnemonics Comments


Address
MOV DPTR,#4200 Move the first data to data pointer
MOVX A,@DPTR Move the value from data pointer to Acc
CPL A Take one’s complement of a number
INC DPTR Increment DPTR
MOVX @DPTR,A Move value from accumulator to
external Ram location
INC A Increment accumulator
INC DPTR Increment data pointer
MOVX @DPTR,A Move value from accumulator to
external Ram location
HERE SJMP HERE Short jump in same address

INPUT OUTPUT

Address Data Address Data

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:

1. 8051 microcontroller kit-1

2. Keyboard and power chord-1

Algorithm:

1. Initialize Source Address


2. Read Data from Source Address
3. Increment the Source Address
4. Store Source Address in Registers
5. Set Destination Address
6. Push the Destination Address
7. Restore the Source Address
8. Read Next Byte of Data
9. Increment the Source Address
10. Save the Current Source Address
11. Restore the Destination Address
12. Write Data to Destination Address
13. Increment the Destination Address
14. Repeat the Process
15. End the Program

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:

Memory Label Mnemonics Comments


Address
MOV DPTR,#4500 Load the Data Pointer (DPTR) with the source
address 4500H
MOVX A,@DPTR Move the external data at the address in DPTR
into accumulator A
MOV R0,A Move the contents of the accumulator (A) into
register R0
INC DPTR Increment DPTR, so it now points to the next
address, 4501H
MOV R1,DPL Move the low byte of DPTR (DPL) into register R1

MOV R2,DPH Move the high byte of DPTR (DPH) into


register R2
MOV DPTR,#4510 Load the DPTR with destination address 4510H
REPT PUSH DPL Push the low byte of DPTR (DPL) onto the stack.
PUSH DPH Push the high byte of DPTR (DPH) onto the stack.
MOV DPL,R1 Move the contents of R1 into DPL
MOV DPH,R2 Move the contents of R2 into DPH
MOVX A,@DPTR Move the external data at the address in DPTR
into accumulator A
INC DPTR Increment DPTR, so it now points to the next
address.
MOV R1,DPL Move the low byte of DPTR (DPL) into
register R1.
MOV R2,DPH Move the high byte of DPTR (DPH) into
register R2.
POP DPH Pop the high byte of DPTR from the stack
POP DPL Pop the low byte of DPTR from the stack
MOVX @DPTR,A Move the contents of the accumulator (A) into
the external memory at the destination address
pointed by DPTR.
INC DPTR Increment DPTR.
DJNZ R0,REPT Decrement R0, and if it's not zero, jump to the
label REPT
HERE SJMP HERE Jump to the label HERE
INPUT OUTPUT

Address Data Address Data

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:

1. 8051 microcontroller kit.

2. Keyboard and power chord.

Algorithm:

1. Get two registers to move data from memory location.

2. Perform addition/subtraction/multiplication and division operation between two data.

3. Move the result from data pointer to memory registers.

4. Stop the program

Flow Chart:
8 BIT ADDITION
Program:

Memory Label Mnemonics Comments


Address
MOV DPTR,#4200 Move the first data to data pointer

MOVX A,@DPTR Move the value from data pointer


toAccumulator
MOV B,A Move value from acc to B register
INC DPTR Increment DPTR
MOVX A,@DPTR Move the value from data pointer
toAccumulator
ADD A,B Perform addition between A and B

INC DPTR Increment data pointer


MOVX @DPTR,A Move value from Accumulator
toexternal Ram location
HERE SJMP HERE Short jump in same address

INPUT OUTPUT

Address Data Address Data


8 BIT SUBTRACTION

Program:

Memory Label Mnemonics Comments


Address
MOV DPTR,#4200 Move the first data to data pointer
MOVX A,@DPTR Move the value from data pointer to Acc
MOV B,A Move value from acc to B register
INC DPTR Increment DPTR
MOVX A,@DPTR Move the value from data pointer to Acc
SUBB A,B Perform subtraction between A and B
INC DPTR Increment data pointer
MOVX @DPTR,A Move value from Accumulator to external
Ram location
HERE SJMP HERE Short jump in same address

INPUT OUTPUT
Address Data
Address Data

8-BIT MULTIPLICATION

Memory Label Mnemonics Comments


Address
MOV DPTR,#4200 Move the first data to data pointer
MOVX A,@DPTR Move the value from data pointer to Acc
MOV B,A Move value from acc to B register
INC DPTR Increment DPTR
MOVX A,@DPTR Move the value from data pointer to Acc
MUL AB Perform multiplication operation
INC DPTR Increment DPTR
MOVX @DPTR,A Move value from Acc to external Ram
location
MOV A,B Perform subtraction between A and B
INC DPTR Increment data pointer
MOVX @DPTR,A Move value from Accumulator to external
Ram location
HERE SJMP HERE Short jump in same address

INPUT OUTPUT
Address Data Address Data
8 - BIT DIVISION

Memory Label Mnemonics Comments


Address
MOV DPTR,#4200 Move the first data to data pointer

MOVX A,@DPTR Move the value from data pointer


to Accumulator
MOV B,A Move value from acc to B register
INC DPTR Increment DPTR
MOVX A,@DPTR Move the value from data pointer
to Accumulator
DIV AB Perform division operation
INC DPTR Increment DPTR
MOVX @DPTR,A Move value from Acc to external
Ram location
MOV A,B Perform subtraction between A and B

INC DPTR Increment data pointer


MOVX @DPTR,A Move value from
Accumulator to external Ram
location
HERE SJMP HERE Short jump in same address

INPUT OUTPUT

Address Data Address Data

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:

1. 8051 microcontroller kit.

2. Keyboard and power chord.

Algorithm:

1. Get two registers to move data from memory location.

2. Perform logical operation between two data.

3. Move the result from data pointer to memory registers.

4. Stop the program.

FLOW CHART:
PROGRAM:

Memory Label Mnemonics Comments


Address
MOV DPTR,#4200 Move the first data to data pointer

MOVX A,@DPTR Move the value from data


pointer to Accumulator
MOV B,A Move value from accumulator
to B register
INC DPTR Increment DPTR
MOVX A,@DPTR Move value from data pointer
to accumulator
ANL A,B/ORL A,B/XRL Perform logical operation
A,B between Aand B
INC DPTR Increment data pointer
MOVX @DPTR,A Move value from accumulator to
external Ram location
HERE SJMP HERE Short jump in same address
AND OPERATION

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:

1. Mode 0: 13-bit timer mode.

2. Mode 1: 16-bit timer mode (widely used).

3. Mode 2: 8-bit auto-reload mode.

4. Mode 3: Split timer mode (Timer 0 only).

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

Memory Label Mnemonics Comments


Address
MOV TMOD, #01H Set Timer 0 in Mode 1 (16-bit Timer)
MOV TH0, #0FCH Load high byte (for specific delay)

MOV TL0, #18H Load low byte (for specific delay)


SETB TR0 Start Timer 0

AGAIN JNB TF0, AGAIN Wait for overflow


CLR TR0 Stop Timer
CLR TF0 Clear overflow flag
CPL P1.0 Toggle LED connected to P1.0
SJMP AGAIN Repeat

b) COUNTER

Counters in 8051 Microcontroller

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:

• Mode 0: 13-bit counter mode.

• Mode 1: 16-bit counter mode.

• Mode 2: 8-bit auto-reload counter mode.

• Mode 3: Split counter mode (only for Timer 0).

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

Memory Label Mnemonics Comments


Address
MOV TMOD, #05H Set Timer 0 in Mode 1 (16-bit Timer)
SETB TR0 Load high byte (for specific delay)

AGAIN MOV A, TL0 Load low byte (for specific delay)


MOV P2, A Start Timer 0

SJMP AGAIN Repeat

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:

8051 Microprocessor kit, Power supply, Interfacing board.

ALGORITHM :

Display of rolling message “ HELP US “

1. Initialize the counter


2. Set 8279 for 8 digit character display, right entry
3. Set 8279 for clearing the display
4. Write the command to display
5. Load the character into accumulator and display it
6. Introduce the delay
7. Stop

1. Display Mode Setup: Control word-00 H

0 0 0 0 0 0 0 0
0 0 0 D D K K K

DD

00- 8Bit character display left entry

01- 16Bit character display left entry

10- 8Bit character display right entry

11- 16Bit character display right

entry KKK- Key Board Mode

000-2Key lockout.
d c b a dp g f e
Program:

Memory Label Mnemonics Comments


address
MOV DPTR, #FFC2 Store the control word register address
MOV A,#00 Store the control word for display mode
MOVX @DPTR,A Load the control word for display mode
in data pointer
MOV A,#CC Store the control word for clear display
MOVX @DPTR,A Load the control word for clear display in data
pointer
MOV A,#90 Store the control word to write display
MOVX @DPTR,A Load the control word for write display in data
pointer
MOV DPTR, #FFC0 Store the data register address
MOV A,#88 Load the character ‘A’ as data value into
accumulator
MOVX @DPTR,A Store the data in external memory location
MOV R0,#05 Initialize R0 with the value 05H
MOV A,#FF Initialize accumulator with the value FFH
LOOP MOVX @DPTR,A Move the accumulator value to external
memory location
DJNZ R0,LOOP Decrement R0 and jump to LOOP if it's
not zero
HERE SJMP HERE Stop

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:

8051 TRAINER KIT

STEPPER MOTOR INTERFACE BOARD

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:

For running stepper motor clockwise and anticlockwise directions

(i) Get the first data from the lookup table.


(ii) Initialize the counter and move data into accumulator.
(iii) Drive the stepper motor circuitry and introduce delay
(iv) Decrement the counter is not zero repeat from step(iii)
(v) Repeat the above procedure both for backward and forward directions.

SWITCHING SEQUENCE OF STEPPER MOTOR:


PROGRAM
Memory Label Mnemonics Comments
address
Initialize a counter with the No. of
START MOV R4, # 32 sequence required to produce one
revolution
Move DPTR with the memory address
MOV DPTR, # 4200
having clockwise sequence
L2 LCALL L1 Call the loop L1 for 4-step sequence
Check for the completion of one
DJNZ R4, L2
revolution, if not completed go to loop L2
Delay between forward and reverse
LCALL DELAY
rotation
Initialize a counter with the No. of
MOV R4, # 32 sequence required to produce one
revolution
Move DPTR with the memory address
L3 MOV DPTR, # 4300
having Anticlockwise sequence
LCALL L1 Call the loop L1 for 4-step sequence
Check for the completion of one
DJNZ R4, L3
revolution, if not completed go to loop L3
Delay between forward and reverse
LCALL DELAY
rotation
SJMP START Start from beginning
L1 MOV R0, # 04 Load the count in R0
LOOP MOVX A, @ DPTR Load the number in Table into A
PUSH DPH
Push DPTR value to stack
PUSH DPL
MOV DPTR, # FFC0 Load the Motor port address into DPTR
MOV R2, # 04
L7 MOV R1, # 05
L6 MOV R3, # FF Delay loop to cause a specific amount
of time delay before next data item is
L4 DJNZ R3, L4 sent to the motor
DJNZ R1, L6
DJNZ R2, L7
MOVX @ DPTR, A
POP DPL
Pop back DPTR value from stack
POP DPH
Increment DPTR to point to next item
INC DPTR
in the table
Decrement R0, if not Zero repeat the
DJNZ R0, LOOP
loop
RET
Short jump to start the program to make
the motor rotate continuously
DELAY MOV R5, #01
L8 MOV R2, #05
L9 DJNZ R2, L8 Delay program
DJNZ R5, L9
RET
CLOCKWISE DIRECTION ANTICLOCKWISE DIRECTION

Memory A1 A2 B1 B2 Hex Memory A1 A2 B1 B2 Hex


location code location code
4200 1 0 0 1 09 4300 1 0 1 0 0A
4201 0 1 0 1 05 4301 0 1 1 0 06
4202 0 1 1 0 06 4302 0 1 0 1 05
4203 1 0 1 0 0A 4303 1 0 0 1 09

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

To write an assembly language program to perform a) Addition, b) Subtraction, c) Multiplication, d)


Division 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:

• Open MPLAB IDE and create a new project.

• Select the PIC18F4550 microcontroller.

• Choose the MPASM assembler as your language tool.

Write the Assembly Code:

• Create a new file with a .asm extension.

• Copy and paste the above assembly code into the file.

Build the Project:

• Build your project by clicking on "Build Project."

• MPLAB IDE will compile your assembly code and generate a hex file.

Observe the Results:

• 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

LIST P=18F4550 ; Specify the PIC18F4550 microcontroller


#include <p18f4550.inc> ; Include the device-specific header file
ORG 0x0000 ; Start of program memory
; Define general-purpose registers in the data memory
CBLOCK 0x20 ; Start address for general-purpose registers
RESULT_ADD ; Register to store addition result
RESULT_SUB ; Register to store subtraction result
RESULT_MUL ; Register to store multiplication result
ENDC
START:
;(a) Addition
CLRF RESULT_ADD ; Clear the RESULT_ADD register
MOVLW 52 ; Load WREG with the value 52H (first operand)
ADDLW 32 ; Add 32H (second operand) to WREG
MOVWF RESULT_ADD ; Store the WREG content (addition result) into RESULT_ADD
;(b) Subtraction
CLRF RESULT_SUB ; Clear the RESULT_SUB register
MOVLW 32 ; Load WREG with the value 52H (first operand)
SUBLW 52 ; Subtract WREG from 32H (second operand
MOVWF RESULT_SUB ; Store the subtraction result in RESULT_SUB
;(c) Multiplication
CLRF RESULT_MUL ; Clear the RESULT_MUL register
MOVLW 02 ; Load WREG with the value 02H (multiplicand)
MULLW 04 ; Multiply WREG with the value 04H (multiplier)where
; PRODH store higher byte and PRODL store lower byte
MOVF PRODL, W ; Move the low byte of the product to WREG
MOVWF RESULT_MUL ; Store the multiplication result in RESULT_MUL
END START

OUTPUT:
PROGRAM: DIVISION

LIST P=18F4550 ; Specify the PIC18F4550 microcontroller


#include <p18f4550.inc> ; Include the device-specific header file
ORG 0
GOTO MAIN

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

UP INCF QUO ;QUO = QUO+1


SUBWF N1 ;N1=N1-WREG -> Subtract WREG from N1
BTFSC STATUS,C ;Check the status of Carry flag
GOTO UP ; If carry flag is set goto up

DECF QUO ;QUO = QUO-1


ADDWF N1,W ;WREG=N1+WREG
MOVWF REM ;REM=N1 -> Store the remainder result in REM

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:

• Open MPLAB IDE and create a new project.

• Select the PIC18F4550 microcontroller.

• Choose the MPASM assembler as your language tool.

Write the Assembly Code:

• Create a new file with a .asm extension.

• Copy and paste the above assembly code into the file.

Build the Project:

• Build your project by clicking on "Build Project."

• MPLAB IDE will compile your assembly code and generate a hex file.

Observe the Results:

• Verify the results of the arithmetic operations by checking the content of the registers using a
simulator or debugger in MPLAB IDE.
PROGRAM:

LIST P=18F4550 ; Specify the PIC18F4550 microcontroller


#include <p18f4550.inc> ; Include the device-specific header file
ORG 00 ; Start of program memory
GOTO MAIN
RAND: EQU 70 ;Register to store AND result
ROR: EQU 71 ;Register to store OR result
RXOR: EQU 72 ;Register to store XOR result
RNOT: EQU 73 ;Register to store NOT result

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

MOVLW 5A ;Load WREG with the value 5AH (first operand)


IORLW 33 ;Perform logical OR with the value 33H (second operand)
MOVWF ROR ;Store the WREG content (OR result) into ROR

MOVLW 5A ;Load WREG with the value 5AH (first operand)


XORLW 33 ;Perform logical XOR with the value 33H (second operand)
MOVWF RXOR ;Store the WREG content (XOR result) into RXOR

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:

8086 Microprocessor kit, Power supply, Interfacing board.

ALGORITHM :

Display of rolling message “ HELP US “

1. Initialize the counter


2. Set 8279 for 8 digit character display, right entry
3. Set 8279 for clearing the display
4. Write the command to display
5. Load the character into accumulator and display it
6. Introduce the delay
7. Repeat from step 1.
Program:

Memory address Label Mnemonics comments


START MOV SI,1200 Initialize Array
MOV CX,000F Initialize array size
MOV AL,10 Store the control word for display
mode
OUT C2,AL Send through output port
MOV AL,0CC Store the control word for clear display
OUT C2,AL Send through output port
MOV AL,90 Store the control word to write display
OUT C2,AL Send through output port
L1 MOV AL,[SI] Get the first data
OUT C0,AL Send through output port
CALL DELAY Give delay
INC SI Go and get next data
LOOP L1 Loop until all the datas have been
taken
JMP START Go to start location
DELAY MOV DX,0ABCD Store 16 bit count value
LOOP2 DEC DX Decrement count value
JNZ LOOP2 Loop until count value becomes zero
RET Return to main program
OUTPUT

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:

8086 TRAINER KIT

STEPPER MOTOR INTERFACE BOARD

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

CLOCKWISE DIRECTION ANTICLOCKWISE DIRECTION

Memory A1 A2 B1 B2 Hex Memory A1 A2 B1 B2 Hex


location code location code
1200 1 0 0 1 09 1200 1 0 1 0 0A
1201 0 1 0 1 05 1201 0 1 1 0 06
1202 0 1 1 0 06 1202 0 1 0 1 05
1203 1 0 1 0 0A 1203 1 0 0 1 09

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.

You might also like