PDA

View Full Version : Redefinition of VAR errors in PIC14EXE.BAS AND PBPPIC14.RAM



Ahlstrom
- 29th May 2012, 14:41
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??:disgust::disgust:

ScaleRobotics
- 29th May 2012, 16:14
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.

Archangel
- 29th May 2012, 19:51
ver 2.47 in 2011, really? Mail to there must be really slow . . .

Ahlstrom
- 30th May 2012, 04:05
OOPS,
sorry, I think I purcdhased it earlier, perhaps around 2000.

Ahlstrom
- 30th May 2012, 11:19
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 *---------------------*

HenrikOlsson
- 30th May 2012, 11:46
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.

Ahlstrom
- 30th May 2012, 12:01
6500
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?

HenrikOlsson
- 30th May 2012, 12:33
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.