微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 硬件电路设计 > TI模拟硬件电路设计 > 关于51与dac0832连接输出正弦波 非常郁闷

关于51与dac0832连接输出正弦波 非常郁闷

时间:10-02 整理:3721RD 点击:
如题 利用延时可以输出正弦波了 但是改用中断方式 却无法输出波形
利用proteus仿真时 下列程序可以输出正弦波 但是频率只有大概40hz 与设计的100hz差很远
请求指教!
附上程序

FLAG BIT 70H
DA_SC BIT P1.1
ORG 0000H
LJMP MAIN
ORG 000BH
LJMP TIMER0
ORG 0030H
MAIN:
MOV TMOD,00000001B
MOV TH0,#0FFH
MOV TL0,#0dcH
MOV R2,#00H
SETB EA
SETB ET0
SETB TR0
CLR DA_SC
MOV DPTR,#TAB_SIN
LOOP:AJMP LOOP

TIMER0:
CLR TR0
MOV TH0,#0FFH
MOV TL0,#0dcH
MOV R3,A
MOVC A,@A+DPTR
MOV R2,A
MOV A,R3
INC A
MOV P2,R2
;POP PSW
;POP ACC
CPL P1.4
SETB TR0
RETI

TAB_SIN:

DB 080H,083H,086H,089H,08cH,08fH,092H,095H
DB 098H,09cH,09fH,0a2H,0a5H,0a8H,0abH,0aeH
DB 0b0H,0b3H,0b6H,0b9H,0bcH,0bfH,0c1H,0c4H
DB 0c7H,0c9H,0ccH,0ceH,0d1H,0d3H,0d5H,0d8H
DB 0daH,0dcH,0deH,0e0H,0e2H,0e4H,0e6H,0e8H
DB 0eaH,0ecH,0edH,0efH,0f0H,0f2H,0f3H,0f4H
DB 0f6H,0f7H,0f8H,0f9H,0faH,0fbH,0fcH,0fcH
DB 0fdH,0feH,0feH,0ffH,0ffH,0ffH,0ffH,0ffH
DB 0ffH,0ffH,0ffH,0ffH,0ffH,0ffH,0feH,0feH
DB 0fdH,0fcH,0fcH,0fbH,0faH,0f9H,0f8H,0f7H
DB 0f6H,0f5H,0f3H,0f2H,0f0H,0efH,0edH,0ecH
DB 0eaH,0e8H,0e6H,0e4H,0e3H,0e1H,0deH,0dcH
DB 0daH,0d8H,0d6H,0d3H,0d1H,0ceH,0ccH,0c9H
DB 0c7H,0c4H,0c1H,0bfH,0bcH,0b9H,0b6H,0b4H
DB 0b1H,0aeH,0abH,0a8H,0a5H,0a2H,09fH,09cH
DB 099H,096H,092H,08fH,08cH,089H,086H,083H
DB 080H,07dH,079H,076H,073H,070H,06dH,06aH
DB 067H,064H,061H,05eH,05bH,058H,055H,052H
DB 04fH,04cH,049H,046H,043H,041H,03eH,03bH
DB 039H,036H,033H,031H,02eH,02cH,02aH,027H
DB 025H,023H,021H,01fH,01dH,01bH,019H,017H
DB 015H,014H,012H,010H,0fH,0dH,0cH,0bH
DB 09H,08H,07H,06H,05H,04H,03H,03H
DB 02H,01H,01H,00H,00H,00H,00H,00H
DB 00H,00H,00H,00H,00H,00H,01H,01H
DB 02H,03H,03H,04H,05H,06H,07H,08H
DB 09H,0aH,0cH,0dH,0eH,010H,012H,013H
DB 015H,017H,018H,01aH,01cH,01eH,020H,023H
DB 025H,027H,029H,02cH,02eH,030H,033H,035H
DB 038H,03bH,03dH,040H,043H,046H,048H,04bH
DB 04eH,051H,054H,057H,05aH,05dH,060H,063H
DB 066H,069H,06cH,06fH,073H,076H,079H,07cH
END

中断确定设置好了?且进入了中断响应?

CPL P1.4

先测一下P14方波频率是多少?

它除以你的正弦波表个数得到你正弦波的频率

得到的值取实际相比,如果在合理范围内

那就是你的定时时间太小,这个可以通过增加单片机速度或者再减少定时器时间解决

如果仍达不到要求,那只能让正弦波稍失真些,少掉一部分正弦波表

这种调试要找到瓶颈在什么地方

汇编·看的眼花了···

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top