⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ko1.asm

📁 这是个时间显示程序,可以分别调时,分,秒.在调的时候会闪烁,比如调分,分会时亮时灭.可以整点报时,是几点,led亮几下.有闹铃,可以调24小时的闹铃
💻 ASM
字号:
       org  0001h
        ljmp  main
        org  000bh
        ljmp  it0p
        org  0013h
        reti
        org  001bh
        ljmp  it1p
        org  0023h
        reti
  main: mov  tmod,#11h
        mov  20h,#14h
        mov  40h, #59h
        mov  43h,#59h
        mov  44h,#23h
        mov  41h,43h                     
        mov  42h,44h
        mov  r2,#06h
        mov  r6,#02h
        acall  display
        mov   th1,#3ch
        mov  tl1,#0b0h
        mov  th0,#3ch
        mov  tl0,#0b0h
        setb  ea
        setb   et0
        setb   tr0
   start:lcall  display
          jnb  p0.7,setm1
          sjmp  start
   setm1:  ljmp  setm
   here: sjmp  here
display: mov  r1,#40h
         mov  p1,@r1
         inc  r1
         mov  p2,@r1
         inc  r1
         mov  p3,@r1
         ret
   it0p:
         push  a
          push  psw
          mov  th0,#3ch
          mov  tl0,#0b0h
          djnz  20h,return
          mov  20h,#14h
          setb  p0.4
          mov  r0,#40h
          acall   add1
          cjne  a,#60h,return
          mov   @r0,#00h
          mov   r0,#43h
          acall   add1
          cjne  a,#60h,return

          mov   @r0,#00h
          clr  p0.4
          inc  r0
          acall  add1
          cjne  a,#24h,return
          mov  @r0,#00h


   return:   pop psw
             pop  a
             mov  41h,43h
             mov  42h,44h
             acall  display
             reti
     it1p:   push acc
             push  psw
             mov  tl1,#0b0h
             mov   th1,#3ch
             djnz  r2,out1
             mov   r2,#06h
             cpl  02h
             jb   02h,flash1
             mov  41h,43h
             mov  42h,44h

        out1:  pop  psw
               pop acc
               reti
       flash1: jb  01h,flash2
               mov  42h,44h
               mov  41h,#0ffh
               ajmp  out1
       flash2:mov  41h,43h
              mov  42h,#0ffh
              ajmp  out1
        add1: mov  a,@r0
              add   a,#01h
              da a
              mov  @r0,a
              ret
       clr0:  clr  a
              mov   @r0,a
              ret
        setm: clr  et0
              clr  tr0
              mov  r2,#06h
              setb  et1
              setb  tr1
              lcall  ys1
              jnb  p0.7,seth
              setb  00h
        set2: jnb  p0.7,setout
              jb  p0.5,set3
              lcall ys2
        xx:   jnb  p0.5,xx
              mov  r0,#43h
              lcall  add1
              cjne  a,#60h,set2
              lcall  clr0
              ajmp  set2

        seth:
             clr  00h
         g0g0:jnb  p0.7,set5
              setb  01h
        set4: jnb  p0.7,setout
              jb  p0.6,set7
              lcall  ys2
          yy: jnb  p0.6,yy
               mov  r0,#44h
               lcall  add1
               cjne  a,#24h,set4
               lcall  clr0
                ajmp  set4
       setout:  jnb p0.7,setout1
                 lcall  display
                 clr  00h
                 clr  01h
                 clr  02h
                 clr  tr1
                 clr  et1
                 setb  tr0
                 setb  et0
                 ljmp  start
         set3:  lcall  display
                ajmp  set2
         set5:  lcall  display
                ajmp  g0g0
         set7:  lcall   display
                ajmp  set4
         setout1: lcall  display
                  ajmp  setout
          ;延时程序;
         ys1:mov  r5,#64h
             mov  r4,#64h
          ys3:mov  r3,#19h
          pp:djnz  r3,pp
             djnz  r4,ys3
             mov  r4, #64h
             djnz  r5,ys3
             ret

         ys2:mov  r6,#14h
         gg1:mov  r7,#19h
         mm1:djnz  r7,mm1
             djnz  r6,gg1
             ret

             end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -