標題: *** ERROR L104: MULTIPLE PUBLIC DEFINITIONS keil編程報錯 [打印本頁]

作者: Smiletiger    時間: 2018-6-5 23:46
標題: *** ERROR L104: MULTIPLE PUBLIC DEFINITIONS keil編程報錯
//Build target 'Target 1'
compiling PWM調(diào)制.c...
PWM調(diào)制.C(1): warning C500: LICENSE ERROR (R208: RENEW LICENSE ID CODE (LIC))
linking...
*** ERROR L104: MULTIPLE PUBLIC DEFINITIONS
    SYMBOL:  TIMER1
    MODULE:  PWM調(diào)制.obj (PWM調(diào)_?
Program Size: data=10.0 xdata=0 code=83
Target not created//
啥情況?大佬,求解啊

單片機源碼:
  1. #include"reg52.h"
  2. #define  u16 unsigned int
  3. #define  u8 unsigned char
  4. void Time1Config();

  5. sbit PWM1=P0^3;
  6. sbit PWM2=P0^4;
  7. sbit PWM3=P0^5;
  8. sbit PWM4=P0^6;

  9. u8 timer1;
  10. void main()
  11. {

  12.     Time1Config();
  13.     while(1)
  14.     {
  15.         if(timer1>100)
  16.         {
  17.             timer1=0;
  18.         }
  19.         if(timer1<30)
  20.         {
  21.             PWM1=1;PWM2=1;PWM3=1;PWM4=1;
  22.         }
  23.         else
  24.         {
  25.             PWM1=0;PWM2=0;PWM3=0;PWM4=0;
  26.         }

  27.     }
  28. }
  29. void Time1Config()
  30. {
  31.     TMOD|= 0x10;
  32.     TH1=0xfe;
  33.     TL1=0x0c;
  34.     ET1=1;
  35.     EA=1;
  36.     TR1=1;
  37. }

  38. void Timer1() interrupt 3
  39. {
  40.     TH1=0XFE;
  41.     TL1=0x0c;
  42.     timer1++;
  43. }
復(fù)制代碼



作者: wulin    時間: 2018-6-6 06:04
變量u8 timer1;與中斷函數(shù)Timer1()同名錯誤。
作者: zhanghyg    時間: 2018-6-6 08:32

把中斷函數(shù)名字改了,不要和變量一樣,還有你keil版本注冊有問題
作者: zyzs50    時間: 2018-6-6 09:29
timer1 這個變量應(yīng)該是重復(fù)定義了, 你在其它文件里面查看是否有定義
作者: delphifx    時間: 2018-6-6 09:34
變量名稱u8 timer1;和函數(shù)名稱void Timer1()相同,重復(fù)定義。




歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1