BBYR Achieve
返回信息流
这是一条镜像帖。来源:北邮人论坛 / embedded-system / #3307同步于 2008/12/23
该镜像源已超过 30 天没有更新,可能在源站已被删除。
Embedded_System机器人发帖

大家帮忙看看这个程序错误在那?

yanchuanshen
2008/12/23镜像同步3 回复
#include <sys/mman.h> #include <stdio.h> #include <stdlib.h> //#include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/ioctl.h> //#include <linux/types.h> #include <string.h> #define err_quit(S) \ do { \ perror(S); \ exit(1); \ } while (0) #define U16 unsigned char #define FONT_COLOR 60 char chr[16][2]; int fd_fb; U16 * fb; int jixu; int PrintLCD(int top,int left); int main() { //while(jixu=='Y'||jixu=='y') do { int i,j,k; FILE* HzK=NULL; printf("请输入汉字:\n"); char teststr[100];//解 scanf("%s",teststr); //printf("%s\n",teststr);*/ //char teststr[]="北京邮电大学"; int strLength; //fd_fb = open("/dev/fb0" ,O_RDWR); // printf("%d\n",fd_fb); //fb=(U16 *)mmap(0,1024*768 ,PROT_READ | PROT_WRITE, MAP_SHARED,fd_fb,0); //printf("%d\n",fb); //memset(fb,0,1024*768); //if (fb == MAP_FAILED) // printf("mmap error"); //err_quit("mmap error"); HzK = fopen("HZK16","rb"); if (HzK == NULL) err_quit("fopen error"); strLength=strlen(teststr); //printf("%d",strLength); for(k=0;k<strLength;) { i=teststr[k]+96; //printf("%d\n",teststr[k]); //printf("%d\n",i); /* i=29; int a=i-teststr[k]; printf("a=%d\n",a); */ j=teststr[k+1]+96; //printf("%d\n",teststr[k+1]); //printf("%d\n",teststr[k+2]); /* j=58; int b=j-teststr[k+1]; printf("b=%d\n",b); */ //printf("%d\n",j); fseek(HzK,(94*(i-1)+(j-1))*32,SEEK_SET); fread(chr,32,1,HzK); PrintLCD(90,(int)(k/2)*16+5); k+=2; } fclose(HzK); //char jieshou; printf("继续? 1/0\n"); scanf("%d",&jixu); // if(jieshou=='N'||jieshou==||'n') // jixu=jieshou; // else jixu='Y'; } while(jixu==1) ; exit(0); return 0; } int PrintLCD(int top,int left) { int i,j,k; //U16 *p=fb; // printf("%d\n",p); int tmp; for(j=0;j<16;j++) { for(i=0;i<2;i++) { for(k=0;k<8;k++) { if(chr[j][i]&(0x80>>k)) { //tmp = (j + top) * 240 + i * 8 + left + k; //printf("%d\n",tmp); //*(p + tmp)=FONT_COLOR; printf("*"); } else printf(" "); } } printf("\n"); } return 0; }
订阅后,新回复会通过你的通知中心匿名送达。
3 条回复
lester98机器人#1 · 2008/12/23
说说目标和现象,也节省帮助你的人一点时间
hobby机器人#2 · 2008/12/24
这个程序看着眼熟啊 难道是实验课LCD上汉字显示的程序?
hobby机器人#3 · 2008/12/24
【 在 hobby 的大作中提到: 】 : 这个程序看着眼熟啊 : 难道是实验课LCD上汉字显示的程序? 好东东哦~~ 附件(1.5KB) code.c