Redefinition of VAR errors in PIC14EXE.BAS AND PBPPIC14.RAM


Closed Thread
Results 1 to 8 of 8
  1. #1
    Join Date
    May 2012
    Location
    Contractor, Afghanistan
    Posts
    4

    Default Redefinition of VAR errors in PIC14EXE.BAS AND PBPPIC14.RAM

    I am using PIC BASIC Pro that I purchased back in 2011 and have just started working with. My version is 2.47 so I am using MPLAB 8.15a
    I am working with a PIC16F877 to make a clock with 8 LED's, 4 for time and 4 for date, and a few switches. Everything run directly from the processor. I wrote the first part of the program to access the LED's and scan them, just to test, and when I tried to compile, I did not receive errors on my program, I received "Redefinition of VAR" errors on the included files! The files are not first, but before the Start: lable. I have tried everything, including completely erasing my program and just trying to compile the header. OUCH!
    I think I need to run the PIC BASIC disk and manual through a shredder and use C. Any Ideas??

  2. #2
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default Re: Redefinition of VAR errors in PIC14EXE.BAS AND PBPPIC14.RAM

    It sounds like the include files both define the same variables. If you showed your include files, PIC chip used, as well as your code, we might be able to tell better.
    Last edited by ScaleRobotics; - 29th May 2012 at 16:25.
    http://www.scalerobotics.com

  3. #3
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Re: Redefinition of VAR errors in PIC14EXE.BAS AND PBPPIC14.RAM

    ver 2.47 in 2011, really? Mail to there must be really slow . . .
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  4. #4
    Join Date
    May 2012
    Location
    Contractor, Afghanistan
    Posts
    4


    Did you find this post helpful? Yes | No

    Default Re: Redefinition of VAR errors in PIC14EXE.BAS AND PBPPIC14.RAM

    OOPS,
    sorry, I think I purcdhased it earlier, perhaps around 2000.

  5. #5
    Join Date
    May 2012
    Location
    Contractor, Afghanistan
    Posts
    4


    Did you find this post helpful? Yes | No

    Default Re: Redefinition of VAR errors in PIC14EXE.BAS AND PBPPIC14.RAM

    Here is the program. I seem to have some issues with uploading my files. I will continue to try.
    '************************************************* ***************

    '* 16F877.BAS *
    '* *
    '* By : Leonard Zerman, Jeff Schmoyer *
    '* Notice : Copyright (c) 1998 microEngineering Labs, Inc. *
    '* All Rights Reserved *
    '* Date : 10/23/98 *
    '* Version : 2.11 *
    '* Notes : *
    '************************************************* ***************
    LIBRARY"PBPPIC14"
    include"PIC14EXT.BAS"
    include"PBPPIC14.RAM"
    BANK0 $0020, $007F
    BANK1 $00A0, $00EF
    BANK2 $0110, $016F
    BANK3 $0190, $01EF
    EEPROM $2100, $21FF

    DEFINE CODE_SIZE 8
    ;PORTL VAR PORTB
    ;PORTH VAR PORTC
    ;TRISL VAR TRISB
    ;TRISH VAR TRISC


    TRISB = $00
    TRISD = $00
    TRISA = $00
    TRISC = $FF
    TRISE = $00

    START:


    TimeSet:
    PORTD = %10110110 ;data previously loaded into DispReg1 is sentto DispData which is PortD.
    PORTB = %10000000 ;data previously loaded into DispDriveReg is sent toDispdrive which is PortB.
    call KbdScan ;callKbdScan to see if one or more keys have been pressed.
    PORTD = %10011110
    PORTB = %01000000
    call KbdScan
    PORTD = %00100010
    PORTB = %00100000
    call KbdScan
    PORTD = %00000000
    PORTB = %00010000
    call KbdScan
    PORTD = %00100010
    PORTB = %00001000
    call KbdScan
    PORTD = %00001000
    PORTB = %00000100
    call KbdScan
    PORTD = %00101000
    PORTB = %00000010
    call KbdScan
    PORTD = %10011110
    PORTB = %00000001
    call KbdScan
    goto TimeSet

    KbdScan:
    Pause 8
    goto TimeSet





    '*-----------------------*EOF 16F877.BAS *---------------------*

  6. #6
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521


    Did you find this post helpful? Yes | No

    Default Re: Redefinition of VAR errors in PIC14EXE.BAS AND PBPPIC14.RAM

    You're not supposed to write your program INSIDE any of the files in the PBP folder.

    When you compile a program the compiler automatically includes the correct files for the specified target - in your case (since you're using the 16F877) the file is 16F877.BAS (and a few other) but now, since you've "added" you're program code TO that file it won't work since the compiler tries to compile the same code twice - sort of.

    Simply keep your program code in a file of its own and compile for the correct target. If you're using MicroCodeStudio as your IDE it's just a matter of selecting the 16F877 in the dropdown list of available targets. Make you sure you restore the 16F877.BAS file to its original state.

    /Henrik.

  7. #7
    Join Date
    May 2012
    Location
    Contractor, Afghanistan
    Posts
    4


    Did you find this post helpful? Yes | No

    Default Re: Redefinition of VAR errors in PIC14EXE.BAS AND PBPPIC14.RAM

    PIC14EXT.BAS
    I dont seem to be able to upload the other two files. The upload program keeps telling me they are invalid files. Perhaps they are defective files. Can replacements be downloaded?

  8. #8
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521


    Did you find this post helpful? Yes | No

    Default Re: Redefinition of VAR errors in PIC14EXE.BAS AND PBPPIC14.RAM

    Again, the problem is most likely NOT with any of those file but because you've modified the 16F877.BAS file by adding your actual program code to/in that file. Because of this the compiler tried to include the needed support files (PIC14EXT.BAS and PBPPIC14.RAM) TWICE which is what causes the Redefinition of VAR error.

    So again, restore the 16F877.BAS to its original state and keep your program code in a file (or files) of its own.

Members who have read this thread : 1

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