We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 5
Waveform generator (DAC) using 8051 MO
Aim:
> To generate square wave, staircase wave, triangular wave and sine wave using
8051 micro-controller.
OBJECTIVE:
> To interface a DAC to the 8051.
> To generate a square wave on the scope using the DAC.
> To generate a staircase wave on the scope using the DAC.
> To generate a triangular wave on the scope using the DAC.
> To generate a sine wave on the scope using the DAC.
SOFTWARE AND HARDWARE REQUIRED:
> 8051 IDE Assembler
> ISP Programmer software.
> 89852 ISP programmer hardware.
> Target / demonstration board
CIRCUIT DIAGRAM:
+
3
2
Pio 2
put "
8 feeds sew,
a
P16 6 or
4 fone
SE opt
wononrnyo
tevRATE STAIRCASE WAVE USING DAC 2
;Here DAC 0808 is connected to port 1 of 8051.
sTo check Staircase wave you can connect output to CRO, |
Org 00h
start: mov a,#00 smove zero to accumulator
loop: mov pl,a smove (accumulator) to port 1
add a,#33h sadd 33 to accumulator
mov rl,#0ffh sdelay
delay: djnz rl,delay
cjne a,#32h,loop —_;compare (acc) with 32
jmp start
Prog2: TO GENERATE TRIANGLE WAVE USING DAC
ORG 00H
mov a,#0 smove zero to accumulator
up: mov pla smove (accumulator) to port 1
inca ;increment the (accumulator)
cjne a,#0ffh,up ;compare (accumulator) with ff
down: dec a ;decrement the (accumulator)
mov pl,a smove (accumulator) to port 1
cjne a,#00,down ;compare (accumulator) with 0
sjmp up jrepeat againPOP 07h ; restore R7 to original value &
RET ; return from subroutine
END
TO GENERATE SINE WAVE OF 200Hz USING DAC
Org 00h
mov 10,#08 slook up table is stored in internal RAM
mov @r0,#7eh
inc r0
mov @r0,#9fh
inc r0
mov @r0,#0bfh
inc 10
mov @r0,#0d9h
inc r0
mov @r0,#0feh
inc r0
mov @r0,#0fah
inc r0
mov @r0,#0ffh
inc 10
mov @r0,#0fah
inc r0
mov @r0,#0eeh
inc r0
mov @r0,#0d9h
inc r0mov @r0,#0bfh
inc r0
mov @r0,#9fh
inc r0
mov @r0,#7eh
inc r0
mov @r0,#5eh
inc r0
mov @r0,#3fh
inc 10
mov @r0,#25h
inc r0
mov @r0,#11h
inc r0
mov @r0,#4
inc r0
mov @r0,#0
inc r0
mov @r0,i#4
inc 10.
mov @r0,#1 1h
ine 10
mov @r0,#25h
inc r0
mov @r0,#3fh
inc r0
mov @10,#5eh :
start: mov rl,#18h sload count in rl
mov 10,#08 load starting address of look up table to r0
sget the data from look up table
up: mov a,@r0mov pl,a ;send data to port |
inc r0 sincrement the look up table address
mov 13,#92 sdelay to get 200Hz frequency
loop: djnz 13,loop
djnz rl,up
sjmp start