先做好字模
########
$##$##$#
#$#$#$##
##$$$###
$$$$$$$#
##$$$###
#$#$#$##
$##$##$#
;FOR T598D
CSLED EQU 8000H
CSc1 EQU CSLED ;列1~8 273
CSc2 EQU CSLED+1H ;列9~16 273
CSr1 EQU CSLED+2H ;行1~8 374
CSr2 EQU CSLED+3H ;行9~16 374
ORG 0000H
MOV SP,#60H
INIT: MOV A,#0H ;关闭LED列显示
MOV DPTR,#CSc1
MOVX @DPTR,A
MOV DPTR,#CSc2
MOVX @DPTR,A
MOV A,#0FFH ;关闭LED行显示
MOV DPTR,#CSr1
MOVX @DPTR,A
MOV DPTR,#CSr2
MOVX @DPTR,A
D: MOV R5,#00H ;设定汉字表格初始值
MOV R4,#01H ;设定列扫描初始值,从第一列开始
DISP:
MOV A,R5
RL ACC
MOV DPTR,#HZKE ;此处设定所要显示的字符
MOVC A,@A+DPTR
CPL ACC ;代码取反,决定显示的阴阳
MOV DPTR,#CSr1
MOVX @DPTR,A
MOV A,R5
RL ACC
INC ACC
MOV DPTR,#HZKE ;此处设定所要显示的字符
MOVC A,@A+DPTR
CPL ACC
MOV DPTR,#CSr2
MOVX @DPTR,A
MOV DPTR,#CSc1
MOV A,R4
MOVX @DPTR,A
RL ACC
MOV R4,ACC
INC R5
LCALL DELAY
MOV A,#00H ;清上次显示值
MOVX @DPTR,A ;关闭行、列
MOV A,#0FFH
MOV DPTR,#CSR1
MOVX @DPTR,A
CJNE R5,#8H,DISP ;判是否显示到第八列
MOV R5,#08H ;设定汉字表格初始值
MOV R4,#01H ;设定列扫描初始值,从第九列开始
DISP2:
MOV A,R5
RL ACC
MOV DPTR,#HZKE ;此处设定所要显示的字符
MOVC A,@A+DPTR
CPL ACC
MOV DPTR,#CSr1
MOVX @DPTR,A
MOV A,R5
RL ACC
INC ACC
MOV DPTR,#HZKE ;此处设定所要显示的字符
MOVC A,@A+DPTR
CPL ACC
MOV DPTR,#CSr2
MOVX @DPTR,A
MOV DPTR,#CSc2
MOV A,R4
MOVX @DPTR,A
RL ACC
MOV R4,ACC
INC R5
LCALL DELAY
MOV A,#00H ;清上次显示值
MOVX @DPTR,A ;关闭行、列
MOV A,#0FFH
MOV DPTR,#CSR2
MOVX @DPTR,A
CJNE R5,#10H,DISP2 ;判是否扫描到第十六列
SJMP D
; 延时子程序,协调字符显示速度
DELAY: MOV R7,#1H
DL1: MOV R6,#00H
DL2: DJNZ R6,DL2
DJNZ R7,DL1
RET
; 字符点阵字库
; HZ16 字符编码排列
; 数 D7 R1 (0 2 --28 30)
; | |
; | |
; 据 D0 R8 (1 3 --29 31)
;
;运行zimoexe程序,在参数设置里选择“纵向取模”,1616点阵,宋体、小四号(12)
;取模方式为A51格式
;取完模之后,将16~32字节间隔插入1~15字节,详见下面示例字模。
;
;ZIMO程序生成的字模
;显示“爱迪克”
;HZAI:
; DB 00H,02H,4DH,69H,59H,49H, 6FH,59H, 0C9H,89H,99H,0E9H,89H,09H,0CH,00H
; DB 02H,04H,05H,09H,32H,0E2H,54H,54H, 48H, 58H,64H,44H, 02H,03H,02H,00H
;HZDI:
; DB 02H,82H,73H, 20H,00H,0FH, 09H,09H, 09H,0FFH,09H,09H,09H,0FH,00H,00H
; DB 02H,04H,0F8H,04H,02H,0FAH,12H,12H, 12H,0F2H,12H,12H,12H,0FAH,02H,00H
;HZKE:
; DB 0FFH,0BFH,0EFH,0BFH,0EFH,0BFH,0EFH,0BBH,0E0H,001H,0EFH,0FFH,0EFH,0FFH,0EFH,0FFH ;片
; DB 0E0H,00FH,0EFH,0EFH,0EFH,0EFH,0EFH,0EFH,0DFH,0EFH,0DFH,0EFH,0BFH,0EFH,07FH,0FFH
;
; 转换后的字模
HZAI:
DB 00H,02H,02H,04H,4DH,05H,69H,09H,59H,32H,49H,0E2H,6FH,54H,59H,54H
DB 0C9H,48H,89H,58H,99H,64H,0E9H,44H,89H,02H,09H,03H,0CH,02H,00H,00H
HZDI:DB 02H,02H,82H,04H,73H,0F8H,20H,04H,00H,02H,0FH,0FAH,09H,12H,09H,12H
DB 09H,12H,0FFH,0F2H,09H,12H,09H,12H,09H,12H,0FH,0FAH,00H,02H,00H,00H
HZKE:DB 0FFH,0BFH,0EFH,0BFH,0EFH,0BFH,0EFH,0BBH,0E0H,001H,0EFH,0FFH,0EFH,0FFH,0EFH,0FFH ;片
DB 0EFH,0EFH,0EFH,0EFH,0E0H,00FH,0EFH,0EFH,0BFH,0EFH,07FH,0FFH,0DFH,0EFH,0DFH,0EFH
;
END
这是程序请求帮忙修改
分类: 电脑/网络 >> 程序设计 >> 其他编程语言
问题描述:
这是给出的相关的材料,请教达人指点啊
我不知道如何动手,也不清楚代码要怎么写
希望高手给编写出来吧谢谢了
/ Chars are defined as 5 columns with each 8 bit, (5x8 font)
lowest 4 dots up to down 1,2,4,8 is higher nibble,
upper 4 dots up to down is lower nibble, for example:
| 123456
-+----------
|
1| xxx 1
2| x x 2
3| x x 4
4| x x __8 "A" is {0x7E,0x11,0x11,0x11,0x7E,0x00} (Last column blank)
5| xxxxx 1
6| x x 2
7| x x 4
8| 8
/
const byte prime_char_map[][6] = { {0x00,0x00,0x00,0x00,0x00,0x00}, \
/ Block for test at startup / {0xFF,0xFF,0xFF,0xFF,0xFF,0x00}, \
/ 02 / {0x00,0x00,0x00,0x00,0x00,0x00}, \
/ 03 / {0x00,0x00,0x00,0x00,0x00,0x00}, \
/ 04 / {0x00,0x00,0x00,0x00,0x00,0x00}, \
/ 05 / {0x00,0x00,0x00,0x00,0x00,0x00}, \
/ 06 / {0x00,0x00,0x00,0x00,0x00,0x00}, \
/ 07 / {0x00,0x00,0x00,0x00,0x00,0x00}, \
/ 08 / {0x00,0x00,0x00,0x00,0x00,0x00}, \
/ 09 / {0x00,0x00,0x00,0x00,0x00,0x00}, \
/ 0A / {0x00,0x00,0x00,0x00,0x00,0x00}, \
/ 0B / {0x00,0x00,0x00,0x00,0x00,0x00}, \
/ 0C / {0x00,0x00,0x00,0x00,0x00,0x00}, \
/ 0D / {0x00,0x00,0x00,0x00,0x00,0x00}, \
/ 0E / {0x00,0x00,0x00,0x00,0x00,0x00}, \
/ 0F / {0x00,0x00,0x00,0x00,0x00,0x00}, \
/ 10 / {0x00,0x7F,0x3E,0x1C,0x08,0x00}, \
/ 11 / {0x08,0x1C,0x3E,0x7F,0x00,0x00}, \
/ 12 / {0x44,0x66,0x77,0x66,0x44,0x00}, \
/ 13 / {0x11,0x33,0x77,0x33,0x11,0x00}, \
/ 14 / {0x48,0x77,0x49,0x41,0x42,0x00}, \
/ 15 / {0x30,0x48,0x45,0x40,0x20,0x00}, \
/ 16 / {0x00,0x00,0x7D,0x00,0x00,0x00}, \
/ 17 / {0x40,0xE0,0xE0,0x7F,0x06,0x00}, \
/ 18 / {0x24,0x42,0x81,0x42,0x24,0x00}, \
/ 19 / {0x0F,0xF0,0x00,0xF0,0x0F,0x00}, \
/ 1A / {0x20,0x40,0x20,0x10,0x08,0x00}, \
/ 1B / {0x7C,0x82,0x82,0x83,0x44,0x00}, \
/ 1C /
解析:
你的材料不全吧,看样子应该是prime_char_map[][6]第一维应该有256个元素的,你给出来的只是前面的一小部分,这里面很多都不是可显示的字符。下面是根据你的材料写的显示字符的程序:#include <stdioh>const byte prime_char_map[][6] = {{0x00,0x00,0x00,0x00,0x00,0x00}}; 这个地方你得把你的材料里的prime_char_map定义全都粘进来void Display(char c);void main(){Display('A');Display('b');}void Display(char c){int i, j;byte bit = 0x01;for (i = 0; i < 8; i++){for (j = 0; j < 6; j++){if (prime_char_map[c][j] & bit)printf("x");elseprintf(" ");}printf("\n");bit = 2;}}
1 ORG 0HSTART:MOV DPTR,#DATA1 ;指向点阵代码首址;
CLR CDISP?这个应该是CLR C(清除标志位,因为下面要判断是否移完8位)吧
2 MOV R2,#80H ; 80H 使第7 列(最左一列)阴极为低电平(这个感觉也有问题)
3DISP:MOV A,#0; 赋初值0,为了下面能从点阵代码表中从零开始取代码
MOVC A,@A+DPTR ; 取第一列点阵代码
MOV P2,A ; 将第一列点阵代码的值赋给P2口
MOV P1,R2 ;使一列阴极为低电平?
CALL DELAY ; 调用延时
INC DPTR ; 指向下一列点阵代码
MOV A,R2 ; R2的值赋给A
RRC A ; 右移一位,为下一列阴极输出低电平作准备
MOV R2,A ;右移一位后再把值存储到R2,为了下一次右移
JNC DISP ; 8 列未完跳回到DISP继续执行
4AJMP START 跳转到START
DELAY: MOV R1,#0 ;//这个有问题,R1不是赋零,不然怎么延时啊
DELY0: DJNZ R1,DELY0 ;延时(直到R1的值变为0)
5RET 返回(这个子程序执行完了)
6DATA1: DB 24H,44H,DCH,54H,7FH,54H,54H,44H; 点阵代码表
大概就这个意思,好久没看汇编了,你自己再斟酌一下!
以上就是关于谁能帮忙写个点阵显示图形程序全部的内容,包括:谁能帮忙写个点阵显示图形程序、LED点阵汉字显示移动程序、C语言问题: 给出字符点阵,显示字符,请问应如何写程序代码等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)