GETTING STARTED:LOADING THE SOFTWARE

LOADING THE SOFTWARE

The following software will be provided with the various components that you will acquire as you learn about using microcontrollers based on the experimental boards provided by microEngineering Labs.

N PICBASIC PRO compiler software and book.

N USB port programmer (or whatever programmer you are using) software and book

N MicroCode Studio (the editor) on CD ROM or downloaded from the Internet.

The DOS environment is archaic and can be difficult for users not familiar with it. You do not have to deal with DOS to use and enjoy the hardware and software that we will be using. Everything can be done from the Windows environment.

Note If you need to use DOS, there is a chapter at the beginning of the manual that tells you what you will need to do.

The PICBASIC PRO compiler manual covers the use of the software in the DOS environment. I suggest that you ignore the first pages of the book and instead read the following section on how to run everything under the Windows environment. Once you are familiar with how the system works, you can go back and learn how to use the software in the DOS environment. There are a number of things that the DOS environ- ment provides that can be useful and you will want to know about these as you get more and more proficient in your use of the microcontrollers.

USING THE SOFTWARE IN THE WINDOWS ENVIRONMENT

The first question that needs to be answered in almost every endeavor is always: “What do I need, what do I have to do, and what will it cost me to get the job done?” Accordingly, we will address this now.

Let’s assume that you already have an IBM-PC with a suitable Windows operating system and that you know how to use it. Your computer needs the following capabilities to allow you to access the hardware and software that you are going to use it with.

In this book I will deal exclusively with the IBM-PC in a Windows environment. The software is not available for the Macintosh. Here is what you need:

N A 3.5 inch floppy drive or CD ROM (as of this writing some of the software is provided on 1.4 Mb, 3.5 inch floppies only and you must read it off a diskette for the system to work right. You cannot copy the software to a CD ROM and work from there; it will not work.) If your software comes on CDs, you can ignore this.

N A hard disk with about 5 MB of free space for software storage and as a general workspace.

N A serial port (COM1 or COM2) if you will be using the new serial programmer, and a USB port if you will be using the USB programmer. The USB programmer has the advantage of not needing a wall transformer based power supply because it takes its power from the USB port.

N LAB-X1 Experimenters board ($195); 16F877A microcontroller (not part of Lab-X1) ($10).

N USB programmer ($120).

N PICBASIC PRO compiler ($250).

N Miscellaneous motors and electronic items for experimentation ($70) allowance.

The allowance for the motors and electronic parts also covers the need to purchase memory- and time-based components that are socketed for but are not listed. You may decide that you do not need to experiment with some of these at this time. The allow- ance provides for almost everything you need for your motor experiments.

microEngineering Labs also provides a number of other preassembled boards for experimentation and educational purposes that you should be aware of:

N Lab-X1 Experimenter’s board, which we are discussing

N Lab-X2 Experimenter’s board for custom circuits N Lab-X20 Experimenter’s board for 20-pin devices N Lab-3 Experimenter’s board for 18-pin devices

N Lab-4 Experimenter’s board for 8 and 14-pin devices

N Lab-XT Experimenter’s board for telephone technology–related investigations

N Lab-XUSB Experimenter’s board for building USB interfaces and peripherals

In this book we will consider the LAB-X1 only. This board provides a 2-line by 20-character display, which is very useful in the learning environment because it can allow you to see what is going on in the system as you experiment (if you program your programs to do so). Since almost all the microEngineering Labs boards provide similar features, learning transfer to the other boards is high.

Start out by opening a new folder on your desktop and labeling it LAB-X1 Tools. You will store everything that has to do with all your projects in this folder. You are opening this folder on the desktop now, but you can move it to wherever you like in the future. For now, you don’t have to make a decision about where to locate the

folder, and it is right in front of you when you start your computer and the desktop appears.

Open the LAB-X1 Tools folder and create new folders, one for each of the items or applications we will be working with in this folder. Name these folders as follows:

N MicroCode Studio

N USB Programmer (or whichever programmer you decide on)

N PICBASIC PRO compiler

N LAB-X1 and related information Then follow these steps:

1. Put the MicroCode Studio CD in the disk drive and open it.

2. Copy all files to the MicroCode Studio folder.

3. Eject the CD and put it away in a safe place.

4. Put the programmer diskette in the disk drive and repeat the steps that were taken above for the software in this package. Repeat the process for all the diskettes.

5. Put a shortcut for the MicroCode Studio program on your desktop. This is the only shortcut you need when you want to create programs for your MCUs. All other functions of the system can be accessed from the window of this editor.

As a general rule, you will never see the compiler as such. It is called from the MicroCode Studio Editor screen, it works on compiling the program it is asked to compile, and then it disappears into the background ready for the next compilation request. The errors that are displayed after a compilation are generated by the com- piler. If all goes well, there are no errors and you get a message telling you that the compilation was successfully performed. The new hex file just generated will appear in the directory listing the next time you open a file. The hex file will have the same name as the text file that it was compiled from. The PICBASIC PRO compiler manu- al covers how all this is done in more detail.

Source file Untitled.bas

hex file Untitled.HEX

It should be noted that the hex file is not created until all the syntax errors the com- piler can find have been eliminated by you. After a successful compilation of the code there may still be errors in the programming itself that will need to be addressed as you debug your work. Now go to the microEngineering web site (www.microEngi- neering Labs.com/index.htm) and download the information on the LAB-X1 experi- menter board to your computer and put it in the LAB-X1 Tools folder. There are a number of very useful example programs in these files, and cutting and pasting from these to programs that you are writing will save you a lot of time. These programs are also on the support web site.

If you are familiar with and have information for the Basic Stamp, it would be a good idea to also add these files to this folder so that all your microcontroller information is

in one place. If you have a CD burner on your computer (and if you do not you should get one), it is well worth your time to now copy the entire unadulterated LAB-X1 Tools folder to a CD for safekeeping. Data on a CD is much more secure than the data on a floppy drive and the best time to make a copy of it is right now before you make any changes to any of the data that you received from the vendors.

For the purposes of general discussion and experimentation, we will always call the example program that is being manipulated Untitled and the text file that is the body of the program will be called Untitled.bas.

This is the file that the compiler compiles for the microcontroller you are using to create the hex file.

The hex file that is created from this program by the compiler will be referred to as Untitled.hex. We do it this way because every time you compile and run a program the system automatically saves the program to disk at the same time. This means you lose the old program and cannot go back to it. If you are working with a complicated program, this can become a real problem because there are lots of good reasons to go back to the way things were. To avoid this pitfall, every time you load a program from disk, first save it as Untitled.bas and then play with it all you want. When you have a viable program, save it to the name that is appropriate for it. Then load the next pro- gram and change its name to Untitled.bas, and so on. I even recommend that you save each version of your program with a version designation so that you work on Blink. bas as Untitled.bas and resave it to disk as BlinkV1.0.bas; then you work on BlinkV1.0.bas as Untitled.bas and resave it as BlinkV1.1.bas, and so on. Though there is some tedium in doing this, I can assure you that it will save you a lot of headaches in the long run.

Note The hex files created by the PBP compilers can be loaded into the PIC microcontrollers with other software/loaders. It is not imperative that hardware programmers be used.

Leave a comment

Your email address will not be published. Required fields are marked *