嵌入式C语言程序设计

  • m6_788031
    了解作者
  • 465.2KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-06-12 03:44
    上传日期
嵌入式C语言程序设计
嵌入式c语言程序设计.rar
  • 嵌入式C语言程序设计
  • 程序集
  • ex6-5
  • ex6-5
    19.8KB
  • EX6-5.C
    12.6KB
  • ex6-5.lnp
    27B
  • EX6-5.LST
    21.3KB
  • ex6-5.Uv2
    1.9KB
  • ex6-5.Opt
    839B
  • ex6-5.hex
    6.6KB
  • ex6-5.M51
    21.7KB
  • EX6-5.OBJ
    23KB
  • ex6-5.plg
    2.6KB
  • ex4-3
  • ex4-3
    2.4KB
  • ex4-3.Opt
    1.2KB
  • ex4-3.M51
    3KB
  • ex4-3_Opt.Bak
    1KB
  • ex4-3.hex
    269B
  • ex4-3_Uv2.Bak
    2KB
  • ex4-3.plg
    201B
  • ex4-3.Uv2
    2.1KB
  • ex4-3.OBJ
    2.5KB
  • ex4-3.lnp
    27B
  • ex4-3.LST
    2.4KB
  • ex4-3.C
    762B
  • ex4-1
  • ex4-1.M51
    2.9KB
  • ex4-1.LST
    1.9KB
  • ex4-1
    2.3KB
  • ex4-1.Uv2
    1.9KB
  • ISP.LOG
    63B
  • ex4-1.C
    722B
  • ex4-1.hex
    185B
  • ex4-1.plg
    320B
  • ex4-1.OBJ
    2.4KB
  • ex4-1.lnp
    27B
  • ex4-1.Opt
    1015B
  • ex4-7
  • ex4-7.LST
    3KB
  • ex4-7.hex
    824B
  • ex4-7_Uv2.Bak
    1.9KB
  • ex4-7
    4.3KB
  • ex4-7_Opt.Bak
    846B
  • ex4-7.lnp
    27B
  • ex4-7.OBJ
    4.9KB
  • ex4-7.c
    1.8KB
  • ex4-7.Opt
    857B
  • ex4-7.M51
    5KB
  • ex4-7.plg
    201B
  • ex4-7.Uv2
    2KB
  • ex4-4
  • ex4-4.M51
    4.5KB
  • ex4-4
    3.7KB
  • ex4-4.OBJ
    3.8KB
  • ex4-4.C
    1.3KB
  • ex4-4.Uv2
    1.9KB
  • ex4-4.hex
    848B
  • ex4-4.lnp
    27B
  • ex4-4.Opt
    843B
  • ex4-4.LST
    2.6KB
  • ex4-4.plg
    201B
  • ex4-9
  • ex4-9.lnp
    57B
  • ex4-9.OBJ
    4.7KB
  • ex4-9.LST
    3.3KB
  • ex4-9.C
    987B
  • keypad.OBJ
    3.5KB
  • ex4-9
    7.5KB
  • ex4-9.plg
    201B
  • keypad.LST
    3.5KB
  • keypad.c
    1.5KB
  • ex4-9.hex
    1.6KB
  • ex4-9.M51
    7.7KB
  • ex4-9_Opt.Bak
    1KB
  • ex4-9.Uv2
    2.1KB
  • ex4-9_Uv2.Bak
    1.9KB
  • ex4-9.Opt
    1KB
  • ex4-5
  • ex4-5.LST
    3KB
  • ex4-5
    3.3KB
  • ex4-5.C
    1.3KB
  • ex4-5.Opt
    1KB
  • ex4-5.M51
    4.6KB
  • ex4-5.plg
    201B
  • ex4-5.hex
    401B
  • ex4-5_Uv2.Bak
    1.9KB
  • ex4-5.lnp
    27B
  • ex4-5.OBJ
    3.5KB
  • ex4-5_Opt.Bak
    843B
  • ex4-5.Uv2
    2KB
  • ex5-3
  • delay100us.__i
    63B
  • ex5-3.Opt
    1.2KB
  • keypad.OBJ
    3.5KB
  • ex5-3
    24.5KB
  • keypad.LST
    3.5KB
  • keypad.c
    1.5KB
  • ex5-3.lnp
    73B
  • ex5-3.hex
    5.5KB
内容介绍
/* ex6-5.C - 绘图型 LCD 数字时钟 */ #include <REGX51.H> #define TIMER0_COUNT 0xDC11 /* 10000h-((11,059,200/ (12*FREQ))- 17 */ /*绘图型 LCD 指令 */ #define GLCD_OFF 62 #define GLCD_ON 63 #define GLCD_START_LINE_0 192 #define SET_PAGE 184 #define SET_Y_ADDRESS_0 64 #define CLEAR 0 /*绘图型 LCD 控制线 */ #define ENABLE 1 #define DISABLE 0 #define READ 1 #define WRITE 0 #define COMMAND 0 #define DATA 1 #define GLCD_RESET P2_2 #define GLCD_CS2 P2_3 #define GLCD_CS1 P2_4 #define GLCD_D_I P2_5 #define GLCD_R_W P2_6 #define GLCD_ENABLE P2_7 // #define mode_button P2_0 #define up_button P2_1 typedef struct { char hour; char minute; char second; } time; typedef struct { char year; char month; char day; } date; time now={23,59,0},display; date today={5,9,1},tmpday; unsigned char gx,gy,mode; static unsigned timer0_tick; char code int2char[]="0123456789"; char code dayofmonth[]={31,28,31,30,31,30,31,31,30,31,30,31}; unsigned char code digit[10][4][8]= //0 {{ {0X00,0X00,0X00,0XFC,0XFE,0X03,0X01,0X81}, {0XC1,0X61,0X31,0X1B,0XFE,0XFC,0X00,0X00}, {0X00,0X00,0X00,0X0F,0X1F,0X36,0X23,0X21}, {0X20,0X20,0X20,0X30,0X1F,0X0F,0X00,0X00}}, //1 { {0X00,0X00,0X00,0X00,0X00,0X04,0X06,0XFF}, {0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00}, {0X00,0X00,0X00,0X00,0X20,0X20,0X20,0X3F}, {0X3F,0X20,0X20,0X20,0X00,0X00,0X00,0X00}}, //2 { {0X00,0X00,0X00,0X1C,0X1E,0X03,0X01,0X81}, {0XC1,0X41,0X61,0X33,0X3E,0X1C,0X00,0X00}, {0X00,0X00,0X00,0X3C,0X3E,0X33,0X31,0X31}, {0X30,0X30,0X30,0X30,0X30,0X3C,0X00,0X00}}, //3 { {0X00,0X00,0X00,0X0C,0X0E,0X02,0X01,0X41}, {0X41,0XE1,0XE1,0XB2,0X1E,0X0C,0X00,0X00}, {0X00,0X00,0X00,0X0C,0X1C,0X10,0X20,0X20}, {0X20,0X20,0X20,0X11,0X1F,0X0E,0X00,0X00}}, //4 { {0X00,0X00,0X80,0XC0,0X60,0X30,0X18,0X0C}, {0X06,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00}, {0X00,0X07,0X07,0X04,0X04,0X04,0X04,0X24}, {0X24,0X3F,0X3F,0X24,0X24,0X04,0X00,0X00}}, //5 { {0X00,0X00,0X00,0XFF,0XFF,0X43,0X23,0X23}, {0X23,0X23,0X23,0X43,0XC3,0X80,0X00,0X00}, {0X00,0X00,0X00,0X0C,0X1C,0X10,0X20,0X20}, {0X20,0X20,0X20,0X10,0X1F,0X0F,0X00,0X00},}, //6 { {0X00,0X00,0X00,0XFC,0XFE,0X82,0X41,0X41}, {0X41,0X41,0X41,0XC7,0X86,0X00,0X00,0X00}, {0X00,0X00,0X00,0X0F,0X1F,0X30,0X20,0X20}, {0X20,0X20,0X20,0X10,0X1F,0X0F,0X00,0X00}}, //7 { {0X00,0X00,0X00,0X0F,0X03,0X03,0X03,0X03}, {0X83,0XC3,0X63,0X33,0X1F,0X0F,0X00,0X00}, {0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X3F}, {0X3F,0X00,0X00,0X00,0X00,0X00,0X00,0X00}}, //8 { {0X00,0X00,0X00,0X1C,0XBE,0XE2,0X41,0X41}, {0X41,0X41,0XE2,0XBE,0X1C,0X00,0X00,0X00}, {0X00,0X00,0X0E,0X1F,0X11,0X20,0X20,0X20}, {0X20,0X20,0X20,0X11,0X1F,0X0E,0X00,0X00}}, //9 { {0X00,0X00,0X00,0X7C,0XFE,0X82,0X01,0X01}, {0X01,0X01,0X82,0XC6,0XFC,0XF8,0X00,0X00}, {0X00,0X00,0X00,0X0C,0X1C,0X18,0X21,0X21}, {0X21,0X21,0X10,0X1C,0X0F,0X03,0X00,0X00}}}; unsigned char code slash[4][8]= /// { {0X00,0X00,0X00,0X00,0X00,0X80,0XC0,0X60}, {0X30,0X18,0X0C,0X06,0X03,0X01,0X00,0X00}, {0X30,0X18,0X0C,0X06,0X03,0X01,0X00,0X00}, {0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00}}; //: unsigned char code comma[4][8]= { {0X00,0X00,0X00,0X00,0X00,0X00,0X10,0X38}, {0X38,0X10,0X00,0X00,0X00,0X00,0X00,0X00}, {0X00,0X00,0X00,0X00,0X00,0X00,0X02,0X07}, {0X07,0X02,0X00,0X00,0X00,0X00,0X00,0X00}}; unsigned char code space[4][8]= { {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}}; unsigned char code token[7][4][8]= { { {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}}, //现 { {0X42,0X42,0XFE,0X43,0X42,0X00,0X00,0XFE}, {0X49,0X49,0X49,0X49,0XFF,0X00,0X00,0X00}, {0X08,0X18,0X0F,0X04,0X22,0X20,0X20,0X13}, {0X0E,0X01,0X01,0X3E,0X23,0X20,0X30,0X00}}, //在 { {0X02,0X02,0X02,0X84,0X64,0X1C,0X87,0X84}, {0X84,0XF4,0X84,0X84,0XC4,0X86,0x04,0X00}, {0X04,0X02,0X01,0X3F,0X00,0X10,0X10,0X10}, {0X10,0X1F,0X10,0X10,0X10,0X18,0X10,0X00}}, //时 { {0XFC,0X44,0X44,0XFC,0X80,0X92,0X92,0X52}, {0X52,0X5F,0X52,0XF2,0X9A,0XD2,0X80,0X00}, {0X0F,0X04,0X04,0X0F,0X00,0X00,0X02,0X04}, {0X80,0X00,0X40,0X1F,0X00,0X00,0X00,0X00}}, //间 { {0X00,0XFF,0X15,0X15,0X15,0X95,0X9F,0X10}, {0X10,0X9F,0X95,0X15,0X15,0X15,0XFF,0X00}, {0X00,0X3F,0X00,0X00,0X00,0X0F,0X0A,0X0A}, {0X0A,0X0A,0X0F,0X00,0X20,0X20,0X1F,0X00}}, //是 { {0X40,0X40,0X40,0X5F,0X55,0X55,0X55,0XD5}, {0X55,0X55,0X55,0X5F,0X40,0X60,0X40,0X00}, {0X20,0X10,0X08,0X07,0X08,0X10,0X20,0X3F}, {0X22,0X22,0X22,0X23,0X22,0X20,0X20,0X00}}, //: { {0X00,0X00,0X00,0X00,0X00,0X00,0X10,0X38}, {0X38,0X10,0X00,0X00,0X00,0X00,0X00,0X00}, {0X00,0X00,0X00,0X00,0X00,0X00,0X02,0X07}, {0X07,0X02,0X00,0X00,0X00,0X00,0X00,0X00}}}; void check_GLCD_busyflag(void) { unsigned char x; GLCD_R_W=READ; GLCD_D_I=COMMAND; GLCD_ENABLE=ENABLE; P0=255; do { x=P0 && 128; } while(x); GLCD_ENABLE=DISABLE; GLCD_D_I=1; GLCD_R_W=1; } void write_GLCD_command(unsigned command) { GLCD_R_W=WRITE; GLCD_D_I=COMMAND; GLCD_ENABLE=ENABLE; P0=command; GLCD_ENABLE=DISABLE; GLCD_D_I=1; GLCD_R_W=1; check_GLCD_busyflag(); } void write_GLCD_data(unsigned GLCDdata) { GLCD_R_W=WRITE; GLCD_D_I=DATA; GLCD_ENABLE=ENABLE; P0=GLCDdata; GLCD_ENABLE=DISABLE; GLCD_D_I=0; GLCD_R_W=1; check_GLCD_busyflag(); } void clear_GLCD() { int i,j; GLCD_RESET=0; for(i=0;i<2;i++); GLCD_RESET=1; GLCD_CS1=1; GLCD_CS2=1; write_GLCD_command(GLCD_ON); write_GLCD_command(GLCD_START_LINE_0); for(i=0;i<8;i++) { write_GLCD_command(SET_PAGE+i); write_GLCD_command(SET_Y_ADDRESS_0); for(j=0;j<64;j++) write_GLCD_data(0); } } void show_pattern(unsigned char page,unsigned char y, unsigned char *pattern,unsigned char len) { int i; write_GLCD_command(SET_PAGE+page); write_GLCD_command(SET_Y_ADDRESS_0+y); for(i=0;i<len;i++) { write_GLCD_data(*pattern); pattern++; } } void display_GLCD_data(unsigned char *p) { if (gx<64) { GLCD_CS1=1; GLCD_CS2=0; show_pattern(gy,gx,p,8); show_pattern(gy,gx+8,p+8,8); show_pattern(gy+1,gx,p+16,8); show_pattern(gy+1,gx+8,p+24,8); } else { GLCD_CS1=0; GLCD_CS2=1; show_pattern(gy,gx-64,p,8); show_pattern(gy,gx-58,p+8,8); show_pattern(gy+1,gx-64,p+16,8); show_pattern(gy+1,gx-58,p+24,8); } gx=gx+16; } void display_GLCD_string(unsigned char *p,int len) { int i; for(i=0;i<len;i++) display_GLCD_data((p+32*i)); } void display_GLCD_number(char number) { int x,y; x=number/10; y=number%10
评论
    相关推荐