C语言26个英文字母点阵,16X16点阵C语言程序(国外英文资料).doc

该博客介绍了一个使用C语言实现的16x16点阵显示英文字母的程序,包括扫描时钟设置、数据缓存以及显示函数。示例代码展示了如何显示特定的字母,如'feather'和'wings',并提供了上下移动的内容效果。
摘要由CSDN通过智能技术生成

16X16点阵C语言程序(国外英文资料)

16X16点阵C语言程序(国外英文资料)

/ * -- -16 * 16

# include < reg51. H >

# include < intrins. H >

# define DATE_OUT P1 / / specify P2 as the output

Sbit DATA = DATE_OUT ^ 0; / / column data output bits

Sbit SCLH = DATE_OUT ^ 1; / / scan the clock bit

Sbit SCLT = DATE_OUT ^ 2; / / column data latches

Sbit AB = DATE_OUT ^ 3; / / the row data output bit

Sbit SCK = DATE_OUT ^ 4; / / scan clock position

Unsigned char date [32]. / / 32 bytes of RAM is used as a 16 * 16 grid display cache

Void the display (); / / as the dot matrix scan function, the cached data is displayed to the dot matrix screen

Void display_time (unsigned int timer); / / specify time scan display

Void displaymove (unsigned char * lp, unsigned char c, unsigned char timer) / / the movement effect of the content of the Chinese

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,我可以给你提供一个基于C语言16x16点阵字模动画移动程序的示例代码,具体如下: ```c #include <stdio.h> #include <stdlib.h> #include <string.h> #include <windows.h> #define ROW 16 // 点阵字模行数 #define COL 16 // 点阵字模列数 #define MAX_LEN 50 // 最大字符串长度 // 16x16点阵字模,每行用16位二进制数表示 unsigned short font[ROW] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }; // 显示点阵字模 void show_font(unsigned short *font) { int i, j; for (i = 0; i < ROW; i++) { for (j = 0; j < COL; j++) { if ((font[i] >> j) & 0x0001) { printf("*"); } else { printf(" "); } } printf("\n"); } } // 移动点阵字模 void move_font(unsigned short *font, int move_step) { int i, j; unsigned short mask = 0x0000; for (i = 0; i < ROW; i++) { mask = 0x0000; for (j = 0; j < COL; j++) { if (j - move_step >= 0) { mask |= ((font[i] >> (j - move_step)) & 0x0001) << j; } } font[i] = mask; } } // 清空点阵字模 void clear_font(unsigned short *font) { int i; for (i = 0; i < ROW; i++) { font[i] = 0x0000; } } int main() { char str[MAX_LEN]; int i, len, move_step; printf("请输入要移动的字符串:"); fgets(str, MAX_LEN, stdin); len = strlen(str) - 1; printf("请输入移动步长(1~16):"); scanf("%d", &move_step); getchar(); // 初始化点阵字模 clear_font(font); for (i = 0; i < len; i++) { if (str[i] >= 0x20 && str[i] <= 0x7e) { memcpy(font, &font_lib[str[i] - 0x20][0], ROW * sizeof(unsigned short)); show_font(font); Sleep(50); // 等待50ms system("cls"); // 清屏 move_font(font, move_step); } } return 0; } ``` 该程序实现了以下功能: 1. 输入一个字符串,并将其按照16x16点阵字模进行显示; 2. 输入一个移动步长(1~16),并将点阵字模向右移动指定步长; 3. 清空点阵字模。 注:上述代码中的 `font_lib` 数组为预定义的16x16点阵字模库,需要在程序中进行定义。 希望能够帮助到你!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值