0% found this document useful (0 votes)
31 views4 pages

Waveform Generation

This document describes an assembly language program to generate two waveforms - a 2 Hz square wave on port P0.0 using Timer 1 and a step waveform on port P0. It outlines the algorithm to set the timer for the square wave and use delays to increment through values for the step wave. The code section implements this by configuring the timer for the square wave using TMOD, TL1 and TH1 registers and looping through delayed value changes on port P0 to generate the step wave.

Uploaded by

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

Waveform Generation

This document describes an assembly language program to generate two waveforms - a 2 Hz square wave on port P0.0 using Timer 1 and a step waveform on port P0. It outlines the algorithm to set the timer for the square wave and use delays to increment through values for the step wave. The code section implements this by configuring the timer for the square wave using TMOD, TL1 and TH1 registers and looping through delayed value changes on port P0 to generate the step wave.

Uploaded by

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

Waveform Generation

AIM:

To design an Assembly language program to generate the following wave


forms.
a. Generate 2 Hz square wave on P0.0. use Timer 1 in mode 1. Assume
XTAL = 16MHz.
b. Generate step wave form on P0.

ALGORITHM:

Square wave:
1) Load the TMOD register with 10H
2) Load the TL0 register with CBH
3) And TH0 with 07DH
4) Set the TR0 bit
5) Check for the overflow Flag
6) If , clear TR0 and TF0
7) Complement P0.0
8) Repeat the steps 5 to 7.
STEP WAVE:
1. Load p0 with 00h
2. Delay for sometimes
3. Again load p0 on 55H
4. Delay for sometimes.
5. Load p0 with abh
6. Delay for sometimes
7. Again load p0 on ffH
8. Delay for sometimes.
9. Load p0 with abh
10.Delay for sometimes
11.Again load p0 on 55H
12.Delay for sometimes.
13.Repeat the steps 1 to 13.

CODE:

L2:mov r0,#10
mov tmod,#10h
L1:mov tl1,#0cbh
mov th1,#07dh
setb tr1
L:jnb tf1,L
clr tr1
clr tf1
djnz r0,L1
cpl p0.0
sjmp L2
end

L:
mov p0,#00h
acall delay
mov p0,#055h
acall delay
mov p0,#0abh
acall delay
mov p0,#0ffh
acall delay
mov p0,#0abh
acall delay
mov p0,#055h
acall delay
sjmp L
delay:
mov r1,#0ffh
L1:djnz r1,L1
ret
end

OUTPUT:
VERIFICATION:

RESULT:
Square wave and step wave generate and verified.

INFERENCE:
I understood how to generate the waveform of square and step wave.

You might also like