|
|
Frequently Asked Questions
PICBASIC PRO Compiler More FAQ Categories
- Why do I get this error?: Duplicate label ("DEBUG" or redefining symbol that connot be redefined)
- I see a warning when I compile that reads "Invalid message number(230)" What do I do?
- I see warnings when I compile that begin "__CONFIG has been deprecated". What does this mean?
- What's different between the PicBasic Pro Compiler and the BASIC Stamp II?
- How do I use the HSerin and HSerout commands at 9600 baud with a 4MHz clock frequency?
- Why do I get an "out of memory" error when I try to compile?
- My program ran fine on the orignal PIC, but it behaves erratically or doesn't run when I put it on a different PIC.
- Do the PicBasic and PicBasic Pro Compilers work with the Microchip programmers?
- How do I use PicBasic Pro Compiler with Microchip's MPLAB?
- Why do I get assembly errors when I use MPASM, but PM works fine?
- How do I run PBPW from a shortcut and make the screen stick around so I can read it?
- Why won't my program write to code space on a 16F87x using the WriteCode command? ReadCode works fine.
- Why do I get the error "Found label after column 1. (clrw)" when compiling for an 18 series PIC?
-
Why do I get this error?: Duplicate label ("DEBUG" or redefining symbol that connot be redefined)
In some of the MPASM header files for PIC MCUs, Microchip has declared a label called "DEBUG". This interferes with PBP's DEBUG command, resulting the in the "duplicate label" error.
The solution is to comment Microchip's declaration from the MPASM header file. These files are found in the folder where the MPASMWIN assembler is installed. If you are using MicroCode Studio and are unsure as to the location of the assembler, you can click View > Compile And Program Options, then select the Assembler tab. The location of the MPASM folder will be shown on this tab.
The default location of the folder is: C:\Program Files\Microchip\MPASM Suite
The name of the file will include the target device part number. If you are compiling for the PIC18F4620, the file you are looking for is P18F4620.INC. Find the file and open it in any text editor. You can open it in MicroCode Studio, if you wish.
Search the file for the word "DEBUG". It will appear in the list of internal registers for the part. Simply comment the line with a semicolon, as shown here:
LVDCON EQU H'0FD2'
OSCCON EQU H'0FD3'
;DEBUG EQU H'0FD4'
T0CON EQU H'0FD5'
TMR0L EQU H'0FD6'
Top
-
I see a warning when I compile that reads "Invalid message number(230)" What do I do?
This message suggests that your PICBASIC PRO Compiler version is more recent than your MPASMWIN Assembler version. You may need to install Microchip's MPLAB from your PICBASIC PRO CD, or download it from the Microchip website.
If you have already updated MPASMWIN, you may need to point MicroCode Studio to the new version. In MicroCode Studio, click View - Compile and Program Options - Assembler. Use the Find Manually button to select the folder where the latest version of MPASMWIN is installed.
Usually: C:\Program Files\Microchip\MPASM Suite
Top
-
I see warnings when I compile that begin "__CONFIG has been deprecated". What does this mean?
In recent versions of MPASMWIN, Microchip has added these warnings to their header files. At this time, the __CONFIG method works fine and you can ignore the warnings. The issue will be addressed in the next release of PBP.
The new CONFIG method that is mentioned in the warnings and described in the MPASMWIN header files is not compatible with PBP at this time. You should not use this method.
Top
-
What's different between the PicBasic Pro Compiler and the BASIC Stamp II?
The main differences between Pro and the BS2, other than Pro programs are faster and can be longer, are some additional instructions and some changes in the way some of the instructions work. There is no nibble data type in Pro. Since Pro can access more RAM, it is usually not a problem to make these byte type variables. The MAX and MIN operators have been altered to work in a more standard manner. Also, since expression operators have precedence, the ordering of math instructions or the addition of parenthesis to specify the order of execution should be examined. SLEEP is uncalibrated. IF..THEN..ELSE..ENDIF provides more than a simple conditional GOTO. Any program code can occur within the structure. And, of course, there are the new LCDOUT and I2C instructions, assembler capability, interrupts and access to more I/O pins.
Top
-
How do I use the HSerin and HSerout commands at 9600 baud with a 4MHz clock frequency?
The compiler calculates the value for the SPBRG register based on the HSER_BAUD define statement, and it assumes that the BRGH bit in the TXSTA register is low. For many of the PICmicro MCU devices, baud rates greater than 2400 with a 4MHz clock result in a low SPBRG value which, in turn, causes a high baud rate error.
To correct this, you should set SPBRG and the BRGH bit (TXSTA.4) explicitly with defines. The following defines will allow you to use 9600 baud with a 4MHz clock at less than 0.5% error.
DEFINE HSER_SPBRG 25
DEFINE HSER_TXSTA 24h
Consult the PICmicro MCU datasheet for further explanation of the hardware-serial registers.
Top
-
Why do I get an "out of memory" error when I try to compile?
Compiling large PicBasic Pro source code files can tax the memory of the PC running the compiler. If an Out of Memory error is issued, an alternate version of PBP can be used. PBPW.EXE has been compiled to make use of all of the memory available to Windows 95, 98, NT and 2000. You must, of course, be running in a DOS shell from one of those Windows environments or within Microchip's MPLAB. To execute the Windows version from the DOS command line, simply substitute PBPW for PBP.
PBPW options filename
Top
-
My program ran fine on the orignal PIC, but it behaves erratically or doesn't run when I put it on a different PIC.
When you move to a device with A to D converters or analog
comparators, you
should disable the analog channels in order to use them as normal I/O. The
necessary register setting varies with the PIC, so look in the datasheet for the
analog comparators and converters. The registers will be described in
detail. Some examples for different PICs.
ADCON1 = 7 ' disable A/D converters on most
PICs
ADCON1 = 15 ' disable A/D converters on PICs with more analog channels
(18F4520, 2520, 6720, 8720, etc.)
CMCON = 7 ' disable analog comparators on almost
any PIC so equipped
ANSEL = 0 ' disable analog converters
that are individually controlled (12F675, 16F676, 16F684, etc.)
Top
-
Do the PicBasic and PicBasic Pro Compilers work with the Microchip programmers?
The PicBasic and PicBasic Pro Compilers generate standard .HEX files that can be used with most PICmicro programmers including Microchip's PICStart Plus and Parallax's PICmicro programmers.
Top
-
How do I use PicBasic Pro Compiler with Microchip's MPLAB?
See the MPLAB installation
page.
Top
-
Why do I get assembly errors when I use MPASM, but PM works fine?
MPASM defaults to case-sensitive operation. Normally this will have no noticeable effect on programs, unless in-line assembly code is used. PBP DEFINEs like OSC and the LCD definitions must be in all upper-case as shown in the examples in the manual.
Top
-
How do I run PBPW from a shortcut and make the screen stick around so I can read it?
Put in something like: C:\Command.com /c C:\pbp\pbpw.exe (+ parameters) in cmd line field in the "Program" dialog tab and un-check "Close on exit."
Top
-
Why won't my program write to code space on a 16F87x using the WriteCode command? ReadCode works fine.
You must set a configuration bit that enables the write operation. If you are using the EPIC programmer, check the configuration option: Flash Program Write Enable
Top
-
Why do I get the error "Found label after column 1. (clrw)" when compiling for an 18 series PIC?
In MPASMWIN 3.60, Microchip moved some of the command
redefinitions that PBP depended on. The problem has been fixed in the
latest version of PBP. If you are getting the error with an earlier
version of PBP, you can add the following at the beginning of your program:
@ include "migrate.inc"
Top
|
|