Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

- - " -

.1
10).'( A/D Flash 2.
R

V ref

1
4

a0

b 0 = a1 + a 2 a 0

V ref

1
2

a1

V ref

V in

V ref
3
4

a2

b1 = a1

4 3- . decoder- :

a2 a1

11

10

01

00

11

10

01

00

a0

a2 a1

a0

5) .' , 15( ?Flash


Vin
.
5) .' , 15( ?Flash
-
.

.2
DAC- .DAC0 ADuC841- '( 30) .
. 256- . Vref 0[V ]
- Timer 1- . 1[m sec]
MOD841 . 11.0592[MHz ] . auto reload mod e
.
;*****************************************************************
; Date
: 7.2.2010
; Student Name : Ariel Malek
039762653
; File
: sawtooth.asm
; Hardware
: Any ADuC8xx based MicroConverter
; Description
: The program use DAC0 to create a Sawtooth wave
;*****************************************************************
$NOMOD51
$INCLUDE (ADUC841.h)
;We use in special peripheral which
;does not exist in 8051 micro
CSEG AT 0000H
JMP MAIN
;_______________________Timer_1 Interrupt____________________________
CSEG AT 001BH
INC DAC0L
RETI
;______________________Main Program__________________________________
CSEG AT 0070H
MAIN:
ANL TMOD, #00001111B
;Set Timer_1 to operate in auto reload
ORL TMOD, #00100000B
; mode
MOV TH1,#0D5H
;Initialize Timer_1 to set DAC period
; to 256 x 43 x Ts = 1[msec]
MOV TL1,#0D5H
;256 - 43 = 213 = 0D5H
MOV DAC0L, #000H
;Initialize DAC0 to 0[V]
ANL DACCON, #01010110B ;Set DAC0 definitions
ORL DACCON, #10101001B
MOV A, #000H
;Initial the counter to 0
SETB ET1
;Enable Timer_1 Interrupt.
SETB TR1
;Starting the timer
SETB EA
;Enable global interrupts.
LOOP: JMP $

;Infinite loop

END

8051- SFR's- debugger- ( 20 ,' 5) .


.SFR's-
$NOMOD51

.3
10) .'( ) ( p 3.2-
SETB P3.2 p -
3.2.

] 5[V

test po int

SETB P3.2
- .
- 0.
5) . , 20(
? JB P3.2 , BITSET.
JB ,test point- : .
test point- 0 -
.BITSET
5) .' 15( ' ,
? JBC P3.2 , BITSET
) JBC ( Jump if Bit set and Clear -
BITSET- ) (Clear .
.4 ) . ( . ,
.
9) . , 15(
AT 0023H

CSEG

RI , RCV _ INT

JB
:
:

RCV _ INT :
; Ignore the Interuupt and return to the program

RETI

, RI .
. CLR RI

( 15 , 8) .
ANL

TMOD , #00001111

ORL

TMOD , #00100000
; set Timer1 to operate in mod e 2

. - B
( 15 , 8) .
; Add two numbers. The first number is stored in R0 and R1 where R0 is the low; order byte. The second number is stored in R2 and R3, and R2 is the low-order
; byte. The resolt is stored in R4 and R5. R4 is low-order byte. Any overflow from
; the last addition is intentionally being ignored.

ADD_NUMBS:
MOV A,R2
ADD A,R0
MOV R4,A
MOV A,R3
ADD A,R1
MOV R5,A
.R2- R 0 carry-
:
ADDC A, R1

You might also like