Redefinition of Label error


Closed Thread
Results 1 to 9 of 9
  1. #1
    Join Date
    Aug 2014
    Posts
    13

    Default Redefinition of Label error

    Hi All,

    I wrote some code some years ago on an early version of PBP 3 for the P16F877A.

    That computer is long gone but I still have the code and tried to compile it recently using PBP 3.0.10.4 and MicroCode Studio v5.0.0.5

    So, this code was working and I still have a chip somewhere with this code actually running on it.

    The error I get is "Redefinition of LABEL TMR0ON".

    It is defined once in the program here:





    ;----[Aliases]------------------------------------------------------------------


    Symbol T0CS = T0CON.5 ; Timer0 Clock Source Select bit 1 = external 0 = internal
    Symbol T08BIT = T0CON.6 ; Timer0 8 / 16 bit flag 1 = 8 bit 0 = 16 bit
    Symbol TMR0ON = T0CON.7 ; Timer0 Enable flag 1 = enable 0 = stop
    Symbol PSA0 = T0CON.3 ; Prescaler Assignment bit 1 = On 0 = Off
    symbol T0PS2 = T0CON.2
    symbol T0PS1 = T0CON.1
    symbol T0PS0 = T0CON.0


    The first line of code which throws the error is " TMR0ON = 0 ; // Stop Timer1 "


    e.g.



    IF TMR0IF = 1 then ; // interrupt triggered by TMR0 overflow


    TMR0ON = 0 ; // Stop Timer1

    TMR0_last = TMR0

    TMR0 = 0 ; // zero timer0

    TMR0ON = 1 ; // Start Timer0

    enable ; // enable GIE flag
    resume ; // return from interrupt



    TMR0ON is not defined anywhere else. It is not in P16F877A.INC or P16F877A.PBPINC.

    You can rename all instances of TMR0ON to any other string & you still get the error.

    Any advice ?

    Thanks,

    Wilson.

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,517


    Did you find this post helpful? Yes | No

    Default Re: Redefinition of Label error

    From the manual:
    Note: The keyword SYMBOL can also be used to create Aliases, but this method is
    not recommended. You may see it in older PBP programs that you find on the web.
    Try replacing Symbol TMR0ON = T0CON.7 with TMR0ON VAR T0CON.7 and see if that makes any difference.

  3. #3
    Join Date
    Aug 2014
    Posts
    13


    Did you find this post helpful? Yes | No

    Default Re: Redefinition of Label error

    Hi Henrik,

    Thanks! That's got me a bit further on.

    Now I get "Bad data type" for line " TMR0ON var T0CON.7 ; Timer0 Enable flag 1 = enable 0 = stop "


    Note that the preceding 3 lines setting bits on T1CON do not generate an error




    ;----[Aliases]------------------------------------------------------------------



    T1CS var T1CON.5 ; Timer0 Clock Source Select bit 1 = external 0 var INTernal
    T18BIT var T1CON.6 ; Timer0 8 / 16 bit flag 1 = 8 bit 0 = 16 bit
    TMR1ON var T1CON.7 ; Timer0 Enable flag 1 = enable 0 = stop

    TMR0ON var T0CON.7 ; Timer0 Enable flag 1 = enable 0 = stop




    Thanks,

    Wilson.

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,517


    Did you find this post helpful? Yes | No

    Default Re: Redefinition of Label error

    A quick look at the datasheet for the 877A indicates that it does not even have a T0CON register (it does have a T1CON register though).
    Are you sure that's the device that the code was originally compiled for and are you sure you're selecting the correct the device in the dropdown list in MicroCodeStudio?

  5. #5
    Join Date
    Aug 2014
    Posts
    13


    Did you find this post helpful? Yes | No

    Default Re: Redefinition of Label error

    Doh!.... Thanks.

    I have a whole pile of P16F877A's lying around and I did originally write the code for the the P16F877A but changed over to the P18F4550.

    Do you know what the first line of the program is ?

    "; PIC18F4550 32k program memory "

    Doh....

  6. #6
    Join Date
    Sep 2004
    Location
    Mentor, Ohio
    Posts
    352


    Did you find this post helpful? Yes | No

    Default Re: Redefinition of Label error

    Hello,
    I’m getting the same error on a 16F87 but I have 3 routines, Main, Bypass, and Alarm on a short program. I have these labels being used in if….then statements that the program is suppose to go to if the conditions are met but I’m getting these errors. I’ve never encountered it before. I recently upgraded my PBP 3. I haven’t done any programming for some time and was asked to provide some more boards like I did over 17 years ago! Please help!

    Bob Koenig

  7. #7
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,517


    Did you find this post helpful? Yes | No

    Default Re: Redefinition of Label error

    Sure, we'll try our best but without seeing the code all we can do is guess and speculate which isn't very efficient and usually not very effective.
    But...since Wilsons problem was that he was compiling for the wrong device perhaps that's the issue you're having as well. If the code was originally written for 16F87 make sure you have that exact device selected in the dropdown of MicroCodeStudio (if that's what you're using).

  8. #8
    Join Date
    Sep 2004
    Location
    Mentor, Ohio
    Posts
    352


    Did you find this post helpful? Yes | No

    Default Re: Redefinition of Label error

    Thanks Henrik,
    The original program was for a 16F84 and I’m replacing it with the 16F87 and yes I did change that on MCS and I’m using PBP 3.1, recently upgraded. I did put comcon= 7 in the newer program but still get the redefinition error message. I ordered and received some 16F84 chips yesterday so I’ll go back to my original program and try it out then let you know how it went. Thanks again for you help!

    Bob K

  9. #9
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,517


    1 out of 1 members found this post helpful. Did you find this post helpful? Yes | No

    Default Re: Redefinition of Label error

    Code:
    comcon= 7
    That line would certainly cause an error, not sure it's the one you get though. If that's actually what you put in your program (and not a forum typo) we might have found the problem.

Similar Threads

  1. Error 115 - Duplicate label
    By ChrisKiwi in forum PBP3
    Replies: 13
    Last Post: - 11th June 2014, 13:50
  2. Duplicate label error
    By lilimike in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 21st December 2011, 01:07
  3. Compile error & syntax error on the word "loop:" as a label?
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 7th March 2010, 05:14
  4. Error[115]...duplicate label..."debug"
    By Brian J Walsh in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 8th April 2008, 10:29
  5. Redefinition of CON bmode during runtime
    By Pedro Pinto in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 16th February 2008, 23:57

Members who have read this thread : 3

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts