电子制作天地网站欢迎您的光临,欢迎提出宝贵意见或建议。本站信息产业部备案: 粤ICP备05114582号
D/A 0832 输出正弦波、三角波、锯齿波(查询方式)
单片机与0832输出不同波形

时间:2013-3-4 21:41:42 来源:互联网 作者:不详 编辑: 【关闭


D/A 0832 输出正弦波、三角波、锯齿波(查询方式),单片机与0832输出不同波形

关键字:DAC0832,正弦波,三角波

org 0000h
ajmp main
org 0030h
main:mov   a,#00h
clr p1.0
clr p1.1
jnb p3.0 , zhengxuan
 jnb p3.1,juchi
  jnb p3.2,shanjiao
sjmp MAIN
  shanjiao:
            mov   a,#00h
    clr  p1.0
    clr  p1.1
    loop:
      mov   p0,a
       inc  a
        mov r0,#10h
                 djnz   r0,$
           jnb p3.0 , zhengxuan
 jnb p3.1,juchi      
           sjmp  loop
    ret

juchi:mov   a,#00h
clr p1.0
clr p1.1
up :  mov p0,a
inc a
jnb p3.0 , zhengxuan
  jnb p3.2,shanjiao
jnz up
down: dec a
mov p0,a
jnb p3.0 , zhengxuan
  jnb p3.2,shanjiao
jnz down
sjmp up
ret

 zhengxuan:mov R5,#00h
sin:mov a,r5
clr p1.0
clr p1.1
     mov DPTR,#TAB
     MOVC A,@A+DPTR
     MOV P0,A
     INC R5
 jnb p3.1,juchi
  jnb p3.2,shanjiao
   AJMP  SIN
  TAB: DB 80H,83H,86H,89H,8DH,90H,93H,96H
       DB 99H,9CH,9FH,0A2H,0A5H,0A8H,0ABH,0AEH
       DB 0B1H,0B4H,0B7H,0BAH,0BCH,0BFH,0C2H,0C5H
       DB 0C7H,0CAH,0CCH,0CFH,0D1H, 0D4H,0D6H,0D8H
       DB 0DAH,0DDH,0DFH,0E1H,0E3H, 0E5H,0E7H,0E9H
       DB 0EAH,0ECH,0EEH,0EFH,0F1H, 0F2H,0F4H,0F5H
       DB 0F6H,0F7H,0F8H,0F9H,0FAH, 0FBH,0FCH,0FDH
       DB 0FDH,0FEH,0FFH,0FFH,0FFH, 0FFH,0FFH,0FFH
       DB 0FFH,0FFH,0FFH,0FFH,0FFH, 0FFH,0FEH,0FDH
       DB 0FDH,0FCH,0FBH,0FAH,0F9H, 0F8H,0F7H,0F6H
       DB 0F5H,0F4H,0F2H,0F1H,0EFH, 0EEH,0ECH,0EAH
       DB 0E9H,0E7H,0E5H,0E3H,0E1H, 0DEH,0DDH,0DAH
       DB 0D8H,0D6H,0D4H,0D1H,0CFH, 0CCH,0CAH,0C7H
       DB 0C5H,0C2H,0BFH,0BCH,0BAH, 0B7H,0B4H,0B1H
       DB 0AEH,0ABH,0A8H,0A5H,0A2H, 9FH, 9CH, 99H
       DB 96H, 93H, 90H, 8DH, 89H, 86H, 83H, 80H
       DB 80H, 7CH, 79H, 78H, 72H, 6FH, 6CH, 69H
       DB 66H, 63H, 60H, 5DH, 5AH, 57H, 55H, 51H
       DB 4EH, 4CH, 48H, 45H, 43H, 40H, 3DH, 3AH
       DB 38H, 35H, 33H, 30H, 2EH, 2BH, 29H, 27H
       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
      ret

end


◆相关文章◆
◆ 编辑推荐 ◆
用户:
更多评论
您要为您所发的言论的后果负责,故请各位遵纪守法并注意语言文明。60个字以内
留言:
验证码:

免责声明:
●本站所有内容均来自网络,以学习为目的,如果侵犯了您的利益,请来信告知,立即删除,站长邮件为"diy+dzdiy.com",请将"+"变更为"@"
●电子制作存在风险,请注意人身安全,如果您在根据本站电路进行制作过程中发生伤害,本站不负任何责任。

版权所有:www.dzdiy.com ? 2001-2019 本站信息产业部备案: 粤ICP备05114582号