Testing
Home Up Testing Troubleshooting Connections BotBoardPlus.pdf cable.pdf

You have either constructed your BotBoard Plus (BB+) on your own, or you have purchased an assembled and tested board. The first best step is to get your board operational BEFORE you modify the design. The best way to do this is to create a "Hello World" program, download the program to the BB+, then run the program on the target machine.

The Overview

Your BotBoard Plus should have come with a diskette called the BotBoard Plus Starter Kit. This contains a version of SBASIC, the BotBoard Plus manual, the RS232-TTL cable manual, and a program called dl11.exe

There is a fairly straight forward sequence of steps that you follow to program your board:

1) Write the test program using an editor such as PFE or even notepad (comes with Windows). Any plain text editor will work.

2) Compile and assemble the program using SBASIC (or your favorite language). This will generate an output file called an S19 file. This contains a text encoded version of the program that will be transferred to your BB+.

3) Using the downloader, called dl11, you transfer the program contained in your S19 file out to the BotBoard Plus.

4) Assuming all went well, you have programmed your controller and it is ready to run.

In the next 4 sections, we will delve into the gritty details of how to make these steps work.

Writing the Program:

For the example, we are going to use the SBASIC language to write a program that should run correctly on a BotBoard Plus. The program, while extremely small, will allow you to determine if the configuration of your PC is correct, and if your BB+ is up and running correctly.

Using a text editor, you can cut and paste the following source program, or download hello.bas :

include "regs11.lib"

declare c
main:
    '
    ' Setup the serial port for 9600 baud
    '
    pokeb    baud, $30
    pokeb    sccr2, $0c

    print "Hello World!"
    do
        c = c + 1
        if c = 0 then
            print "." ;
        endif
    loop

As you can see, this isn't a very big program, but it will suffice for checking the operation of your BotBoard Plus. When run, this program will print out Hello World!, then start a loop. Each time the value of the variable 'c' increments to zero, it will print out a dot.

Save this program to hello.bas, preferably in the directory that contains sbasic

Compiling the Program:

Compiling a program means you are going to convert it from a language you understand, such as BASIC, into a language that the target computer can understand, called Assembly Language. Another program, called an Assembler, will convert your Assembly Language program into a 'binary' file that represents all of the bytes that the actual CPU requires to run your program. This entire two step process is often combined into one term which is to compile your program.

The program we wrote above needs to be compiled using SBASIC and assembled using the asmhc11 assembler. I normally create a small batch file, sbas.bat, to handle both steps. My batch file looks like the following:

sbasic %1.bas /cf800 /v0000 /s00ff > %1.asc
asmhc11 %1.asc

If you are so inclined, you may download sbas.bat here.

The first line of this batch file runs the sbasic.exe compiler on your .bas source file. It also tells the compiler that the code (/c) is located at $F800, the variables (/v) start at address $0000, and the stack (/s) starts at $00FF. The output of this program is redirected to a .ASC file, which stands for Assembler Source Code.

The second line runs the asmhc11 assembler on that intermediate .ASC file.

If you are wondering what the %1 means, it is a DOS compatible batch file command asking for the first argument to the batch file. To run this on hello.bas, issue the following command:

sbas hello

You should end up with the assembler output of:

M68HC11 Absolute Assembler Version 2.70
Motorola Copyright 1986,1987,1988,1990.

Assembling C:hello.ASC line 364
0 ERROR(S) DETECTED AFTER PASS 2

Your output may be slightly different, but the 0 ERRORS is important! If you don't, you will need to poke around in the hello.asc to try to figure out what went wrong.

If you did get the above output, congratulations, you are 60% done with this project.

Downloading the S19 File:

The next step is where you will determine if everything works correctly. You will need an RS232/TTL converter cable, such as the cable that comes with the BotBoard Plus Starter kit. You will also need the program dl11.exe, which came with your BotBoard Plus Starter Kit diskette. You can also download dl11.exe and dl11.pdf from this website.

The steps are fairly straight forward, but must be done in a particular order for them to work.

  1. Make sure that your target board is powered up. Do this by applying power to the connector P1. The center post of the connector is for +5 volts, the two outer posts are for GND. You only need to connect 1 ground wire. The BB+  can be run at voltages ranging from 4.8 volts to about 6.0 volts. I often use a set of 4 'AA' batteries in a battery holder.
  2. Connect the serial cable to your PC. Please note which COM port you are using, you will need that information later. Connect the other end of your serial cable to the BB+.
  3. Flip the BOOT switch into the Bootstrap position. This means that the slide switch is moved towards the power connector P1.
  4. Press the reset switch. Make sure you press it firmly for at least half a second or so to make good contact. Your BotBoard Plus should have just reset into Special Bootstrap Mode. This means that the CPU is ready to accept a new program over the serial port.
  5. To download a program, you use the dl11.exe utility. If you are not running Windows/95/98/NT or compatible, then you may need to find PCBUG11 or any other download utility for your machine. dl11.exe only runs on 32-bit Windows. To run the program, type in the following command in your sbasic directory:

    dl11 -c 1 -T -i hello.s19

    The switches here tell the program to use COM1. If you are using a different COM port, change the 1 to the appropriate value. The -T tells the dl11 program to use TERMINAL mode. TERMINAL mode opens a 9600 baud terminal session after download is complete. The -i switch specifies the name of the input file. This needs to be the name of the .S19 file that contains your program.

If everything runs correctly, you should get output that looks something like this:

C:\sbasic>dl11 -T -i hello.s19
dl11: version Mar 19 2000 23:48:02
Copyright (c)1999-2000 Kevin Ross
www.nwlink.com/~kevinro/products.html

Downloading talker file
0.1.2.3.4.5.6.7.8.
Downloading hello.s19
........Download completed!

Entering 9600 baud TERM mode.
F1 prints this help
F2 exits terminal mode
F3 downloads file again

(If you get errors, see the troubleshooting page for help)

At this point, the dl11.exe program is waiting for input from the serial port. Flip the bootswitch to the run position. That means the slide switch is set away from the power connector P1. Then press the reset button again. You should get output that looks like this:

Hello World!
............

The program will continue to print out dots until the power is disconnected or the reset button is pushed.

Congratulations!

Hopefully, all of these instructions worked well and you now have a BotBoard Plus that appears to be working correctly. Feel free to browse around for other subjects that might be helpful to you.