看你的程序,你的电路图应该是这样的吧(用P2.0做片选)
锯齿波源程序如下:
ORG 0000H
AJMP START
ORG 0050H
START: MOV DPTR,#0FEFFH
LP: MOV A,#00H
LP1: MOVX @DPTR,A
INC A
AJMP LP1
END
三角波源程序如下:
ORG 0000H
AJMP START
ORG 0050H
START: MOV DPTR,#0FEFFH
TRI: MOV A,#00H
UP: MOVX @DPTR,A
INC A
CJNE A,#0FFH,UP
DOWN: MOVX @DPTR,A
DEC A
CJNE A,#00H,DOWN
LJMP UP
END