|
晶振频率11.0592MHZ
源程序如下:
问题是 利用串口调试软件运行时,反复输入U后经采样转换数据不一致,即模拟信号转成数字量的值
跳变太大。。。请教专家!!!
CS BIT P1.1
DOUT BIT P1.2
DIN BIT P1.3
CLK BIT P1.4
ORG 0000H
LJMP MAIN
ORG 1000H
MAIN: MOV SP,#60H
MOV TMOD,#20H
MOV TL1,#0FDH
MOV TH1,#0FDH
MOV SCON,#40H
MOV PCON,#00H
SETB REN
SETB TR1
CLR ET1
SETB EA
REC: JBC RI,SENDWT
AJMP REC
SENDWT: MOV R1,SBUF
CJNE R1,#55H,REC
REP: MOV R0,#30H
MOV SBUF,@R0
REC1: JBC TI,REP5
SJMP REC1
REP5: INC R0
MOV SBUF,@R0
RE1: JBC TI,REP6
SJMP RE1
REP6: MOV R0,#30H
LCALL AD12
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
LCALL AD12
SJMP REC
AD12: SETB CS
CLR CLK
CLR CS
MOV A,#01H
ANL A,#0FH
SWAP A
MOV R2,#08H
AD8: MOV C,DOUT
RLC A
MOV DIN,C
SETB CLK
NOP
NOP
CLR CLK
DJNZ R2,AD8
MOV @R0,A
MOV R2,#04H
CLR C
MOV DIN,C
MOV A,#00H
AD4: MOV C,DOUT
RLC A
SETB CLK
NOP
NOP
CLR CLK
DJNZ R2,AD4
INC R0
MOV @R0,A
SETB CS
INC R0
RET
END
|
|