当前位置:编程学习 > C/C++ >>

急求!用C语言编译的点阵字幕程序!

实验器材:亚龙YL-236型单片机控制功能实训考核装置:电源模块,主机模块,显示模块,仿真器模块。项目要求:要求在点阵上显示“欢迎”两字从右向左移位。急求!!!
答案:这个不知道能不能在单片机上运行,我没学过单片机.但是我在电脑上运行通过.

 

#include "Conio.h"
#include "graphics.h"
#define closegr closegraph

void initgr(void) /* BGI初始化 */
{
  int gd = DETECT, gm = 0;
  registerbgidriver(EGAVGA_driver);
  initgraph(&gd, &gm, "");
}

void drawmat(char *mat,int matsize,int x,int y,int color)
/*依次:字模指针、点阵大小、起始坐标(x,y)、颜色*/
{
  int i, j, k, n;
  n = (matsize - 1) / 8 + 1;
  for(j = 0; j < matsize; j++)
    for(i = 0; i < n; i++)
      for(k = 0;k < 8; k++)
        if(mat[j * n + i] & (0x80 >> k))  /*测试为1的位则显示*/
          putpixel(x + i * 8 + k, y + j, color);
}
char huan64K[]={
/* 以下是 '欢' 的 64点阵楷体_GB2312 字模,512 byte */
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x1E,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x1E,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,
  0x00,0x00,0x08,0x00,0xC0,0x00,0x00,0x00,
  0x00,0x00,0x3C,0x00,0xC0,0x03,0x80,0x00,
  0x00,0x03,0xFE,0x01,0x80,0x1F,0xC0,0x00,
  0x00,0x1F,0xFF,0x01,0x81,0xFF,0xF0,0x00,
  0x03,0xFC,0x0F,0x03,0xFF,0xFF,0xF8,0x00,
  0x0F,0xE0,0x0E,0x03,0xFC,0x03,0xF0,0x00,
  0x07,0x00,0x0C,0x06,0x00,0x03,0x80,0x00,
  0x00,0x00,0x1C,0x04,0x00,0x03,0x00,0x00,
  0x00,0x00,0x1C,0x08,0x00,0x06,0x00,0x00,
  0x00,0x00,0x18,0x00,0x00,0x04,0x00,0x00,
  0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,
  0x00,0x40,0x38,0x00,0x30,0x00,0x00,0x00,
  0x00,0x60,0x38,0x00,0x38,0x00,0x00,0x00,
  0x00,0x30,0x30,0x00,0x38,0x00,0x00,0x00,
  0x00,0x18,0x70,0x00,0x38,0x00,0x00,0x00,
  0x00,0x0E,0x70,0x00,0x38,0x00,0x00,0x00,
  0x00,0x07,0xE0,0x00,0x38,0x00,0x00,0x00,
  0x00,0x07,0xE0,0x00,0x38,0x00,0x00,0x00,
  0x00,0x03,0xC0,0x00,0x38,0x00,0x00,0x00,
  0x00,0x01,0xE0,0x00,0x3C,0x00,0x00,0x00,
  0x00,0x01,0xF0,0x00,0x30,0x00,0x00,0x00,
  0x00,0x01,0xF8,0x00,0x72,0x00,0x00,0x00,
  0x00,0x03,0xF8,0x00,0x61,0x00,0x00,0x00,
  0x00,0x03,0x3C,0x00,0x60,0x80,0x00,0x00,
  0x00,0x06,0x1C,0x00,0xC0,0xC0,0x00,0x00,
  0x00,0x0E,0x0E,0x00,0xC0,0x60,0x00,0x00,
  0x00,0x0C,0x0E,0x00,0xC0,0x70,0x00,0x00,
  0x00,0x18,0x06,0x01,0x80,0x38,0x00,0x00,
  0x00,0x38,0x02,0x01,0x80,0x1C,0x00,0x00,
  0x00,0x30,0x02,0x03,0x00,0x1E,0x00,0x00,
  0x00,0x60,0x00,0x06,0x00,0x0F,0x00,0x00,
  0x00,0xC0,0x00,0x06,0x00,0x07,0x80,0x00,
  0x01,0x80,0x00,0x0C,0x00,0x07,0xC0,0x00,
  0x02,0x00,0x00,0x18,0x00,0x03,0xF0,0x00,
  0x04,0x00,0x00,0x30,0x00,0x01,0xFC,0x00,
  0x08,0x00,0x00,0x60,0x00,0x01,0xFF,0x00,
  0x00,0x00,0x01,0x80,0x00,0x00,0xFF,0xE0,
  0x00,0x00,0x02,0x00,0x00,0x00,0x7F,0xF8,
  0x00,0x00,0x04,0x00,0x00,0x00,0x3F,0xF0,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};

char ying64K[]={
/* 以下是 '迎' 的 64点阵楷体_GB2312 字模,512 byte */
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x1E,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x3E,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,
  0x00,0x30,0x00,0x00,0x70,0x00,0x00,0x00,
  0x00,0x3C,0x00,0x00,0xE0,0x00,0x00,0x00,
  0x00,0x1E,0x00,0x01,0xC0,0x00,0x00,0x00,
  0x00,0x1F,0x00,0x03,0x00,0x00,0x00,0x00,
  0x00,0x0F,0x80,0x06,0x00,0x01,0xF0,0x00,
  0x00,0x07,0x80,0x18,0x00,0x07,0xF8,0x00,
  0x00,0x03,0x01,0xF0,0x07,0xFF,0xFC,0x00,
  0x00,0x00,0x00,0xC0,0x03,0xE0,0x38,0x00,
  0x00,0x00,0x00,0xC0,0x03,0x00,0x38,0x00,
  0x00,0x00,0x00,0xC0,0x03,0x00,0x38,0x00,
  0x00,0x00,0x00,0x40,0x03,0x00,0x30,0x00,
  0x00,0x00,0x00,0x40,0x03,0x00,0x30,0x00,
  0x00,0x00,0x00,0x40,0x03,0x00,0x30,0x00,
  0x00,0x00,0x00,0x40,0x03,0x00,0x70,0x00,
  0x00,0x0C,0x00,0x40,0x03,0x00,0x70,0x00,
  0x00,0x3F,0x00,0x40,0x03,0x00,0x70,0x00,
  0x00,0xFF,0x80,0x60,0x03,0x00,0x70,0x00,
  0x1F,0xC7,0x80,0x60,0x43,0x00,0x70,0x00,
  0x0E,0x07,0x00,0x60,0x83,0x0C,0xE0,0x00,
  0x00,0x06,0x00,0x61,0x83,0x07,0xE0,0x00,
  0x00,0x06,0x00,0x67,0x01,0x03,0xE0,0x00,
  0x00,0x04,0x00,0x7E,0x01,0x01,0xC0,0x00,
  0x00,0x0C,0x00,0x7C,0x01,0x01,0xC0,0x00,
  0x00,0x0C,0x00,0x78,0x01,0x01,0x80,0x00,
  0x00,0x08,0x00,0xF0,0x01,0x01,0x00,0x00,
  0x00,0x04,0x00,0xE0,0x01,0x00,0x00,0x00,
  0x00,0x04,0x00,0xE0,0x01,0x00,0x00,0x00,
  0x00,0x04,0x00,0x40,0x01,0x00,0x00,0x00,
  0x00,0x04,0x00,0x00,0x01,0x00,0x00,0x00,
  0x00,0x02,0x00,0x00,0x01,0x00,0x00,0x00,
  0x00,0x02,0x00,0x00,0x01,0x00,0x00,0x00,
  0x00,0x02,0x00,0x00,0x01,0x00,0x00,0x00,
  0x00,0x02,0x00,0x00,0x01,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
  0x00,0x3F,0x80,0x00,0x00,0x00,0x00,0x00,
  0x1F,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,
  0x0F,0xF0,0x7F,0xC0,0x00,0x00,0x00,0x00,
  0x0F,0x80,0x03,0xFE,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x7F,0xE0,0x00,0x00,0x00,
  0x00,0x00,0x00,0x1F,0xFF,0x80,0x00,0x00,
  0x00,0x00,0x00,0x03,0xFF,0xFF,0xFF,0xFE,
  0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xF8,
  0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xE0,
  0x00,0x00,0x00,0x00,0x03,0xFF,0xFF,0x00,
  0x00,0x00,0x00,0x00,0x00,0xFF,0xF8,0x00,
  0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};


int main(void)
{
  int i;
  initgr(); /* BGI初始化 */
  for(i = 50; i>0; i--)
   {
    clearviewport() ;
    drawmat(huan64K, 64, i * 7, 200,RED);
    drawmat(ying64K, 64, 70+ i * 7, 200,RED);
    delay(50000);
   }/*依次:字模指针、点阵大小、起始坐标(x,y)、颜色*/
  ge

上一个:C语言 好爽系列视频教程下载 C语言 好爽2012系列视频教程下载
下一个:来个最权威的C语言教程网站地址?

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,