Generation of 50 Hz Sinusoidal Waveform

There is a website which gives and generates Sine wave look-up table as per requirement.

link to website: Sine Look-up table Generator

Generation of sinusoidal waveform

Assembly Language Program:

MOV TMOD,#01H ; Move 01H to TMOD to set Timer 0 Mode 1
LOOP: MOV DPTR,#TABLE ; Move the first value of table to DPTR
MOV R0,#51 ; Moving immediate value into R0
L1: CLR A ; Clear the accumulator
MOVC A,@A+DPTR ; Move code byte relative to DPTR to ACC
MOV P1,A ; Move the content of ACC into port P1
INC DPTR ; Increment DPTR
ACALL DELAY ; Call DELAY subroutine
DJNZ R0,L1 ; Decrement R0 and jump to L1 if R0 is not equal to zero
SJMP LOOP ; Short jump to LOOP
DELAY: MOV TL0,#0ADH ; Move ADH to TL0
MOV TH0,#0FEH ; Move FEH to TH0
SETB TR0 ; Set TR0 = 1 to start timer
HERE: JNB TF0,HERE ; Continuously check TF0, if TF0=0 jump to HERE
CLR TR0 ; Clear TR0 = 0 to stop timer
CLR TF0 ; Clear TF0 = 0
RET ; Return to main program

ORG 300H
TABLE: DB 128,143,159,174,188,201,213,224,234,242,248,252,254,255,253,250,245,238,229,219,207,195,181,166,151,135,120,104,89,74,60,48,36,26,17,10,5,2,0,1,3,7,13,21,31,42,54,67,81,96,112
END ; End the program
%d bloggers like this: