找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 4889|回复: 3
收起左侧

*** ERROR L104: MULTIPLE PUBLIC DEFINITIONS 求看看编程问题

[复制链接]
ID:478396 发表于 2019-2-28 11:50 | 显示全部楼层 |阅读模式
Rebuild target 'Target 1'
compiling 18b20.c...
compiling L1602.C...
linking...
*** ERROR L104: MULTIPLE PUBLIC DEFINITIONS
    SYMBOL:  MAIN
    MODULE:  .\L1602.obj (L1602)
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
    SEGMENT: ?PR?MAIN?L1602
Program Size: data=28.0 xdata=0 code=851
Target not created.
Build Time Elapsed:  00:00:01
2.PNG
  1. #include<reg52.h>
  2. sbit RS = P2^0;  
  3. sbit RW = P2^1;
  4. sbit EN = P2^2;

  5. #define RS_CLR RS=0
  6. #define RS_SET RS=1
  7. #define RW_CLR RW=0
  8. #define RW_SET RW=1
  9. #define EN_CLR EN=0
  10. #define EN_SET EN=1


  11. void delay_us(unsigned int r) /{
  12. if (r== 0)
  13.   {  
  14.   return ;  
  15.   }
  16.   while (--r);
  17. }


  18. void delay_ms(unsigned char f)
  19. {
  20. unsigned char k, u;
  21. for (k = 1; k < f; k++)
  22. {
  23.    for (u = 1;u; u++)
  24.    {   ;   }
  25.     }
  26. }


  27. void LCD_write_com(unsigned char com)
  28. {  
  29. RS_CLR;
  30. RW_CLR;
  31. EN_SET;
  32. P0 = com;
  33. delay_us(5);
  34. EN_CLR;
  35. }


  36. void LCD_write_Data(unsigned char Data)
  37. {
  38. RS_SET;
  39. RW_CLR;
  40. EN_SET;
  41. P0 = Data;
  42. delay_us(5);
  43. EN_CLR;
  44. }

  45. void LCD_clear(void)
  46. {
  47. LCD_write_com(0x01);
  48. delay_ms(5);}


  49. void LCD_write_str(unsigned char x1,unsigned char y1,unsigned char *s)
  50. {     
  51. if (y1 == 0)
  52. {     
  53. LCD_write_com(0x80 + x1);     
  54. }
  55. else
  56. {     
  57. LCD_write_com(0xC0 + x1);     
  58. }        
  59. while (*s)
  60. {     
  61. LCD_write_Data( *s);     
  62. s ++;     
  63. }
  64. }


  65. void LCD_write_char(unsigned char x1,unsigned char y1,unsigned char Data)
  66. {     
  67. if (y1 == 0)
  68. {     
  69. LCD_write_com(0x80 + x1);     
  70. }   
  71. else
  72. {     
  73. LCD_write_com(0xC0 + x1);     
  74. }        
  75. LCD_write_Data( Data);  
  76. }


  77. void LCD_init(void)
  78. {
  79.    LCD_write_com(0x38);   
  80.    delay_ms(5);
  81.    LCD_write_com(0x38);
  82.    delay_ms(5);
  83.    LCD_write_com(0x38);
  84.    delay_ms(5);
  85.    LCD_write_com(0x38);  
  86.    LCD_write_com(0x08);   
  87.    LCD_write_com(0x01);  
  88.    LCD_write_com(0x06);   
  89.    delay_ms(5);
  90.    LCD_write_com(0x0C);  
  91.    }

  92.   
  93.    void main(void)
  94. {
  95.   unsigned char i2;
  96. unsigned char *p;
  97. delay_ms(100);
  98. LCD_init();
  99. while (1)
  100. {  
  101. i2 = 1;  
  102. p = "222222";  
  103. LCD_clear();  
  104. LCD_write_str(2,0,"Welcome to");  
  105. delay_ms(250);   
  106. while (*p)
  107. {   
  108. LCD_write_char(i2,1,*p);   
  109. i2 ++;   
  110. p ++;   
  111. delay_ms(250);   
  112. }  
  113. delay_ms(250);  
  114. }
  115. }
复制代码


回复

使用道具 举报

ID:94031 发表于 2019-2-28 16:36 | 显示全部楼层
多重定义,要看整个工程才能找到具体原因。
回复

使用道具 举报

ID:404160 发表于 2019-2-28 17:09 | 显示全部楼层
L1602模块和main模块有同名的定义。
回复

使用道具 举报

ID:758285 发表于 2020-5-25 16:22 | 显示全部楼层
我和你问题一模一样 请问你解决了吗
回复

使用道具 举报

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

本版积分规则

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

Powered by 单片机教程网

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