找回密码
 注册会员
更新自动建库工具PCB Footprint Expert 2024.04 Pro / Library Expert 破解版

用0832和DAC设计一个信号发生器

[复制链接]
admin 发表于 2012-9-2 07:51:14 | 显示全部楼层 |阅读模式

本文包含原理图、PCB、源代码、封装库、中英文PDF等资源

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本人刚刚入门 ,所以有点水,但是水可以学 不废话了。
要求用0832设计一个数字信号发生器 输出 方波,三角波,梯形波,锯齿波,正弦波
波形幅值—5~+5连续可调 频率可调 设想 用led的亮暗来区别几种波形 用开关选择波形 ,然后 幅值是不是可以用ADC0809的上拉电阻的变化来实现,频率不
知道怎么变 没想法,下面写的是用开关区别波形,接下去 真不知道该怎么写,希望能帮我完善下,最后是能备注,为什么呢,我要的不是结果,是学习过程,备注有利于我看懂程序 (汇编程序)
WL EQU 00H
WH EQU 0FFH

ORG 0000H
LJMP MAIN
ORG 0040H
MAIN: ORL P1,#0FFH
MOV A,P1
JNB ACC.0,P0F
JNB ACC.1,P1F
JNB ACC.2,P2F
JNB ACC.3,P3F
JNB ACC.4,P4F
P0F: LJMP JOB0
P1F: LJMP JOB1
P2F: LJMP JOB2
P3F: LJMP JOB3
P4F: LJMP JOB4
JOB0: MOV DPTR,#0F8FFH
MOV A,#00H
LOOP: MOVX @DPTR,A
INC A
NOP
NOP
JZ MAIN
AJMP LOOP;锯齿波
JOB1: MOV DPTR,#0F8FFH
MOV A,#00H
MOVX @DPTR,A
CALL DELAY
MOV A,#0FFH
MOVX @DPTR,A
CALL DELAY
AJMP MAIN;矩形波
JOB2: MOV DPTR,#0F8FFH
MOV A,#00H
MOVX @DPTR,A
MOV R7,#WL
UP: INC R7
MOV A,R7
MOVX @DPTR,A
CJNE R7,#WH,UP
DOWN: DEC R7
MOV A,R7
MOVX @DPTR,A
CJNE R7,#WL,DOWN
LJMP MAIN;三角波
JOB3:MOV DPTR,#0F8FFH
MOV A,#00H
MOVX @DPTR,A
MOV R7,#WL
UP1: INC R7
MOV A,R7
MOVX @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
DB 25H, 22H, 20H, 1EH, 1CH, 1AH, 18H, 16H
DB 15H, 13H, 11H, 10H, 0EH, 0DH, 0BH, 0AH
DB 09H, 08H, 07H, 06H, 05H, 04H, 03H, 02H
DB 02H, 01H, 00H, 00H, 00H, 00H, 00H, 00H
DB 00H, 00H, 00H, 00H, 00H, 00H, 01H, 02H
DB 02H, 03H, 04H, 05H, 06H, 07H, 08H, 09H
DB 0AH, 0BH, 0DH, 0EH, 10H, 11H, 13H, 15H
DB 16H, 18H, 1AH, 1CH, 1EH, 20H, 22H, 25H
DB 27H, 29H, 2BH, 2EH, 30H, 33H, 35H, 38H
DB 3AH, 3DH, 40H, 43H, 45H, 48H, 4CH, 4EH
DB 51H, 55H, 57H, 5AH, 5DH, 60H, 63H, 66H
DB 69H, 6CH, 6FH, 72H, 76H, 79H, 7CH, 80H
DELAY:
D1MS:MOV R4,249
DL:NOP
NOP
DJNZ R4,DL
RET
END
*滑块验证:
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

QQ|手机版|MCU资讯论坛 ( 京ICP备18035221号-2 )|网站地图

GMT+8, 2024-11-24 08:02 , Processed in 0.058346 second(s), 10 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表