Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
22 views60 pages

Ee3413-Mpmc Record

The document outlines the practical laboratory work for the Microprocessor and Microcontroller course (EE3413) for second-year engineering students. It includes a bonafide certificate, a list of experiments involving 8085 and 8051 microprocessors, and detailed algorithms and assembly language programs for various operations such as addition, subtraction, multiplication, division, and sorting of arrays. The document serves as a record of the students' practical work during the academic year 2024-2025.

Uploaded by

mothiprabha.g
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)
22 views60 pages

Ee3413-Mpmc Record

The document outlines the practical laboratory work for the Microprocessor and Microcontroller course (EE3413) for second-year engineering students. It includes a bonafide certificate, a list of experiments involving 8085 and 8051 microprocessors, and detailed algorithms and assembly language programs for various operations such as addition, subtraction, multiplication, division, and sorting of arrays. The document serves as a record of the students' practical work during the academic year 2024-2025.

Uploaded by

mothiprabha.g
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/ 60

BACHELOR OF ENGINEERING

DEPARTMENT OF ELECTRICAL & ELECTRONICS


ENGINEERING

EE3413 MICROPROCESSOR AND MICROCONTROLLER


LABORATORY

II Year / 4th SEMESTER

Name :
Register No. :
BONAFIDE CERTIFICATE

Certified that this is the bonafide record work of

Register No. of FOURTH Semester, B.E EE3413


MICROPROCESSOR AND MICROCONTROLLER LABORATORY
during the academic year 2024 – 2025.

STAFF INCHARGE HEAD OF THE DEPARTMENT

Submitted for the practical examination of Bachelor of Engineering held at

SRI VENKATESWARAA COLLEGE OF TECHNOLOGY on

INTERNAL EXAMINER EXTERNAL EXAMINER


INDEX

LIST OF EXPERIMENTS

S. No Date Name of the EXPERIMENTS Page Marks Signature


no

8085 EXPERIMENTS

1a 8bit data addition

1b 8bit data subtraction

1c 8bit data multiplication

1d 8bit data division

2a Largest element in an array

2b Smallest element in an array

2c Sorting an array of data in Ascending order

2d Sorting an array of data in Descending order

2e Decimal to Hexadecimal conversion

2f Hexadecimal to decimal conversion

2g Hexadecimal to ASCII conversion

2h ASCII to Hexadecimal conversion

3a Traffic light controller –Interfacing 8255 with


8085
3b Interfacing Analog to Digital converter 8085
microprocessor
3c Interfacing Digital to Analog converter 8085
microprocessor
4 Stepper motor controller interface
S. No Date Name of the EXPERIMENTS Page Marks Signature
no

8051 EXPERIMENTS
8bit data addition
5a
8bit data subtraction
5b

5c
8bit data multiplication

5d
8bit data division

6
ASCII to Hexadecimal conversion

7a Interfacing A/D and D/A converter with 8051


microcontroller
7b
Traffic light controller – Interfacing with 8051

8
Interfacing stepper motor with 8051
microcontroller
9
Displaying a moving/ rolling message in the
student trainer kit’s output device
10
Programming PIC architecture with software tools
EXP.NO 1 (a) 8-BIT DATA ADDITION

Date:
AIM:

To add two 8-bit numbers stored at consecutive memory locations and also to verify
the result.
APPARATUS REQUIRED:

8085 microprocessor kit, keyboard

ALGORITHM:

1. Initialize memory pointer to data location.


2. Get the first number from memory in accumulator.
3. Get the second number and add it to the accumulator.
4. Store the answer at another memory location.

PROGRAM:

ADDRESS OP CODE MNEMONICS


9000 21 00 95 LXI H, 9500
9003 7E MOV A, M
9004 23 INX H
9005 86 ADD M
9006 23 INX H
9007 77 MOV M, A
9008 76 HLT

INPUT

9500
9501

OUTPUT

9502

RESULT:

1
EXP. NO: 1 (b) 8- BIT SUBTRACTION

Date:

AIM:

To write an assembly language for subtracting two 8-bit numbers by using microprocessor kit.

APPARATUS REQUIRED:

8085 Microprocessor kit, keyboard

ALGORITHM:

1. Initialize the pointer to the memory for data and result.


2. Load the data into A B.
3. Subtract the two data of A and B registers.
4. Store the result into memory from A registers.

ADDRESS OP CODE MNEMONICS


9000 21 00 95 LXI H, 9500
9003 7E MOV A, M
9004 23 INX H
9005 96 SUB M
9006 23 INX H
9007 77 MOV M, A
9008 76 HLT

INPUT
9500
9501

OUTPUT

9502

RESULT:

2
EXP.NO: 1 (c) 8- BIT MULTIPLICATION

Date:
AIM:

To write an assembly language for multiplying two 8-bit numbers by using microprocessor kit.

APPARATUS REQUIRED:

8085 Microprocessor kit, keyboard

ALGORITHM:

1. Initialize the pointer to the memory for data and result.


2. Load the data into A B.
3. Multiply the two data of A and B registers.
4. Store the result into memory from A registers.

PROGRAM:

ADDRESS OP CODE MNEMONICS


9000 3A 00 95 LDA 9500
9003 47 MOV B, A
9004 3A 01 95 LDA 9501
9007 4F MOV C, A
9008 FE 00 CPI 00
900A CA 16 90 JZ 9016
900D AF XRA A
900E 80 ADD B
900F 0D DCR C
9010 CA 16 90 JZ 9016
9013 C3 0E 90 JMP 900E
9016 32 02 95 STA 9502
9019 CF HLT

INPUT
9500
9501

OUTPUT
9502

RESULT:

3
EXP.NO: 1 (d) 8- BIT DIVISION

Date:
AIM:

To write an assembly language for dividing two 8-bit numbers by using microprocessor kit.

APPARATUS REQUIRED:

8085 Microprocessor kit, keyboard

ALGORITHM:

1. Initialize the pointer to the memory for data and result.


2. Load the data into A B.
3. Divide the two data of A and B registers.
4. Store the result into memory from A registers.

PROGRAM:
ADDRESS OP CODE MNEMONICS
9000 3A 01 95 LDA 9501
9003 47 MOV B, A
9004 3A 00 95 LDA 9500
9007 0E 00 MVI C, 00
9009 B8 CMP B
900A DA 12 90 JC 9012
900D 90 SUB B
900E 0C INR C
900F C3 09 90 JMP 9009
9012 32 03 95 STA 9503
9015 79 MOV A, C
9016 32 02 95 STA 9502
9019 76 HLT

INPUT
9500
9501

OUTPUT
9502 (Quotient)
9503 (Remainder)

RESULT:

4
EXP.NO: 2(a) LARGEST ELEMENT IN AN ARRAY

Date:
AIM:

To find the largest element in an array of data stored in memory and also to verify the
result.
APPARATUS REQUIRED:

8085microprocessor kit, keyboard

ALGORITHM:
1. Start the program.
2. Place all the elements of an array in the consecutive memory locations.
3. Fetch the first element from the memory location and load it in the accumulator.
4. Initialize a counter (register) with the total number of elements in an array.
5. Decrement the counter by 1.
6. Increment the memory pointer to point to the next element.
7. Compare the accumulator content with the memory content (next element).
8. If the accumulator content is smaller, then move the memory content
(largest element) to the accumulator. Else continue.
9. Decrement the counter by 1 and repeat steps 5 to 8 until the counter reaches zero
10. Store the result (accumulator content) in the specified memory location.
11. Stop the program.

5
PROGRAM:

ADDRESS OPCODE MNEMONICS COMMENTS


9000 21 00 95 LXI H, 9500 Load data to HL pair
9003 7E MOV A, M Move data pointed by HL to A register
9004 0E 04 MVI C, 04 Move 04 to C register
9006 23 INX H Increment the HL register by 1
9007 BE CMP M Compare HL content with accumulator
and update carry flag
9008 D2 0C 90 JNC 900C Jump on no carry to specified address
900B 7E MOV A, M Move data pointed by HL to A register
900C 0D DCR C decrement the C register by 1
900D 02 06 90 JNZ 9006 Jump on no carry to specified address
9010 32 00 96 STA 9600 Store the result
9013 76 HLT End the program

INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
9500 9600
9501
9502
9503
9504

RESULT:

6
EXP.NO: 2(b) SMALLEST ELEMENT IN AN ARRAY

Date:

AIM:
To find the smallest element in an array of data stored in memory and also to verify the result.

APPARATUS REQUIRED:

8085microprocessor kit, keyboard

ALGORITHM:
1. Start the program.
2. Place all the elements of an array in the consecutive memory locations.
3. Fetch the first element from the memory location and load it in the accumulator.
4. Initialize a counter (register) with the total number of elements in an array.
5. Decrement the counter by 1.
6. Increment the memory pointer to point to the next element.
7. Compare the accumulator content with the memory content (next element).
8. If the accumulator content is smaller, then move the memory content (largest
element) to the accumulator. Else continue.
9. Decrement the counter by 1 and repeat steps 5 to 8 until the counter reaches zero
10. Store the result (accumulator content) in the specified memory location.
11. Stop the program

7
PROGRAM:

ADDRESS OPCODE MNEMONICS COMMENTS

9000 21 00 95 LXI H, 9500 Load data to HL pair


9003 7E MOV A, M Move data pointed by HL to A register

9004 0E 04 MVI C, 04 Move 04 to C register


9006 23 INX H Increment the HL register by 1
9007 BE CMP M Compare HL content with accumulator
and update carry flag

9008 DA 0C 90 JC 900C Jump on carry to specified address


900B 7E MOV A, M Move data pointed by HL to A register

900C 0D DCR C decrement the C register by 1


900D C2 06 90 JNZ 9006 Jump on no carry to specified
address
9010 32 00 96 STA 9600 Store the result
9013 76 HLT End the program

INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
9500 9600
9501
9502
9503
9504

RESULT:

8
EXP.NO: 2(c) SORTING AN ARRAY OF DATA IN ASCENDING ORDER

Date:
AIM:

To sort the given numbers in the ascending order using 8085 microprocessor.

APPARATUS REQUIRED:

8085 microprocessor kit, keyboard

ALGORITHM:

1. Start the program.


2. Get the numbers to be sorted from the memory locations.
3. Compare the first 2 numbers and if the 1st number is larger than 2nd then interchange the number.
4. If the first number is smaller, go to step 5.
5. Repeat steps 2 and 3 until the numbers are in required order.
6. Stop the program.

9
PROGRAM:

ADDRESS OPCODE MNEMONICS COMMENTS


9000 06 00 MVI B, 00 Flag for swapping
9002 21 00 95 LXI H, 9500 Load data to HL pair
9005 4E MOV C, M Load the count into the C reg
9006 0D DCR C If C=1 no process
9007 CA 20 90 JZ 9020 Jump to 9020 (Prog end)
900A 23 INX H Move the memory pointer to start address of
array
900B 7E MOV A, M Get the byte pointed by m ptr
900C 23 INX H Move the m ptr to next byte
900D BE CMP M Compare with Acc
900E DA 18 90 JC 9018 If Acc<m then no swapping
9011 56 MOV D, M Else swap the bytes
9012 77 MOV M, A Get m ptr by A reg
9013 2B DCX H Decrement h reg
9014 72 MOV M, D Get m ptr by D reg
9015 23 INX H Now move m ptr to the next byte
9016 06 01 MVI B, 01 Set the swap
9017 0D DCR C Decrement the count
9019 C2 0B 90 JNZ 900B If c≠0 then jump 900B
901C 05 DCR B After c=0 check the swap flag
901D CA 00 90 JZ 9000 If it is set then once again continue the
process at the final stage B will not set so
exit
9020 76 HLT Break point

INPUT OUTPUT
MEMORY DATA MEMORY DATA
LOCATION LOCATION
9500 05
9501 9501
9502 9502
9503 9503
9504 9504
9505 9505

RESULT:

10
EXP.NO: 2(d) SORTING AN ARRAY OF DATA IN DESCENDING ORDER

Date:

AIM:
To sort the given numbers in the descending order using 8085 microprocessor.
APPARATUSREQUIRED:

8085 microprocessor kit , keyboard

ALGORITHM:

1. Start the program.


2. Get the numbers to be sorted from the memory locations.
3. Compare the first two numbers and if the first number is smaller than
second then inter change the number.
4. If the first number is larger, go to step 5.
5. Repeat steps 2 and 3 until the numbers are in required order.
6. Stop the program.

11
PROGRAM:

ADDRESS OPCODE MNEMONICS COMMENTS


9000 06 00 MVI B, 00 Flag for swapping
9002 21 00 95 LXI H, 9500 Load data to HL pair
9005 4E MOV C, M Load the count into the C reg
9006 0D DCR C If C=1 no process
9007 CA 20 90 JZ 9020 Jump to 9020 (Prog end)
900A 23 INX H Move the memory pointer to start address of
array
900B 7E MOV A, M Get the byte pointed by m ptr
900C 23 INX H Move the m ptr to next byte
900D BE CMP M Compare with Acc
900E DA 18 90 JNC 9018 If Acc<m then no swapping
9011 56 MOV D, M Else swap the bytes
9012 77 MOV M, A Get m ptr by A reg
9013 2B DCX H Decrement h reg
9014 72 MOV M, D Get m ptr by D reg
9015 23 INX H Now move m ptr to the next byte
9016 06 01 MVI B, 01 Set the swap
9017 0D DCR C Decrement the count
9019 C2 0B 90 JNZ 900B If c≠0 then jump 900B
901C 05 DCR B After c=0 check the swap flag
901D CA 00 90 JZ 9000 If it is set then once again continue the
process at the final stage B will not set so
exit
9020 76 HLT Break point

INPUT OUTPUT
MEMORY DATA MEMORY DATA
LOCATION LOCATION
9500 05
9501 9501
9502 9502
9503 9503
9504 9504
9505 9505

RESULT:

12
EXP.NO: 2(e) CODE CONVERSION-DECIMAL TO HEXADECIMAL

Date:
AIM:

To convert a given decimal number to hexadecimal number.


APPARATUS REQUIRED:

8085 microprocessor kit, keyboard

ALGORITHM:

1. Initialize the memory location to the data pointer.


2. Increment B register.
3. Increment accumulator by1 and adjust it to decimal every time.
4. Compare the given decimal number with accumulator value.
5. When both matches, the equivalent hexadecimal value is in B register.
6. Store the resultant in memory location.

13
PROGRAM:

ADDRESS OPCODE MNEMONICS COMMENTS


9000 21 00 95 LXI H, 9500 Initialize HL reg. to 9500H
9003 3E 00 MVI A, 00 Initialize A register
9005 06 00 MVI B, 00 Initialize B register
9007 04 INR B Increment B reg
9008 C6 ADI 01 Increment A reg
900A 27 DAA Decimal Adjust Accumulator
900B BE CMP M Compare M&A
900C C2 07 90 JNZ 9007 If acc and given number are
not equal, then go to 9007
900F 78 MOV A, B Transfer B reg to acc
9010 32 10 95 STA 9501 Store the result in a memory
location
9013 76 HLT Stop the program

INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
9500 9501

RESULT:

14
EXP.NO: 2(f) CODE CONVERSION-HEXADECIMAL TO DECIMAL

Date:

AIM:

To write an assembly language program to convert a given hexadecimal number to decimal number
and also to verify the result.
APPARATUS REQUIRED:

8085 microprocessor kit, keyboard.

ALGORITHM:

1. Initialize the memory location to the data pointer.


2. Increment B register.
3. Increment accumulator by1 and adjust it to decimal every time.
4. Compare the given hexadecimal number with B register value.
5. When both match, the equivalent decimal value is in A register.
6. Store the resultant in memory location.

15
PROGRAM:

ADDRESS OPCODE MNEMONICS COMMENTS


9000 21 00 95 LXI H, 9500 Initialize HL reg. to 9500H
9003 3E MVI A, 00 Initialize A register.
9005 06 00 MVI B, 00 Initialize B register.
9007 0E 00 MVI C, 00 Initialize C register for carry.
9009 04 INR B Increment B reg.
900A C6 01 ADI 01 Increment A reg
900C 27 DAA Decimal Adjust Accumulator
900D D2 11 90 JNC 9011 If there is no carry go to 9011H.
9010 0C INR C Increment c register.
9011 57 MOV D, A Transfer A to D
9012 78 MOV A, B Transfer B to A
9013 BE CMP M Compare M&A
9014 7A MOV A, D Transfer D to A
9015 C2 09 90 JNZ 9009 If acc and given number are not equal, then go to
9009H
9018 32 01 95 STA 9501 Store the result in a memory location
901B 79 MOV A, C Transfer C to A
901C 32 02 95 STA 9502 Store the carry in another memory location
901F 76 HLT Stop the program

INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
9500 9501
9502

RESULT:

16
EXP.NO: 2(g) CODE CONVERSION–HEXADECIMAL TO ASCII

Date:

AIM:

To write an assembly language program to covert the given Hexadecimal number into its

ASCII equivalent and to verify the result.

APPARATUS REQUIRED:

8085 microprocessor kit, keyboard.

ALGORITHM:

1. Load the Hexadecimal number from the location


2. Separate the nibbles
3. Convert each nibble to its ASCII Equivalent.
4. Add the two converted values
5. Display the result Step
6. Stop

17
PROGRAM:

ADDRESS OPCODE MNEMONICS COMMENTS


9000 21 00 95 LXI H, 9500 Initialize HL reg. to 9500H
9003 7E MOV A, M Acc <- (9500) hex byte
9004 47 MOV B, A B <- A
9005 23 INX H Now HL = 9501
9006 0F RRC Bring the higher nibble of acc
9007 0F RRC Bring the higher nibble of acc
9008 0F RRC Bring the higher nibble of acc
9009 0F RRC Bring the higher nibble of acc
900A CD 15 90 CALL 9015 Now convert the higher nibble to ASCII
900D 77 MOV M, A Store that ASCII at 9501H
900E 23 INX H Now HL=9502H
900F 78 MOV A, B A<- B
9010 CD 15 90 CALL 9015 Now convert the lower nibble to ASCII
9013 77 MOV M, A Store that ASCII at 9502H
9014 CF RST 1 Break point
9015 E6 0F ANI 0F Mask the higher nibble
9017 FE 0A CPI 0A Check is it greater than 9
9019 DA 1E 90 JC 901E If A not >9 then simply add 30
901C C6 07 ADI 37 If A is >9 then add 37 to get the respective ASCII
901E C6 30 ADI 30
9020 76 HLT Stop the program

INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
9500 9501
9502

RESULT:

18
EXP.NO: 2 (h) CODE CONVERSION–ASCII TO HEXADECIMAL

Date:

AIM:

To write an assembly language program to covert the given ASCII number into its Hexadecimal

equivalent and to verify the result.

APPARATUS REQUIRED:

8085 microprocessor kit, keyboard.

ALGORITHM:

1. Load the ASCII number from the location


2. Check for the digit or alphabet
3. Using suitable logic and instructions convert the ASCII number into Hexadecimal
4. Add the two converted values
5. Display the result
6. Stop

19
PROGRAM

ADDRESS OPCODE MNEMONICS COMMENTS


9000 3A 00 95 LDA 9500 Load the memory content to Accumulator
9003 D6 30 SUI 30 Subtract with 30
9005 FE 0A CPI 0A Compare with OA
9007 DA 0C 90 JC 900C If carry skip
900A D6 07 SUI 07 Subtract with 07
900C 32 01 95 STA 9501 Store Accumulator content
900F 76 HLT Stop

INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
9500 9501

Result:

20
EXP.NO 3 (a) INTERFACING ANALOG TO DIGITAL CONVERTER

Date:

AIM:
To write an assembly language program to convert an analog signal into a digital
signal using an ADC interfacing.
APPARATUS REQUIRED:

SL.NO ITEM SPECIFICATION QUANTITY


1. Microprocessor kit 8085 1
2. Power Supply +5Vdc, +12Vdc 1
3. ADC Interface board - 1

PROBLEM STATEMENT:
The program is executed for various values of analog voltage which are set with the help
of a potentiometer. The LED display is verified with the digital value that is stored in a memory
location.
THEORY:
An ADC usually has two additional control lines: the SOC input to tell the ADC when to
start the conversion and the EOC output to announce when the conversion is complete. The
following program initiates the conversion process, checks the EOC pin of ADC 0809 as to
whether the conversion is over and then inputs the data to the processor. It also instructs the
processor to store the converted digital data at RAM location.

ALGORITHM:

1. Select the channel and latch the address.


2. Send the start conversion pulse.
3. Read EOC signal.
4. If EOC =1 continue else go to step (3)
5. Read the digital output.
6. Store it in a memory location.

PROGRAM:

ADDRESSS OPCODE MNEMONICS COMMENTS

9000 3E 10 MVI A, 10 Select channel


9002 D3 C8 OUT C8 Send through output port

21
9003 3E 18 MVI A, 18 Load accumulator with value for ALE
low
9005 D3 C8 OUT C8 Send through output port
9006 3E 01 MVI A, 01 Store the value to make SOC high in
the accumulator
9008 D3 00 OUT 00 Send through output port
9009 AF XRA A
900A AF XRA A Introduce delay

900B AF XRA A
900C 3E 00 MVI A, 00 Store the value to make SOC low the
accumulator
900E D3 D0 OUT D0 Send through output port
900F 14 INR D
9010 E6 01 ANI 01 Read the EOC signal from port
&check for end of conversion
9012 FE 01 CPI 01

9014 C2 0F 90 JNZ 900F If the conversion is not yet


completed, read EOC signal from
port again
9017 0C INR C Read data from port
9018 32 00 95 STA 9500 Store the data
901B 76 HLT Stop

ANALOG DIGITALDATA ON LED HEXCODE IN MEMORY


VOLTAGE(V) DISPLAY LOCATION

RESULT:

22
EXP.NO 3 (b) INTERFACING DIGITAL TO ANALOG CONVERTER

Date:

AIM:

1. To write an assembly language program for digital to analog conversion


2. To convert digital inputs into analog outputs & to generate different waveforms
APPARATUS REQUIRED:

SL.NO ITEM SPECIFICATION QUANTITY


1. Microprocessor kit 8085 1
2. Power Supply +5V, dc, +12Vdc 1
3. DAC Interface board - 1

PROBLEM STATEMENT:
The program is executed for various digital values and equivalent analog voltages are
measured and also the waveforms are measured at the output ports using CRO.

THEORY:
Since DAC0800 is an 8bit DAC and the output voltage variation is between–5v and
+5v. The output voltage varies in steps of10/256 =0.04 (approximately). The digital data input
and the corresponding output voltages are presented in the table. The basic idea behind the
generation of waveforms is the continuous generation of analog output of DAC. With 00 (Hex)
as input to DAC2 the analog output is –5v. Similarly with FF H as input, the output is +5v.
Outputting digital data 00 and FF at regular intervals, to DAC2, results in a square wave of
amplitude 5v. Output digital data from 00 to FF in constant steps of 01 to DAC2. Repeat this
sequence again and again. As a result, a saw-tooth wave will be generated at
DAC2output.Output digital data from 00 to FF in constant steps of 01 to DAC2.Output digital
data from FF to 00 in constant steps of 01 to DAC2.Repeat this sequence again and again. As a
result, a triangular wave will be generated at DAC2 output.

ALGORITHM:

Measurement of analog voltage:

1. Send the digital value of DAC.


2. Read the corresponding analog value of its output.

Waveform generation:

Square Waveform:
1. Send low value (00) to the DAC.
2. Introduce suitable delay.

23
3. Send high value to DAC.
4. Introduce delay.
5. Repeat the above procedure.
Saw-tooth waveform:
1. Load low value (00) to accumulator.
2. Send this value to DAC.
3. Increment the accumulator.
4. Repeat step (2) and (3) until accumulator value reaches FF.
5. Repeat the above procedure from step 1.
PROGRAM:
Measurement of Analog Voltage

PROGRAM COMMENTS

MOV A, 7FH Load digital value 00 in accumulator


OUT C0 Send through output port
HLT Stop

Measurement of Analog Voltage

DIGITALDATA ANALOGVOLTAGE
FF 5V
00 0V

Triangular waveform:

1. Load the low value (00) in accumulator.


2. Send this accumulator content to DAC.
3. Increment the accumulator.
4. Repeat step2 and 3 until the accumulator reaches FF, decrement the accumulator
and send the accumulator contents to DAC.
5. Decrementing and sending the accumulator contents to DAC.
6. The above procedure is repeated from step (1)

24
PROGRAM: SQUARE WAVE
ADDRESSS OPCODE PROGRAM COMMENTS

9000 3E 00 MVI A, 00 Load 00 in accumulator


9002 D3 C8 OUT C8 Send through output port
9003 CD 0A 90 CALL 900A Give a delay
9005 3E 0F MVI A,0F Load 0F in accumulator
9007 D3 C8 OUT C8 Send through output port
9008 CD 0A 90 CALL 900A Give a delay
9009 C3 00 90 JMP 9000 Go to starting location
900A 06 05 MVI B, 05 Load count value 05 in B
register
900B 0E 0F MVI C, 0F Load count value 0F in B
register
900C 0D DCR C Decrement C register
900E C2 0C 90 JNZ 900C Return to 900C
900F 05 DCR B Decrement B register
9010 C2 0B 90 JNZ 900B Return to 900B
9012 C9 RET Return to main program

PROGRAM: SAWTOOTH WAVE


ADDRESSS OPCODE PROGRAM COMMENTS
9000 3E 00 MVI A, 00 Load 00 in accumulator
9002 D3 C0 OUT C0 Send through output port
9003 3C INR A Increment contents of
accumulator
9004 C2 02 90 JNZ 9002 Send through output port
until it reaches FF
9007 C3 00 90 JMP 9000 Go to starting location

PROGRAM: TRIANGULAR WAVE


ADDRESSS OPCODE PROGRAM COMMENTS

9000 2E 00 MVI L, 00 Load00in accumulator


9002 7D MOV A, L Move contents of L to A
9003 D3 C8 OUT C8 Send through output port

25
9004 0C INR C Increment contents of
accumulator
9005 C2 02 90 JNZ 9002 Send through output port until it
reaches FF
9008 0E FF MVI C, FF Load FF in accumulator
9009 7D MOV A, L Move contents of L to A
900A D3 C8 OUT C8 Send through output port
900B 0D DCR C Decrement contents of
accumulator
900C C2 09 90 JNZ 9009 Send through output port until it
reaches 00
900F C3 00 90 JMP 9000 Go to starting location

MODELGRAPH:

Square Waveform Saw-toothwaveform


Amplitude Amplitude

Triangular waveform
Amplitude

26
RESULT OF WAVEFORM GENERATION:

WAVEFORMS AMPLITUDE TIMEPERIOD

Square Waveform
Saw-tooth
waveform
Triangular
waveform

RESULT:

27
EXP.NO 3(c) TRAFFIC LIGHT CONTROLLER-
INTERFACING PPI 8255 WITH 8085

Date:

AIM:
To design traffic light controller using 8085 microprocessor through programmable
Peripheral interface 8255.

APPARATUS REQUIRED:

8085pkit, 8255 Interface board, DC regulated power supply, VXT parallel bus,
Traffic light controller interface board.

I/O MODES:
MODE0–SIMPLEI/O MODE:
This mode provides simple I/O operations for each of the three ports and is suitable for
synchronous data transfer. In this mode all the ports can be configured either as input or output
port.
Let us initialize port A as input port and port B as output port

Control Word:

28
PROGRAM:

ADDRESS OPCODE MNEMONICS COMMENTS


9000 LXI H, 9500 Load the data in HL register pair
9003 MVI C, 04 Move 04 to c register
9005 MOV A, M Move M to A
9006 OUT CNT Out to control register
9008 INX H Increment HL register pair
9009 MOV A, M Move M to A
900A OUT CPRT Send control status word
900C INX H Increment h register
900D MOV A, M Move M to A
900E OUT BPRT Send control status word
9010 INX H Increment h register
9011 MOV A, M Move M to A
9012 OUT APRT Send control status word
9014 CALL 901F Call subroutine
9017 INX H Increment h register
9018 DCR C Decrement C register
9019 JNZ 9009 Jump on no zero to 9009
901C JMP 9000 Jump to start
901F PUSH B Do PUSH operation
9020 MVI C, 0D Move OD to C register
9022 LXI D, FF Load D register with FF
9025 DCX D Decrement D register
9026 MOV A, D Move D contents to A register
9027 ORA E OR the content of A with E
9028 JNZ 9025 Jump on no zero to 9025
902C JNZ 9022 Jump on no zero to 9022
902F POP B Do pop operation
9030 RET Return to main program

29
MODE1 STROBED I/OMODE:
In this mode, port A and port B are used as data ports and port C is used as control
signals for strobed I/O data transfer.
Let us initialize port A as input port inmode1
BSRMODE (Bit Set Reset mode)

Any lines of port c can be set or reset individually without affecting other lines using this mode.
Let us set PC0 and PC3 bits using this mode.

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 step3 till counter becomes 0
7. Stop

RESULT:

30
EXP.NO 4 STEPPER MOTOR INTERFACING WITH 8085

Date:

AIM:
To operate stepper motor by interfacing with 8085 microprocessor.

THEORY:

Stepper Motor
A stepper motor is a device that translates electrical pulses into mechanical movement in steps of
fixed step angle.
The stepper motor rotates in steps in response to the applied signals.
It is mainly used for position control.
It is used in disk drives, dot matrix printers, plotters and robotics and process control circuits.
Structure
Stepper motors have a permanent magnet called rotor (also called the shaft) surrounded by a stator.
The most common stepper motors have four stator windings that are paired with a center-tap. This
typeofsteppermotoriscommonlyreferredtoasafour-phaseorunipolarsteppermotor. The center tap
allows a change of current direction in each of two coils when a winding is grounded, thereby
resulting in a polarity change of the stator.
Interfacing
Even a small stepper motor requires a current of 400 mA for its operation. But the ports of the
microcontroller cannot source this much amount of current. If such a motor is directly connected to
the microprocessor/microcontroller ports, the motor may draw large current from the ports and
damage it. So, a suitable driver circuit is used with the microprocessor/microcontroller to operate the
motor.
Motor Driver Circuit (ULN2003)
Stepper motor driver circuits are available readily in the form of ICs.ULN2003 is one such driver
IC
Motor Driver Circuit (ULN2003)
Stepper motor driver circuits are available readily in the form of ICs. ULN2003 is one such driver
IC which is a High-Voltage High-Current Darlington transistor array and can give a current of
500mA.Thiscurrent is sufficient to drive a small stepper motor. Internally, it has protection diodes
used to protect the motor from damage due to back emf and large eddy currents. So, thisULN2003
is used as a driver to interface the stepper motor to the microprocessor.
31
Operation
The important parameter of a stepper motor is the step angle. It is the minimum angle through
which the motor rotates in response to each excitation pulse. In a four phase motor if there are 200

steps in one complete rotation then then the step angle is 360/200 = 1.8O . So to rotate the stepper
motor we have to apply the excitation pulse. For this the controller should send a hexadecimal code

Through one of its ports. The hexcode mainly depends on the construction of the stepper motor.
So, all the stepper motors do not have the same Hex code for their rotation. (refer the operation
manual supplied by the manufacturer.)
For example , let us consider the hex code for a stepper motor to rotate in clockwise direction is 77H
,BBH, DDH and EEH. This hex code will be applied to the input terminals of the driver through
the assembly language program. To rotate the stepper motor in anti-clockwise direction the same
code is applied in the reverse order.

32
33
PROGRAM:

ADDRESS OPCODE MNEMONICS COMMENTS

Initialize lookup table address


9000 21 00 92 LXI H, 9200

9003 06 04 MVI B, 04 Load the total count


Load first data from lookup
9005 7E MOV A, M
table
9006 D3 C0 OUT C0H; Sent to motor via port of 8255
Load DE register pair with
9008 11 03 03 LXI D,0303H
delay count
900B 00 NOP NO Operation

900C 1B DCX D Decrement D E register pair

900D 7B MOV A, E Copy E reg to A register


Take logic OR with A and D register
900E B2 ORA D
Wait for delay loop to
900F C2 0B 90 JNZ 900B
complete
9012 23 INX H Increment HL register pair

9013 0B DCR B Decrement B register

9014 C2 05 90 JNZ 9005 Check for repetitions


Keep the motor rotating
9017 C3 00 90 JMP 9000
continuously.
LOOKUP TABLE

9200 09

05

06

0A

34
PROCEDURE:

1. Enter the above program starting from location 4100 and execute the same.

2. The stepper motor rotates.


3. By varying the count at C and D register can vary the speed.
4. By entering the data in the look-up TABLE in the reverse order can vary
direction of rotation.

RESULT:

35
EXP.NO 5 (a) 8-BITADDITION

Date:
AIM:

To write a program to add two 8-bit numbers using 8051 microcontroller and also
to verify the result.

APPARATUS REQUIRED:

8051 microcontroller kit, keyboard.

ALGORITHM:

1. Clear Program Status Word.

2. Select Register bank by giving proper values to RS1&RS0 of PSW.

3. Load accumulator A with any desired8-bit data.

4. Load the register R0 with the second 8-bitdata.

5. Add these two8-bit numbers.

6. Store the result.

7. Stop the program.

36
PROGRAM:

ADDRESS LABEL MNEMONIC OPERAND HEX CODE COMMENTS


9000 MOV A, 14 74 14 Get the data1 in
Accumulator
9002 ADD A, #25 24 25 Add the data1 with
data2
9004 MOV DPTR,# 90 95 00 Initialize the memory
9500 location
9007 MOVX @ DPTR, A F0 Store the result in
memory location
9008 L1 SJMP L1 80 FE Stop the program

OUTPUT
MEMORYLOCATION DATA

9500

RESULT:

37
EXP.NO 5 (b) 8-BITSUBTRACTION

Date:

AIM:

To perform subtraction of two 8 bit data using the 8051 microcontroller and store
the result in memory.

APPARATUS REQUIRED:

8051 microcontroller kit, keyboard.

ALGORITHM:

1. Clear the carry flag.


2. Initialize the register for borrow.
3. Get the first operand into the accumulator.
4. Subtract the second operand from the accumulator.
5. If a borrow results increment the carry register.
6. Store the result in memory.

38
PROGRAM:

ADDRESS LABEL MNEMONIC OPERAND HEXCODE COMMENTS


9000 MOV A, # 08 74 08 Store data 1 in
accumulator
9002 SUBB A, # 07 94 07 Subtract data 2 from
data 1
9004 MOV DPTR, # 9500 90 95 00 Initialize memory
location
9007 MOVX @DPTR, A F0 Store the difference
in memory location
9008 L1 SJMP L1 80 FE Stop

OUTPUT
MEMORY LOCATION DATA

9500

RESULT:

39
EXP.NO 5 (c) 8-BITMULTIPLICATION

Date:

AIM:

To perform multiplication of two 8 bit data using 8051 microcontroller and to store
the result in memory.

APPARATUSREQUIRED:

8051microcontroller kit , keyboard.

ALGORITHM:

1. Get the multiplier in the accumulator.


2. Get the multiplicand in the B register.
3. Multiply A with B.
4. Store the product in memory.

40
PROGRAM:

ADDRESS LABEL MNEMONIC OPERAND HEX CODE COMMENTS


9000 MOV A, #04 74 04 Storedata1in
accumulator
9002 MOV B, #02 75 02 Storedata2 in B reg

9004 MUL AB A4 Multiply both

9005 MOV DPTR, # 9500H 90 95 00 Initialize memory


location
9008 MOVX @ DPTR, A F0 Store lower order
result
9009 INC DPTR A3 Goto next memory
location
900A MOV A,B E5 0B
Store higher order
900C MOVX @ DPTR, A F0 result

900D STOP SJMP STOP 80 FE Stop

Data1:04
Data2:02

OUTPUT
MEMORY LOCATION DATA
9500
9501

RESULT:

41
EXP.NO 5 (d) 8-BIT DIVISION

Date:

AIM:

To perform division of two 8 bit data using 8051 microcontroller and to store the result
in memory.

APPARATUS REQUIRED:

8051 microcontroller kit, keyboard.

ALGORITHM:

1. Get the Dividend in the accumulator.


2. Get the Divisor in the B register.
3. Divide A by B.
4. Store the Quotient and Remainder in memory.

42
PROGRAM:

ADDRESS LABEL MNEMONIC OPERAND HEX COMMENTS


CODE
9000 MOV A, # 08 74 08 Store data1 in
accumulator
9002 MOV B, # 02 75 0B 02 Store data2 in B reg

9005 DIV AB 84 Divide

9006 MOV DPTR, # 9500H 90 95 00 Initialize memory


location
9009 MOVX @ DPTR, A F0 Store remainder

900A INC DPTR A3 Goto next memory


location
900B MOV A, B E5 0B
Store quotient
900D MOV @ DPTR, A F0

900E STOP SJMP STOP 80 FE Stop

Data1:08
Data2:02

OUTPUT
MEMORY LOCATION DATA
9500 (Remainder)
9501 (Quotient)

RESULT:

43
EXP.NO 6 ASCII TO HEXADECIMAL CONVERSION

Date
AIM:

To add two 8 bit numbers stored at consecutive memory locations and also to verify
the result.

APPARATUS REQUIRED:

8085 microprocessor kit, keyboard

ALGORITHM:

1. Initialize R0 with number which is required to find equivalent Hexadecimal number code.

2. Compare it with 40Hand jump to label1if it is equal.

3. Compare the carry bit to find which is greater and lesser.

4. If the carry bit is not set(it implies it is greater) jump to label2.

5. If it is lesser subtract the number with 30H.

6. If it is greater subtract the number with 37H.

44
PROGRAM:

ADDRESS OPCODE LABEL MNEMONICS OPERAND COMMENT


9000 78 41 START MOV R0,#41 Move the numbers
9002 E8 MOV A,R0 to be converted
9003 84 40 00 CJNE A,#40,LABEL1 Compare the no
with 40H
9006 50 05 LABEL1 JNC LABEL2 If the number is
greater than 40H
jump to LABEL2
9008 C3 CLRC
9009 94 30 SUBB A,#30 If the number is
less than 40
subtractwith30H
900B 80 03 SJMP STOP
900D C3 LABEL2 CLRC
900E 94 37 SUBB A,#37 If the number is
less than 40
subtractwith37H
9010 00 STOP END

INPUT OUTPUT
ADDRESS DATA ADDRESS DATA

RESULT:

45
EXP.NO 7 (a) INTERFACING DAC WITH 8051

Date:

AIM:

To interface DAC with 8051to demonstrate the generation of square wave, triangular
wave and saw tooth wave

APPARATUSREQUIRED:

8051 microcontroller kit, keyboard, 8051Trainer Kit, DAC interface board

ALGORITHM:

SQUAREWAVEGENERATION:
1. Move the port address of DAC to DPTR
2. Load the initial value 00 to accumulator and move it to DAC
3. CALL THE DELAY PROGRAM
4. Load the final value FF to accumulator and move it to DAC
5. Call the delay program
6. Repeatsteps2to5
SAWTOOTH WAVEGENERATION:
1. Move the port address of DAC to DPTR
2. Load the initial value 00 to accumulator
3. Move the accumulator content to DAC
4. Increment the accumulator content by1.
5. Repeat Steps 3 and 4

46
TRIANGULAR WAVE GENERATION
1. Move the port address of DAC to DPTR
2. Load the initial value (00)to Accumulator
3. Move the accumulator content to DAC
4. Increment the accumulator content by 1.
5. If accumulator content is zero proceed to next step. Else go to step 3.
6. Load value(FF) to Accumulator
7. Move the accumulator content to DAC
8. Decrement the accumulator content by 1.
9. If accumulator content is zero go to step2.Else go to step 7.

PROGRAM:

(A) Square Wave Generation

Address Label Mnemonics Opcode Comments


ORG 4100H
MOV DPTR,PORT MOV DPTR,PORT
ADDRESS OF DAC
START MOV A,#00 Clear Accumulator
MOVX@DPTR,A Move A DPTR
LCALLDELAY Call delay
MOV A,#FF Load FF A
MOVX@DPTR,A Move A DPTR
LCALLDELAY Call delay
LJUMPSTART Jump to start
DELAY: MOV R1,#05

LOOP: MOV R2,#FF


HERE: DJNZ R2,HERE
Delay loop
DJNZ R1,LOOP
RET Return and jump to start
SJMP START

47
(B) SAWTOOTH WAVE GENERATION

Address Label Mnemonics Opcode Comments


ORG 4100H
MOV DPTR,PORT MOV DPTR,PORT
ADDRESS OF DAC
START MOV A,#00 Clear Accumulator
LOOP MOVX@DPTR,A Move A DPTR
INC A Increment A
SJMP LOOP Jump to location loop

(C) TRIANGULARWAVE GENERATION

Address Label Mnemonics Opcode Comments


ORG 4100H
MOV DPTR,PORT MOV DPTR,PORT
ADDRESS OF DAC
START MOV A,#00 Clear Accumulator
LOOP1 MOVX@DPTR,A Move A DPTR
INC A Increment A
JNZ LOOP1 Jump not zero to location
loop1
MOV A,#FF Load FF A
LOOP2: MOVX @DPTR,A Move A DPTR
DEC A Decrement A
JNZ LOOP2 Jump not zero to location
loop2
LJMP START
Delay loop

RESULT:

48
EXP.NO 7(b) TRAFFIC LIGHT CONTROLLER –INTERFACING WITH 8051

Date:

AIM:
To design traffic light controller using 8051 microcontroller

APPARATUSREQUIRED:

8051 kit, DC regulated power supply, Traffic light controller interface board.

ALGORITHM:

1. Start.
2. Write the data for each direction and load it into theP0
3. Initialize a counter to indicate the number of directions.
4. Call the delay program and repeat the process.

PROGRAM:

ADDRESS OPCODES LABEL MNEMONICS OPERAND COMMENTS


ORG 0000h
MOVP0 #0D4H
ACALL DELAY1
MOVP0 #53H
ACALL DELAY1
MOVP0 #04DH
ACALL DELAY1
MOVP0 #35H
ACALL DELAY1
DELAY1 MOVR2 #42D
MOVR1 #40D
MOVR0 #30D
LOOP1 DJNZ R0,LOOP1
LOOP2 DJNZ R1,LOOP2
LOOP3 DJNZ R2,LOOP3
RET

RESULT:

49
EXP.NO 8 STEPPER MOTOR INTERFACING WITH 8051

Date:

AIM:
To operate stepper motor by interfacing with8051 microcontroller.
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 step-wise manner from one equilibrium position
to the next. Stepper Motors are used very wisely in position control systems like printers, disk
drives, process control machine tools, etc.

The basic two-phase stepper motor consists of two pairs of stator poles. Each of the four
poles has its own winding. The excitation of any one winding generates a North Pole. A South
Pole gets induced at the diametrically opposite side. The rotor magnetic system has two end
faces. It is a permanent magnet with one face as South Pole and the other as North Pole.

The Stepper Motor windings A1,A2, B1, B2 are cyclically excited with a DC current to
run the motor in clockwise direction. By reversing the phase sequence as A1, B2, A2, B1,
anticlockwise stepping can be obtained.

2-PHASE SWITCHING SCHEME:


In this scheme, any two adjacent stator windings are energized. The switching scheme is
shown in the table given below. This scheme produces more torque.

ANTICLOCKWISE CLOCKWISE
STEP A1 A2 B1 B2 DATA STEP A1 A2 B1 B2 DATA
1 1 0 0 1 9h 1 1 0 1 0 Ah
2 0 1 0 1 5h 2 0 1 1 0 6h
3 0 1 1 0 6h 3 0 1 0 1 5h
4 1 0 1 0 Ah 4 1 0 0 1 9h

ADDRESS DECODING LOGIC:

The 74138 chip is used for generating the address decoding logic to generate the device
select pulses, CS1&CS2forselectingtheIC74175.The74175latchesthedatabustothestepper motor
driving circuitry.

Stepper Motor requires logic signals of relatively high power. Therefore, the interface
circuitry that generates the driving pulses use silicon darlington pair transistors. The inputs for
the interface circuit are TTL pulses generated under software control using the Microcontroller
Kit. The TTL levels of pulse sequence from the data bus is translated to high voltage output
pulses using a buffer 7407 with open collector.

50
PROGRAM:

Mnemonics
Address Label Operand Comments

ORG 4100h

START: MOV DPTR, Load the start


#TABLE address of switching
scheme data TABLE
into Data Pointer
(DPTR)
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
PUSH DPL Stack
MOV DPTR, Load the Motor port
#0FFC0h address into DPTR
MOVX @DPTR,A Send the value in A
to stepper Motor port
address
MOV R4, #0FFh Delay loop to cause
DELAY: MOV R5, #0FFh a specific amount of
DELAY1: DJNZ R5, DELAY1 time delay before
DJNZ R4, DELAY next data item is
sent
to the Motor
POP DPL POP back DPTR
POP DPH value from Stack
INC DPTR Increment DPTR to
point to next item in
the table
DJNZ R0, LOOP Decrement R0,if not
zero repeat the loop
SJMP START Short jump to Start
of the program to
make the motor
rotate continuously
TABLE: DB 0905060Ah Values as per two-
phase switching
scheme

51
PROCEDURE:

1. Enter the above program starting from location 4100 and execute the same. The
stepper motor rotates.
2. By varying the countatR4 andR5can vary the speed.
3. By entering the data in the look-up TABLE in the reverse order can vary
direction of rotation.

RESULT:

52
EXP.NO 9 DISPLAYING A MOVING/ ROLLING MESSAGE USING 8051

Date:

AIM:
To display a moving/rolling message "WELCOME" using the 8051 microcontroller.

APPARATUS REQUIRED:

8051 kit, DC regulated power supply, Traffic light controller interface board.
PROGRAM:

ADDRESS OPCODES LABEL MNEMONICS OPERAND COMMENTS


START Entry point of the program
Initialize memory locations for
message
Load accumulator with ASCII
74 57H MOV A, #57H #57H
code for 'W'
Initialize starting position on
75 00H MOV P0, #00H #00H
display
Loop for displaying the moving
LOOP
message
Move current display position to
E6 MOV A, P0
A
Move character from A to
F6 MOV @R0, A
current display
04 INC A Increment display position
75 F0H MOV P0, #F0H #F0H Move display position leftwards
A3 INC R0 Increment memory pointer
CJNE R0, #07H, Check if end of message, skip if
B4 07H #07H
SKIP not
80 F6H SJMP LOOP Jump back to loop
SKIP Skip point if end of message
Reset memory pointer to
A3 MOV R0, #00H #00H
beginning
END End of program

This table outlines an assembly language program for displaying a moving/rolling message
"WELCOME" using the 8051 microcontroller. It initializes the memory locations with the
characters of the message, then continuously moves the message across the display.

53
ALGORITHM:
1. Start.
2. Initialize the memory locations with the ASCII codes for each character of the message
"WELCOME".
3. Set the starting position on the display to the first character of the message.
4. Enter a loop to continuously display the moving message.
5. Move the current display position to the accumulator.
6. Move the character from the memory location pointed by the memory pointer to
the current displayposition.
7. Increment the display position to move the message.
8. Move the display position leftwards to create the effect of a moving message.
9. Increment the memory pointer to point to the next character of the message.
10. Check if the end of the message has been reached.
11. If not, repeat the loop by jumping back to step 4.
12. If the end of the message has been reached, reset the memory pointer to the beginning of
the message.
13. End the program.

OUTPUT:

MEMORY INPUT VALUES MEMORY OUTPUT VALUES


ADDRESS ADDRESS

RESULT:

54
EXP.NO 10 . PROGRAMMING PIC ARCHITECTURE WITH SOFTWARE TOOLS.

Date:

AIM:
To create an assembly language program for a PIC microcontroller using MPLAB X IDE
that blinks an LED connected to pin RB0 in a continuous loop.

APPARATUS REQUIRED:

1. PIC microcontroller (such as PIC16F877A)


2. LED
3. Current-limiting resistor (if needed)
4. Breadboard
5. Connecting wires
6. Power supply or battery pack
7. MPLAB X IDE software (for programming the PIC microcontroller)
8. PICkit programmer (for programming the microcontroller)
9. Computer or laptop for running MPLAB X IDE and programming the microcontroller.

ALGORITHM :

1. Initialize the microcontroller and configure the I/O pins.


2. Set the direction of the pin connected to the LED as output.
3. Enter a loop to continuously toggle the state of the LED.
4. Turn the LED on by setting the corresponding pin high.
5. Implement a delay to control the blinking rate.
6. Turn the LED off by setting the pin low.
7. Implement another delay.
8. Repeat the loop indefinitely.

55
PROGRAM:

ADDRESS OPCODES LABEL MNEMONICS OPERAND COMMENTS


Start of program memory
START Start of main program
BANKSEL TRISB Select bank for TRISB register
0186 BSF TRISB,0 Set RB0 pin as output
LOOP Start of loop
0185 BSF PORTB,0 Turn on LED connected to RB0
CALL DELAY Call delay subroutine
0184 BCF PORTB,0 Turn off LED connected to RB0
CALL DELAY Call delay subroutine
2802 GOTO LOOP Jump to LOOP
DELAY Start of delay subroutine
3000 MOVLW 0xFF Load W register with delay count
00FE MOVWF COUNT Move W to COUNT register
DELAY_L Start of delay loop
OOP
18FF DECFSZ COUNT,F Decrement COUNT
280C GOTO DELAY_LOOP Continue loop if COUNT is not
zero
0009 RETURN Return from subroutine
End of program

This table provides a structured representation of the assembly language program for the PIC
microcontroller, including memory addresses, opcodes , labels, mnemonics, operands, and
comments.

RESULT :

56

You might also like