专注电子技术学习与研究
当前位置:单片机教程网 >> MCU设计实例 >> 浏览文章

三维LED立方体程序+视频

作者:huqin   来源:本站原创   点击数:  更新时间:2014年04月08日   【字体:

   


       
         ORG 0000H
         AJMP MAIN
         ORG 0031H
    MAIN:
         MOV SP,#40H;          缓存首地址
         MOV P0,#00H;          初始化行
         MOV P1,#00H;          初始化块
         MOV P2,#00H;          初始化列
        
         MOV A,#00H;           初始化暂存器
         MOV R0,#00H;          初始化数据指针
    DAA: MOV A,R0;
         MOV DPTR,#HTABLE
         MOVC A,@A+DPTR;       对行数据缓存
         MOV DPTR,#TABLE;      对行数据进行解码
         MOVC A,@A+DPTR;
         MOV 20H,A;            解码后的行数据进入行缓存器 
        
         MOV A,R0
         MOV DPTR,#LTABLE
         MOVC A,@A+DPTR;        对列数据缓存
         MOV DPTR,#TABLE
         MOVC A,@A+DPTR;        解码列数据
         MOV 21H,A;             解码后的列数据进入行缓存器 
        
         MOV A,R0
         MOV DPTR,#ZTABLE
         MOVC A,@A+DPTR;         对块数据缓存
         MOV DPTR,#TABLE
         MOVC A,@A+DPTR;        解码块数据
         MOV 22H,A;            解码后的列数据进入行缓存器 
         ACALL AAA;            执 行行列块扫描  
         INC R0;               下一数据做准备
         CJNE R0,#05H,DAA;     数据是否超值
         MOV R0,#00H;          超值重新复位数据
         SJMP DAA;             对下一数据进行操作
        
     * ******************************************************************************************************************************************************以下为行列块定义·扫描·以及解码,行列块数据。*中得内容以及“*”将不出现在汇编编译器。
  *********************************************************************************************************************************************************     
        
        
      H1 BIT 00H
      H2 BIT 01H
      H3 BIT 02H
      L1 BIT 08H
      L2 BIT 09H
      L3 BIT 0AH
      Z1 BIT 10H
      Z2 BIT 11H
      Z3 BIT 12H
 
 
AAA:JB H1,AAB
    JB H2,AAC
    JB H3,AAD
AAE:   RET
AAB:MOV P0,20H;
    ACALL BAA
    SJMP AAE
AAC:MOV P0,20H;
    ACALL BAA
    SJMP AAE
AAD:MOV P0,20H;
    ACALL BAA
    SJMP AAE

BAA:JB L1,BAB
    JB L2,BAC
    JB l3,BAD
BAE:   RET
BAB:MOV P2,21H;
    ACALL CAA
    SJMP BAE
BAC:MOV P2,21H;
    ACALL CAA
    SJMP BAE
BAD:MOV P2,21H;
    ACALL CAA
    SJMP BAE
 
CAA:JB z1,CAB
    JB Z2,CAC
    JB Z3,CAD
        RET
CAB:MOV P1,22H;
        RET
CAC:MOV P1,22H;
        RET
CAD:MOV P1,22H;
        RET
TABLE:DB 00H, 01H,02H,04H,08H,10H,20H,40H,80H;     解码翻译
HTABLE :DB 01H,02H,01H,01H,01H,03H------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------(省略N个行特征码);                          行特征码
 
 
LTABLE :DB 01H,01H,03H,02H,02H,01H   ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------(省略N个列特征码);                         
 
 
ZTABLE :DB 01H,03H,02H,03H,03,02H   ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------(省略N个块特征码);                                                      块特征码
end
         
关闭窗口

相关文章