Saturday, April 30, 2016

8051 Program – sine wave

; sine wave generation
; standard 8051
; 8-bt DAC interfaced on P1
; table value should be calculated based on DAC
; sample count should be adjusted for requirement
ORG 0H
PORT EQU P1
SINESAMPLECOUNT EQU 13
MAIN:
LCALL SINEWAVE
SJMP MAIN
SINEWAVE:
MOV DPTR, #SINETABLE
MOV R2, #SINESAMPLECOUNT
cycle:CLR A
MOVC A, @A+DPTR
MOV PORT, A
INC DPTR
DJNZ R2, cycle
RET
ORG 300H
SINETABLE:
DB 128, 192, 238, 255, 238, 192
DB 128, 64, 17, 0, 17, 64, 128
END



Related topics:
8051 Program - 1khz square wave   |   8051 Program - 2khz square wave   |   8051 Program - 10khz square wave   |   8051 Program - pwm   |   8051 Program - triangular wave   |   8051 Program - sawtooth wave   |   8051 Program - stair wave   |   8051 Program - memory subroutines   |   8051 Program - math subroutines   |   8051 Program - conversion subroutines

List of topics: 8051

No comments:

Post a Comment