Professional Documents
Culture Documents
1 A)
ORG 0000H
CLR A
loop: MOV DPTR,#SINE ; moving dptr to where my data table content is
MOV R1,#24 ; moving 24 to r1
LAB1:MOVC A,@A+DPTR ; takes value from look up table in the
accumalator
MOV P1,A ; output value in pin 1
CLR A ; Reseting the accumalator
INC DPTR ; increasing dptr
DJNZ R1,LAB1 ; jump to LAB1 if r1 is not zero
SJMP loop ; doing this task repeatadely
ORG 0300H
SINE:
DB
255,250,237,217,191,160,127,94,63,37,17,4,0,17,37,63,94,127,127,160,
191, 217,237,250,255
END
4 b)
ORG 0000H
CLR A
loop: MOV DPTR,#SQUARE ; moving dptr to where my data table content
is
MOV R1,#2 ; moving 2 to r1
LAB1:MOVC A,@A+DPTR ; takes value from look up table in the
accumalator
MOV P1,A ; output value in pin 1
CLR A ; Reseting the accumalator
INC DPTR ; increasing dptr
DJNZ R1,LAB1 ; jump to LAB1 if r1 is not zero
SJMP loop ; doing this task repeatadely
ORG 0300H
SQUARE:
DB 255,0,255
END