找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 2054|回复: 6
打印 上一主题 下一主题
收起左侧

哪位大神有时间帮我解决一下程序问题的

[复制链接]
跳转到指定楼层
楼主
ID:157990 发表于 2016-12-27 16:50 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
表示错误有点多 我只是想让它运行起来
  1. #include <reg51.h>
  2. #ifndef _12864ZIFU_H_
  3. #define _12864ZIFU_H_
  4. unchar code
  5. shu0[]={0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00};/*"0",0*/
  6. unchar code
  7. shu1[]={0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00};/*"1",0*/
  8. unchar code
  9. shu2[]={0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00};/*"2",0*/
  10. unchar code
  11. shu3[]={0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00};/*"3",0*/
  12. unchar code
  13. shu4[]={0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00};/*"4",0*/
  14. unchar code
  15. shu5[]={0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00};/*"5",0*/
  16. unchar code
  17. shu6[]={0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00};/*"6",0*/
  18. unchar code
  19. shu7[]={0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00};/*"7",0*/
  20. unchar code
  21. shu8[]={0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00};/*"8",0*/
  22. unchar code
  23. shu9[]={0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00};/*"9",0*/
  24. unchar code
  25. dian[]={0x00,0x38,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};/*"°",0*/
  26. unchar code
  27. C[]={0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00};/*"C",0*/
  28. unchar code
  29. xiao[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00};/*".",0*/
  30. unchar code
  31. jian[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01};
  32. unchar code
  33. jia[]={0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x1F,0x01,0x01,0x01,0x00};/*"+",0*/
  34. unchar code
  35. maohao[]={0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00};/*":",0*/
  36. uchar code nian[]=
  37. {0x40,0x20,0x10,0x0C,0xE3,0x22,0x22,0x22,0xFE,0x22,0x22,0x22,0x22,0x02,0x00,0x00,
  38. 0x04,0x04,0x04,0x04,0x07,0x04,0x04,0x04,0xFF,0x04,0x04,0x04,0x04,0x04,0x04,0x00};/*"年",0*/
  39. uchar code yue[]=
  40. {0x00,0x00,0x00,0x00,0x00,0xFF,0x11,0x11,0x11,0x11,0x11,0xFF,0x00,0x00,0x00,0x00,
  41. 0x00,0x40,0x20,0x10,0x0C,0x03,0x01,0x01,0x01,0x21,0x41,0x3F,0x00,0x00,0x00,0x00};/*"月",0*/
  42. uchar code shi[]=
  43. {0x00,0xFC,0x44,0x44,0x44,0xFC,0x10,0x90,0x10,0x10,0x10,0xFF,0x10,0x10,0x10,0x00,
  44. 0x00,0x07,0x04,0x04,0x04,0x07,0x00,0x00,0x03,0x40,0x80,0x7F,0x00,0x00,0x00,0x00};/*"时",0*/
  45. uchar code fen[]=
  46. {0x80,0x40,0x20,0x98,0x87,0x82,0x80,0x80,0x83,0x84,0x98,0x30,0x60,0xC0,0x40,0x00,0x00,0x80,0x40,0x20,0x10,0x0F,0x00,0x00,0x20,0x40,0x3F,0x00,0x00,0x00,0x00,0x00};/*"分",0*/
  47. uchar code miao[]=
  48. {0x12,0x12,0xD2,0xFE,0x91,0x11,0xC0,0x38,0x10,0x00,0xFF,0x00,0x08,0x10,0x60,0x00,
  49. 0x04,0x03,0x00,0xFF,0x00,0x83,0x80,0x40,0x40,0x20,0x23,0x10,0x08,0x04,0x03,0x00};/*"秒",0*/
  50. uchar code ri[]=
  51. {0x00,0x00,0x00,0xFE,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0xFE,0x00,0x00,0x00,0x00,
  52. 0x00,0x00,0x00,0x3F,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x3F,0x00,0x00,0x00,0x00};/*"日",0*/
  53. uchar code zj_dong[]=
  54. {/*--  文字:  东  --*/
  55. /*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
  56. 0x00,0x04,0x04,0xC4,0xB4,0x8C,0x87,0x84,0xF4,0x84,0x84,0x84,0x84,0x04,0x00,0x00,
  57. 0x00,0x00,0x20,0x18,0x0E,0x04,0x20,0x40,0xFF,0x00,0x02,0x04,0x18,0x30,0x00,0x00};
  58. uchar code zj_bei[]=
  59. {/*--  文字:  北  --*/
  60. /*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
  61. 0x00,0x20,0x20,0x20,0x20,0xFF,0x00,0x00,0x00,0xFF,0x40,0x20,0x30,0x18,0x10,0x00,
  62. 0x10,0x30,0x18,0x08,0x04,0x7F,0x00,0x00,0x00,0x3F,0x40,0x40,0x40,0x40,0x78,0x00};
  63. uchar code zj_shi[]=
  64. {/*--  文字:  石  --*/
  65. /*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
  66. 0x02,0x02,0x02,0x02,0x82,0xF2,0x4E,0x42,0x42,0x42,0x42,0x42,0xC2,0x02,0x02,0x00,
  67. 0x10,0x08,0x04,0x02,0x01,0x7F,0x20,0x20,0x20,0x20,0x20,0x20,0x7F,0x00,0x00,0x00
  68. };
  69. uchar code zj_you[]=
  70. {/*--  文字:  油  --*/
  71. /*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
  72. 0x10,0x61,0x06,0xF0,0x00,0xF0,0x10,0x10,0x10,0xFF,0x10,0x10,0x10,0xF0,0x00,0x00,
  73. 0x04,0x04,0xFF,0x00,0x00,0xFF,0x42,0x42,0x42,0x7F,0x42,0x42,0x42,0xFF,0x00,0x00};
  74. uchar code zj_da[]=
  75. {/*--  文字:  大  --*/
  76. /*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
  77. 0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0x7F,0xA0,0x20,0x20,0x20,0x20,0x20,0x20,0x00,
  78. 0x00,0x80,0x40,0x20,0x10,0x0C,0x03,0x00,0x01,0x06,0x08,0x30,0x60,0xC0,0x40,0x00};
  79. uchar code zj_xue[]=
  80. {/*--  文字:  学  --*/
  81. /*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
  82. 0x40,0x30,0x10,0x12,0x5C,0x54,0x50,0x51,0x5E,0xD4,0x50,0x18,0x57,0x32,0x10,0x00,
  83. 0x00,0x02,0x02,0x02,0x02,0x02,0x42,0x82,0x7F,0x02,0x02,0x02,0x02,0x02,0x02,0x00};
  84. uchar code zj_dian[]=
  85. {/*--  文字:  电  --*/
  86. /*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
  87. 0x00,0x00,0xF8,0x48,0x48,0x48,0x48,0xFF,0x48,0x48,0x48,0x48,0xF8,0x00,0x00,0x00,
  88. 0x00,0x00,0x0F,0x04,0x04,0x04,0x04,0x3F,0x44,0x44,0x44,0x44,0x4F,0x40,0x70,0x00,};
  89. uchar code zj_qi[]=
  90. {/*--  文字:  气  --*/
  91. /*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
  92. 0x00,0x20,0x10,0x8C,0xA7,0xA4,0xA4,0xA4,0xA4,0xA4,0xA4,0xA4,0x24,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x30,0x40,0xF0,0x00};
  93. uchar code zj_yuan[]=
  94. {/*--  文字:  院  --*/
  95. /*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
  96. 0xFE,0x02,0x32,0x4A,0x86,0x0C,0x24,0x24,0x25,0x26,0x24,0x24,0x24,0x0C,0x04,0x00,
  97. 0xFF,0x00,0x02,0x04,0x83,0x41,0x31,0x0F,0x01,0x01,0x7F,0x81,0x81,0x81,0xF1,0x00};
  98. uchar code xiaoren[]=
  99. {0x00,0x00,0x80,0x88,0x9C,0xA2,0x45,0xD1,0xD1,0x45,0xA2,0x9C,0x88,0x80,0x00,0x00,
  100. 0x07,0x01,0x03,0x04,0x0C,0x98,0xF9,0x0A,0x0A,0xF9,0x98,0x0C,0x04,0x03,0x01,0x07};/*"小人",0*/
  101. uchar code zj_xingxing[]=
  102. {0x40,0x40,0xC0,0xC0,0xC0,0xE0,0xFC,0xFF,0xFC,0xE0,0xC0,0xC0,0xC0,0x40,0x40,0x00,
  103. 0x00,0x00,0x40,0x39,0x3F,0x1F,0x1F,0x0F,0x1F,0x1F,0x3F,0x39,0x40,0x00,0x00,0x00};/*"★",0*/
  104. #endif
  105. #ifndef _KEYSCNA_H_
  106. #define _KEYSCNA_H_/*#define dataport P3 uchar sum;          */
  107. uchar read_keyscan()
  108. {   uchar col,flagg,line,num,temp;
  109.         P3=0xf0;
  110.         delay_us();
  111.         delay_us();
  112.         delay_us();        //等待按键按下
  113.         flagg=P3&0xf0;
  114.         if(flagg!=0xf0) //         检测是否有按键按下
  115.         {   for(line=0;line<3;line++)
  116.                 {   P3=tab[line];
  117.                         temp=P3&0xf0;
  118.                         delay(5); //判断行
  119. if(temp!=0xf0)
  120.                         {   switch(temp)
  121.                                 {case 0xe0:col=0;break;        //判断列
  122.                                         case 0xd0:col=1;break;
  123.                                         case 0xb0:col=2;break;
  124.                                         default: break;}
  125.                                 break;}}}
  126.         P3=0xf0;
  127.         while(P3!=0xf0); //检测是否松手
  128.            num=line*3+col;          
  129.          return num;   //返回值为0,1,2,3,4,5,6,7,8
  130. }/*
  131. uchar scan(uchar k)       
  132. {  uchar re;
  133.   switch (k)
  134.   { case 1:re=0;break;
  135.         case 2:re=1;break;
  136.         case 4:re=2;break;
  137.         default:break; }
  138.   return re;}
  139. void read_keyscan()
  140. { uchar m,n;
  141.   dataport=0x07;
  142.   delay_us();
  143.   if(dataport!=0x07)
  144.   {  dataport=0x07;
  145.         delay(5);
  146.         m=dataport&0x07;
  147.         if(m!=0x07)
  148.         {  m=m^0x07;
  149.           m=scan(m);
  150.           dataport=0x70;
  151.           delay_us();
  152.           n=dataport&0x70;
  153.           if(n!=0x70)
  154.           {  n=n>>4;
  155.                 n=n^0x07;
  156.                 n=scan(n);
  157.                 sum=3*m+n;}}
  158.                 dataport=0x07;
  159.         while(dataport!=0x07);}        }*/        //输出012345678
  160. void keyscan_manage()
  161. {        count=read_keyscan();
  162.         switch(count)
  163.         {   case 0:setflag=1;flag0=1;break;                //设置
  164.                 case 1:add=0x88;flag0=1;break;                //月
  165.                 case 2:add=0x86;flag0=1;break;                //日
  166.                 case 3:add=0x84;flag0=1;break;                //时
  167.                 case 4:add=0x82;flag0=1;break;                //分
  168.                 case 5:setflag=0;flag0=1;break;                //退出设置
  169.             default: break;}
  170.         if(flag0==1&&setflag==1)
  171.         {  count=read_keyscan();
  172.                 if(count==1)
  173.                 {   count=0xff;
  174.                         DS_set_time(add,1);}
  175.                 if(count==2)
  176.                 {   count=0xff;
  177.                         DS_set_time(add,1);}
  178.                 if(count==3)
  179.                 {   count=0xff;
  180.                         DS_set_time(add,1);}
  181.                 if(count==4)
  182.                    {   count=0xff;
  183.                         DS_set_time(add,1);}
  184. if(count==5)
  185.                 {  count=0xff;
  186.                         setflag=0;}}
  187. #endif
  188. #ifndef _LCD12864_H_
  189. #define _LCD12864_H_
  190. /************选屏*****************/
  191. void LCD_choose(uchar cs)
  192. {  switch(cs)
  193.         {   case 0:cs1=0;cs2=1;        break;
  194.                 case 1:cs1=1;cs2=0;        break;
  195.                 case 2:cs1=0;cs2=0;        break;
  196.                 default: break;}}
  197. /**************忙检查***************************/
  198. void LCD_check_busy()
  199. {   uchar state;
  200.         rs=0;
  201.         rw=1;
  202.         do
  203.         {   P0=0x00;
  204.                 en=1;
  205.                 state=P0&0x80;
  206.                 en=0;}
  207.         while(state==0x80);
  208. }
  209. /****************写命令********************/
  210. void LCD_write_cmd(uchar cmd)
  211. {   LCD_check_busy();
  212.         rs=0;
  213.         rw=0;
  214.         en=1;
  215.         P0=cmd;
  216.         delay(2);
  217.         en=0;
  218. }
  219. /*******写数据**********************/
  220. void LCD_write_data(uchar dat)
  221. {  LCD_check_busy();
  222.         rs=1;
  223.         rw=0;
  224.         en=1;
  225.         P0=dat;
  226.         delay(2);
  227.         en=0;}
  228. /************读数据****************/
  229. /*uchar LCD_read_data(uchar cs,uchar page,uchar row)
  230. {   uchar dat;
  231.         LCD_check_busy();
  232. LCD_write_cmd(0xb8+page);
  233.         LCD_write_cmd(0x40+row);
  234.         P0=0xff;
  235.         rs=0;
  236.         rw=1;
  237.         en=1;
  238.         en=0;
  239.         en=1;
  240.         dat=P0;
  241.         en=0;
  242.         delay_us();
  243.         return dat;}  */
  244. /*********写小数点*******************/
  245. /*void LCD_display_dot(uchar cs,uchar page,uchar row)
  246. {   LCD_choose(cs);
  247.         page=page/8;
  248.         LCD_write_cmd(0xb8+page);
  249.         LCD_write_cmd(0x40+row);
  250.         LCD_write_data(0x01);
  251. }*/
  252. /*****清屏*****************/
  253. void LCD_clear()
  254. {   uchar i,j;
  255.         LCD_choose(2);
  256.     LCD_write_cmd(0xb8);
  257.         LCD_write_cmd(0x40);
  258.         for(i=0;i<8;i++)
  259.         {  LCD_write_cmd(i+0xb8);
  260.                 for(j=0;j<64;j++)
  261. {  LCD_write_cmd(0x40+j);
  262.                         LCD_write_data(0x00);}}}       
  263. /*8x8 点阵显示*/               
  264. void LCD_display8(uchar cs,uchar page,uchar row,uchar *s)
  265.                         {   uchar i;
  266.         LCD_choose(cs);
  267.         page<<=1;
  268.         row=row*8;
  269.         LCD_write_cmd(0xb8+page);
  270.         LCD_write_cmd(0x40+row);
  271.         for(i=0;i<8;i++)
  272.                 LCD_write_data(s[i]);
  273.         LCD_write_cmd(0xb9+page);
  274.         LCD_write_cmd(0x40+row);
  275.         for(i=8;i<16;i++)
  276.                 LCD_write_data(s[i]);}
  277. /***16X16点阵显示***/
  278. void LCD_display16(uchar cs,uchar page,uchar row,uchar *s)
  279. {   uchar i;
  280.         LCD_choose(cs);
  281.         page<<=1;
  282.         row=row*8;
  283.         LCD_write_cmd(0xb8+page);
  284.         LCD_write_cmd(0x40+row);
  285.    for(i=0;i<16;i++)
  286.                 LCD_write_data(s[i]);
  287.         LCD_write_cmd(0xb9+page);
  288.         LCD_write_cmd(0x40+row);
  289. for(i=16;i<32;i++)
  290.                 LCD_write_data(s[i]);}
  291. /************初始化*****************************/
  292. void LCD_init()
  293. {   LCD_choose(2);
  294.    LCD_write_cmd(0x3e);
  295.         LCD_write_cmd(0x30);
  296.         LCD_write_cmd(0x30);
  297.         LCD_write_cmd(0xc0);
  298.         LCD_write_cmd(0xb8);
  299.         LCD_write_cmd(0x40);
  300.         LCD_write_cmd(0x3f);
  301.         delay(1);}
  302. /********显示时间**************************/
  303. void LCD_display_time()
  304. {   LCD_display8(0,2,6,(shu0+16*(second/10)));
  305.         LCD_display8(0,2,7,(shu0+16*(second%10)));
  306.         LCD_display8(0,2,3,(shu0+16*(minute/10)));
  307.         LCD_display8(0,2,4,(shu0+16*(minute%10)));
  308.         LCD_display8(0,2,0,(shu0+16*(hour/10)));
  309.         LCD_display8(0,2,1,(shu0+16*(hour%10)));
  310.         LCD_display8(1,1,3,(shu0+16*(date/10)));
  311.         LCD_display8(1,1,4,(shu0+16*(date%10)));
  312.         LCD_display8(0,1,7,(shu0+16*(month/10)));
  313.         LCD_display8(1,1,0,(shu0+16*(month%10)));
  314.    LCD_display8(0,1,3,(shu0+16*(year/10)));
  315.         LCD_display8(0,1,4,(shu0+16*(year%10)));
  316. LCD_display16(1,2,6,(yi+32*(day-2)));}
  317. #endif
  318. #ifndef _DELAY_H_
  319. #define _DELAY_H_
  320. void delay(uint z)
  321. {uint x,y;
  322.         for(y=z;y>0;y--)
  323.                 for(x=10;x>0;x--);}
  324. void delay_us()
  325. {_nop_();_nop_();}
  326. #endif
  327. #ifndef _DEFINE_H_
  328. #define _DEFINE_H_
  329. #define uchar unsigned char
  330. #define uint unsigned int
  331. sbit rst=P1^5;
  332. sbit io=P1^7;
  333. sbit sclk=P1^6;
  334. sbit rs=P2^0;
  335. sbit rw=P2^1;
  336. sbit en=P2^2;
  337. sbit cs1=P2^3;         
  338. sbit cs2=P2^4;
  339. sbit led=P1^4;
  340. sbit led1=P1^3;
  341. charhour,minute,second,year,month,date,day;
  342. uchartemp,flag0,flag1,cs,page,row,count,add,setflag;
  343. uchar tab[4]={0xfe,0xfd,0xfb};
  344. #endif
  345. 头文件
  346. #ifndef __INTRINS_H__
  347. #define __INTRINS_H__
  348. externvoid_nop_ (void);
  349. externbit_testbit_(bit);externunsignedchar_cror_(unsignedchar, unsigned char);
  350. extern unsigned int_iror_(unsigned int,  unsigned char);
  351. externunsignedlong_lror_(unsignedlong, unsigned char);
  352. externunsignedchar_crol_(unsigned char, unsigned char);
  353. externunsignedint_irol_(unsigned int,  unsigned char);
  354. externunsignedlong_lrol_(unsigned long, unsigned char);
  355. extern unsigned char _chkfloat_(float);
  356. extern void_push_ (unsigned char _sfr);
  357. extern void_pop_(unsigned char _sfr);
  358. #endif
  359. #ifndef __REG52_H__
  360. #define __REG52_H__
  361. /*  BYTE Registers  */
  362. sfr P0    = 0x80;
  363. sfr P1    = 0x90;
  364. sfr P2    = 0xA0;
  365. sfr P3    = 0xB0;
  366. sfr PSW   = 0xD0;
  367. sfr ACC   = 0xE0;
  368. sfr B     = 0xF0;
  369. sfr SP    = 0x81;
  370. sfr DPL   = 0x82;
  371. sfr DPH   = 0x83;
  372. sfr PCON  = 0x87;
  373. sfr TCON  = 0x88;
  374. sfr TMOD  = 0x89;
  375. sfr TL0   = 0x8A;
  376. sfr TL1   = 0x8B;
  377. sfr TH0   = 0x8C;
  378. sfr TH1   = 0x8D;
  379. sfr IE    = 0xA8;
  380. sfr IP    = 0xB8;
  381. sfr SCON  = 0x98;
  382. sfr SBUF  = 0x99;
  383. /*  8051Extensions  */
  384. sfr T2CON  = 0xC8;
  385. sfr RCAP2L = 0xCA;
  386. sfr RCAP2H = 0xCB;
  387. sfr TL2    = 0xCC;
  388. sfr TH2    = 0xCD;
  389. /*  BIT Registers  */
  390. /*  PSW  */
  391. sbit CY    = PSW^7;
  392. sbit AC    = PSW^6;
  393. sbit F0    = PSW^5;
  394. sbit RS1   = PSW^4;
  395. sbit RS0   = PSW^3;
  396. sbit OV    = PSW^2;
  397. sbit P     = PSW^0; //8051 only
  398. /*  TCON  */
  399. sbit TF1   = TCON^7;
  400. sbit TR1   = TCON^6;
  401. sbit TF0   = TCON^5;
  402. sbit TR0   = TCON^4;
  403. sbit IE1   = TCON^3;
  404. sbit IT1   = TCON^2;
  405. sbit IE0   = TCON^1;
  406. sbit IT0   = TCON^0;
  407. /*  IE  */
  408. sbit EA    = IE^7;
  409. sbit ET2   = IE^5; //8051 only
  410. sbit ES    = IE^4;
  411. sbit ET1   = IE^3;
  412. sbit EX1   = IE^2;
  413. sbit ET0   = IE^1;
  414. sbit EX0   = IE^0;
  415. /*  IP  */
  416. sbit PT2   = IP^5;
  417. sbit PS    = IP^4;
  418. sbit PT1   = IP^3;
  419. sbit PX1   = IP^2;
  420. sbit PT0   = IP^1;
  421. sbit PX0   = IP^0;
  422. /*  P3  */
  423. sbit RD    = P3^7;
  424. sbit WR    = P3^6;
  425. sbit T1    = P3^5;
  426. sbit T0    = P3^4;
  427. sbit INT1  = P3^3;
  428. sbit INT0  = P3^2;
  429. sbit TXD   = P3^1;
  430. sbit RXD   = P3^0;
  431. /*  SCON  */
  432. sbit SM0   = SCON^7;
  433. sbit SM1   = SCON^6;
  434. sbit SM2   = SCON^5;
  435. sbit REN   = SCON^4;
  436. sbit TB8   = SCON^3;
  437. sbit RB8   = SCON^2;
  438. sbit TI    = SCON^1;
  439. sbit RI    = SCON^0;
  440. /*  P1  */
  441. sbit T2EX  = P1^1; // 8052 only
  442. sbit T2    = P1^0; // 8052 only
  443. /*  T2CON  */
  444. sbit TF2    = T2CON^7;
  445. sbit EXF2   = T2CON^6;
  446. sbit RCLK   = T2CON^5;
  447. sbit TCLK   = T2CON^4;
  448. sbit EXEN2  = T2CON^3;
  449. sbit TR2    = T2CON^2;
  450. sbit C_T2   = T2CON^1;
  451. sbit CP_RL2 = T2CON^0;
  452. #endif
  453. #include<reg52.h>
  454. #include<intrins.h>
  455. #include"define.h"
  456. #include"delay.h"
  457. #include"12864zifu.h"
  458. #include"DS1302.h"
  459. #include"LCD12864.h"
  460. #include"keyscan.h"
  461. void main()
  462. {   LCD_init();
  463.         LCD_clear();
  464.         DS_init();
  465.         DS_set_type(1);//有错
  466.         time_init(); //初始化设置时间
  467.    LCD_display8(0,1,1,shu2);
  468.         LCD_display8(0,1,2,shu0);
  469.    LCD_display16(0,1,5,nian);
  470.         LCD_display16(1,1,1,yue);
  471.         LCD_display16(1,1,5,ri);
  472.         LCD_display8(0,2,2,maohao);
  473.         LCD_display8(0,2,5,maohao);
  474.    LCD_display16(1,2,2,xing);
  475.         LCD_display16(1,2,4,qi);
  476.    LCD_display16(0,0,0,zj_xingxing);
  477.            LCD_display16(0,0,2,zj_chang);
  478.         LCD_display16(0,0,4,zj_shu);
  479.         LCD_display16(0,0,6,zj_li);
  480.         LCD_display16(1,0,0,zj_gong);
  481.    LCD_display16(1,0,2,zj_xue);
  482.         LCD_display16(1,0,4,zj_yuan);
  483.         LCD_display16(1,0,6,zj_xingxing);
  484.    LCD_display16(1,3,4,xiaoren);
  485.         LCD_display16(1,3,6,xiaoren);
  486.         while(1)
  487.         {        keyscan_manage();
  488.                 DS_gettime();
  489.                 LCD_display_time();               
  490.         }          
  491. }

复制代码


错误的稿子.docx

16.78 KB, 下载次数: 6

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

沙发
ID:157990 发表于 2016-12-27 16:51 | 只看该作者
急需大神帮帮忙
回复

使用道具 举报

板凳
ID:65425 发表于 2016-12-27 17:04 | 只看该作者
我去,我一下了看这一定是网上下载的吧,解决问题还浪费我5黑币.很多情况在网页上找的都不能直接用,要么自己敲代码。你先在论坛里找找有木有能用的吧,程序你要一段一段测试,才能更好找到问题!
回复

使用道具 举报

地板
ID:57896 发表于 2016-12-27 17:31 | 只看该作者
贴程序出来啊,人家要看你的程序还要下载,下载要“黑币”呢!
回复

使用道具 举报

5#
ID:74784 发表于 2016-12-27 19:46 | 只看该作者
下栽你的稿子帮你
还得给你付钱~~~~~~~~~~晕忽忽
回复

使用道具 举报

6#
ID:7485 发表于 2016-12-27 20:43 | 只看该作者
把程序直接粘贴上。
回复

使用道具 举报

7#
ID:1 发表于 2017-1-2 01:06 | 只看该作者
是编译有问题吗?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表