<<Previous

Next>>

2.3. Software Installation

The included software should be copied to your hard drive before use. Create a subdirectory on your hard drive called PBC or another name of your choosing by typing:

md PBC

at the DOS prompt. Copy all of the files from the included diskette into the newly created subdirectory by typing:

xcopy a:*.* PBC /s

The /s option will insure that all of the necessary subdirectories will be created within The PBC subdirectory. Please see the READ.ME file on the disk for additional information.

Alternatively, INSTALL.BAT can be run to perform the same steps. If the PBC subdirectory already exists, you will get an error message and the installation will continue.

Please see the READ.ME file on the disk for additional information.

2.4. Getting Started

For operation of the PICBASIC™ Compiler you'll need a text editor or word processor for creation of your BASIC source file, some sort of PICmicro MCU programmer such as our EPIC Plus Pocket PICmicro MCU Programmer, and the PICBASIC™ Compiler itself. Of course you also need a PC to run it all on.

The sequence of events goes something like this:

First you create the BASIC source file for the program using your favorite text editor or word processor. If you don't have a favorite, DOS EDIT (included with MS-DOS) or Windows NOTEPAD (included with Windows) may be substituted. The source file name should end with (but isn't required to) the extension .BAS.

The text file that is created must be pure ASCII text. It must not contain any special codes that might be inserted by word processors for their own purposes. You are usually given the option of saving the file as pure DOS or ASCII text by most word processors.

The following program provides a good first test of a PICmicro MCU in the real world. You may type it in or you can simply grab it from the SAMPLES subdirectory included on the original PICBASIC™ Compiler distribution disk. The file is named BLINK.BAS. The BASIC source file should be created in or moved to the same directory where the PBC.EXE file is located.

‘Example program to blink an LED connected to PORTB.0 about once a second

loop:	High 0	‘Turn on LED
	Pause 500	‘Delay for .5 seconds

	Low 0		‘Turn off LED
	Pause 500	‘Delay for .5 seconds

	Goto loop	‘Go back to loop and blink LED forever
	End

Once you are satisfied that the program you have written will work flawlessly, you can execute the PICBASIC™ Compiler by entering PBC followed by the name of your text file at a DOS prompt. For example, if the text file you created is named BLINK.BAS, at the DOS command prompt enter:

PBC blink

The compiler will display an initialization (copyright) message and process your file. If it likes your file, it will create an assembler source code file (in this case named BLINK.ASM) and automatically invoke its assembler to complete the task. If all goes well, the final PICmicro code file will be created (in this case, BLINK.HEX). If you have made the compiler unhappy, it will issue a string of errors that will need to be corrected in your BASIC source file before you try compilation again.

To help ensure that your original file is flawless, it is best to start by writing and testing a short piece of your program, rather than to write the entire 100,000 line monolith all at once and then try to debug it from end to end.

The PICBASIC™ Compiler defaults to creating code for the PIC16C84. To compile code for PICmicros other than the 'C84, simply use the -P command line option described later in the manual to specify a different target processor. For example, if you intend to run the above program, BLINK.BAS, on a PIC16C74, compile it using the command:

PBC -p16C74 blink

<<Previous

Next>>