| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1104 人关注过本帖
标题:请问这是什么地方有错!(高手请进)
取消只看楼主 加入收藏
yangxiaochao
Rank: 2
等 级:论坛游民
帖 子:34
专家分:34
注 册:2009-10-9
结帖率:50%
收藏
已结贴  问题点数:0 回复次数:0 
请问这是什么地方有错!(高手请进)
include HT46C64.inc

ds    .section    'data'



cs    .section    'code'
;---------------------------------------------
DATA        .SECTION        AT 60H        'DATA'
DISPLAY_DATA                DB        ?
DISPLAY_COUNTER                DB        ?
SCAN_COUNTER                DB        ?
SCAN_DATA                    DB        ?
SCAN_CODE                    DB        ?
;----------------------------------------------   
CODE       .SECTION        AT 00H        'CODE'
            ORG            00H            
            JMP            STARTS
        
STARTS:
            CLR         PAC.4
            CLR            PA.4
            CLR            PDC
            CLR         PD  
            MOV            A,0F0H   
            MOV            PBC,A                           ;给PB口赋值
            SET          PB    ;设置为高电平
        ;    CLR            PDC
        ;    CLR         PD                           ;B口全输出0(初始状态)
SCAN_BEGIN:
             MOV            A,04H                           ;扫描4次 并送入A里面                       
            MOV            SCAN_COUNTER,A
            MOV            A,0E0H         ;;;;                  ;70H即0111
            MOV            SCAN_DATA,A                     ;产生SCAN_DATA 进行扫描
SCAN_NEXT:
        ;    MOV            A,SCAN_DATA
            MOV            PB,A                                 
            CALL        KEY_IN
            SET            C                                ;C被移至PB7
            RLC            SCAN_DATA                     
            MOV            A,SCAN_DATA
            AND            A,0F0H                            ;相与,取出高4位 低四位清零
            SDZ            SCAN_COUNTER
            JMP            SCAN_NEXT
            JMP            SCAN_BEGIN
            RET
;---------------------------------------------

            ORG            0E0H
            DC            0EEH,0DEH,0BEH,07EH
            DC            0EDH,0DDH,0BDH,07DH
            DC            0EBH,0DBH,0BBH,07BH
            DC            0E7H,0D7H,0B7H,077H
            
KEY_IN      PROC                                           ;该子程序主要作用是检测那一个键被按下。
            CLR            TBLP
            MOV            A,10H                             
            MOV            DISPLAY_COUNTER,A                   ;10H送入显示寄存器
            
SCAN_KEY:
            TABRDL       DISPLAY_DATA                       ;查表指令,指向最后一页  0F00H
            TABRDC        SCAN_CODE                           ;当前页进行查表  即:0E00H
            INC            TBLP
            MOV            A,PB
            SUB            A,SCAN_CODE                         ;A与按键相减 ,等于零即可显示
            SZ            ACC
            JMP            NEXT_CODE
            MOV            A,DISPLAY_DATA
            MOV         PD,A
            
KEY_STATUS:                                                 ;检测按键是否已经被放开
            MOV            A,PB
            AND            A,0F0H
            XOR            A,0F0H
            SZ            ACC
            JMP            KEY_STATUS
            JMP            OVER
            
NEXT_CODE:
            SDZ            DISPLAY_COUNTER
            JMP            SCAN_KEY
            
OVER:
            RET
KEY_IN        ENDP
;-------------------------------------------------
            ORG            0F00H
            DC        0C0H,0F9H,0A4H,0B0H
            DC        99H,92H,82H,0F8H
            DC        80H,90H,88H,83H
            DC        0C6H,0A1H,86H,8EH
;------------------------------------------------

            END
搜索更多相关主题的帖子: include 
2010-05-03 19:53
快速回复:请问这是什么地方有错!(高手请进)
数据加载中...
 
   



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

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