AD_ALLAN~~~~~.ASM
上传用户:qzt189
上传日期:2020-08-05
资源大小:1k
文件大小:4k
源码类别:

多显示器编程

开发平台:

Visual Basic

  1. ad_buf  equ   30h
  2.                         org     0
  3.                         ljmp    display         ;显示子程序
  4.                         org     3               ;中断0的入口地址
  5.                         ljmp    int00
  6. display:
  7.                         setb    ea              ;开放所有的中断
  8.                         setb    ex0            ;开放0中断
  9.                         mov     r5,#0AAh
  10.          RUN_display:   mov     p0,#0
  11.                         mov     a,#80h
  12.                         mov     p0,a
  13.                         lcall   sel1
  14.                         lcall   delay
  15.                         lcall   sel5
  16.                         lcall   delay
  17.                         dec     r5
  18.                         JC      FLOT
  19.                         mov     r0,#ad_buf      ;R0指向经转换的数据
  20.                         mov     a,@r0
  21.                         mov     dptr,#tab
  22.                         movc    a,@a+dptr
  23.                         mov     p0,a
  24.                         lcall   sel2
  25.                         lcall   delay
  26.                         inc     r0
  27.                         mov     a,@r0
  28.                         mov     r1,a            ;从31h取两次数,
  29.                        swap      a               ;将高低位对调
  30.                         anl     a,#0fh           ;取出次高位的值 来
  31.                         movc    a,@a+dptr
  32.                         mov     p0,a
  33.                         lcall   sel3
  34.                         lcall   delay            ;在LED2上显示次高位的值
  35.                         mov     a,r1             ;将保存在12中的值再倒回来
  36.                         anl     a,#0fh           ;取出最低位的值来
  37.                         movc    a,@a+dptr
  38.                         mov     p0,a
  39.                         lcall   sel4
  40.                         lcall   delay
  41.                         cjne    r5,#1h,qqq
  42.                         ljmp    display
  43.                   qqq  :
  44.                         ajmp    RUN_display
  45. ;*****************************************************************************************
  46. sel1:
  47.                         clr     p2.7
  48.                         clr     p2.6
  49.                         clr     p2.5
  50.                         ret
  51. sel2:                   setb     p2.7
  52.                         clr     p2.6
  53.                         clr     p2.5
  54.                         ret
  55. sel3:                   clr     p2.5
  56.                         setb     p2.6
  57.                         clr     p2.7
  58.                         ret
  59. sel4:                   clr     p2.5
  60.                         setb    p2.6
  61.                         setb     p2.7
  62.                         ret
  63. sel5:                   setb    p2.5
  64.                         clr     p2.6
  65.                         clr     p2.7
  66.                         ret
  67. delay:
  68.                         mov     r4,#022
  69.           lloop3:       mov     r3,#022
  70.           lloop4:       djnz    r3,lloop4
  71.                         djnz    r4,lloop3
  72.                         ret
  73. FLOT:                   mov     a,#80h
  74.                         mov     p0,a
  75.                         lcall   sel2
  76.                         lcall   delay
  77.                         lcall   sel3
  78.                         lcall   delay
  79.                         lcall   sel4
  80.                         lcall   delay
  81.                         LJMP    DISPLAY
  82. ;********************************************************************
  83. int00:                  push    a                ;保护A
  84.                         clr     ea
  85.                         clr     ex0                ;让INT0和中断不能进来
  86.                         mov     r0,#ad_buf
  87.            ad1:         clr     p2.0
  88.                         clr     p2.1
  89.                         mov     a,p1             ;读高8位的值
  90.                         setb    p2.1
  91.                         mov     c,acc.4
  92.                         anl     a,#0fh           ;把A的低4位取出来,实际是将AD最高四位值求出
  93.                         mov     @r0,a
  94.                         inc     r0               ;r0指向下一个单元31H
  95.                         clr     p2.2
  96.                         mov     a,p1
  97.                         setb    p2.2             ;关低位的读入
  98.                         setb    p2.0
  99.                         mov     @r0,a
  100.                         pop     a
  101.                         reti
  102. tab:    db     7eh,0ch,0b6h,9eh,0cch,0dah,0fah,0eh,0feh,0deh,0eeh,0f8h,72h,0bch,0f2h,0e2h,80H
  103.                 ;0,  1,   2,  3,   4,   5,   6,  7,   8,   9,   A,   B,  C,   D,  E,   F