; stair wave generation
; standard 8051
; 8-bt DAC interfaced on P1
ORG 0H
PORT EQU P1
STEP1 EQU 00H
STEP2 EQU 20H
STEP3 EQU 40H
STEP4 EQU 80H
START: MOV PORT,#0
MAIN:
LCALL STAIRWAVE
SJMP MAIN
STAIRWAVE:
MOV PORT,#STEP1
CALL DELAY_2SEC
MOV PORT,#STEP2
CALL DELAY_2SEC
MOV PORT,#STEP3
CALL DELAY_2SEC
MOV PORT,#STEP4
CALL DELAY_2SEC
RET
DELAY_2SEC:
MOV R0,#20
l2: MOV R1,#250
l1: MOV R2,#250
DJNZ R2,$
DJNZ R1,l1
DJNZ R0,l2
RET
END
Related topics:
8051 Program - 1khz square wave | 8051 Program - 2khz square wave | 8051 Program - 10khz square wave | 8051 Program - pwm | 8051 Program - sine wave | 8051 Program - triangular wave | 8051 Program - sawtooth wave | 8051 Program - memory subroutines | 8051 Program - math subroutines | 8051 Program - conversion subroutines
List of topics: 8051
No comments:
Post a Comment