| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 559 人关注过本帖
标题:求助,关于时钟程序
取消只看楼主 加入收藏
sizedark
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2011-1-12
收藏
 问题点数:0 回复次数:0 
求助,关于时钟程序
源程序是这样的,显示的时候,走5-6秒就不能正确显示了,求助各位高手帮我看下

Time0      Equ       -1000
Disport    Equ       0000H
Csport     Equ       2000H

DisBuf     Equ       79H;...7EH

Sec1000Chg Bit       00H
Sec100Chg  Bit       01H
Csave      Bit       20H

Sec1000    Data      60H
Sec100     Data      61H
Second     Data      62H
Minute     Data      63H
Hour       Data      64H

Asave      Data      6AH
Disptr     Data      6BH
Csptr      Data      6CH
;-------------------------------------------------------
           ORG       0000H
           AJMP      MAIN
;-------------------------------------------------------           
           ORG       000BH
           AJMP      TIME
;-------------------CTC0------------------------------
TIME:      Mov       Tl0,#Low(Time0)
           Mov       Th0,#High(Time0)
           
           Mov       Asave,A
           Mov       Csave,C
           
           Setb      Sec1000Chg
           Djnz      Sec1000,QTime
           Mov       Sec1000,#10
           
           Setb      Sec100Chg
           
           Djnz      Sec100,QTime
           Mov       Sec100,#100
           
           Inc       Second
           Mov       A,Second
           Cjne      A,#60,QTime
           Mov       Second,#0
           
           Inc       Minute
           Mov       A,Minute
           Cjne      A,#60,QTime
           Mov       Minute,#0
           
           Inc       Hour
           Mov       A,Hour
           Cjne      A,#60,QTime
           Mov       Hour,#0
   
QTime:     Mov       A,Asave
           Mov       C,Csave
           RetI
;--------------------------------------------------------
Timeplay:  Mov      R1,#DisBuf

           Mov      A,Second
           Acall    Timeloop
           
           Mov      A,Minute
           Acall    Timeloop
           
           Mov      A,Hour
           
Timeloop:  DA       A
           Mov      R3,A
           ANL      A,#00001111B
           MOV      @R1,A
           Inc      R1
           Mov      A,R3
           Swap     A
           ANL      A,#00001111B
           Mov      @R1,A
           Inc      R1
           Ret
;--------------------------------------------------------
DisplayS:  Mov      R0,Disptr  
           Mov      A,@R0
           Mov      Dptr,#Distab
           Movc     A,@A+Dptr
           Mov      Dptr,#Disport
           Movx     @Dptr,A
           Inc      Disptr

           Mov      A,Csptr
           Mov      Dptr,#Csport
           Movx     @Dptr,A
           Rl       A
           Jnb      Acc.6,QDisplay
            
Initdis:   Mov      Disptr,#DisBuf
           Mov      A,#00000001B           
QDisplay:  Mov      Csptr,A
           Ret
;--------------------------------------------------------
;Readkey:           
;-------------------------------------------------------
DoSec1000: Acall     DisplayS
           Ajmp      Mainloop1
DoSec100:  Acall     Timeplay
           Ajmp      Mainloop0
;---------------Main------------------------------------
Main:      Mov       SP,#30H
           Acall     Init
Mainloop0: Jbc       Sec1000Chg,DoSec1000
Mainloop1: Jbc       Sec100Chg,DoSec100
           Ajmp      Mainloop0            
;-------------------------------------------------------
Init:      Mov       Tmod,#00000001B
           Mov       TL0,#Low(Time0)
           Mov       Th0,#High(Time0)
           Setb      EA
           Setb      ET0  
           Setb      TR0
              
           Clr       A
           Mov       Sec1000,#10
           Mov       Sec100,#100
           Mov       Second,A
           Setb      Sec1000Chg
           Mov       Disptr,#DisBuf
           Mov       Csptr,#00000001B
           Ret
;---------------------------------------------------------
;--------------------------------------------------------
;          Char: '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'
;          Code: 00H, 01H, 02H, 03H, 04H, 05H, 06H, 07H, 08H, 09H
DisTab:     DB  0C0H,0F9H,0A4H,0B0H, 99H, 92H, 82H,0F8H, 80H, 90H
 
;          Char: 'A', 'B', 'C', 'D', 'E', 'F', '10H'
;          Code:  + ,  - ,  * ,  / ,  = , ON/C ,Dark
            DB  0C0H,0F9H,0A4H,0B0H, 99H, 92H  ,0FFH
;-------------------------------------------------------
          End
proteus 仿真图
TIME.rar (19.12 KB)

                          
搜索更多相关主题的帖子: 源程序 
2011-01-12 16:46
快速回复:求助,关于时钟程序
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.082344 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved