watch and verify that the program is
flowing where you expect it to go.
If the “Auto Update” feature is
selected (described below), then variables and internal information will be
updated after each command. To
view those values, though, it is often
best to pause the program, as the
animate mode can sometimes run too
fast to allow you to read the data.
This option allows you to run
the program in the BasicATOM
chip/module at full speed (minus a
minor delay for the debugger block of
code), without stopping to check for
variables or other data. The green
command-line indicator will not step
through each command. It will just
stay at the last line executed, before
the Run icon was pressed.
Reset is used to start the
program at the beginning. Any
information stored in variables is not
erased. This is a simple way to start
at the beginning or to see how your
program will react if a hardware reset
were to occur.
The Pause button will halt
the program at the current
command line. To resume execution,
the run or animate button is pressed.
The pause button is handy to stop the
run or animate mode, so variables and
other data can be viewed.
This is the button you press to
step through your program,
command by command, using your
This button is a special step
button that allows you to jump
over a part of the program, such as
a GOSUB or FOR-NEXT routine.
Sometimes a GOSUB or FOR-NEXT
routine will take many clicks of the
mouse to get through, using Step Into.
This allows you to jump over the
designated routines and move on to
the command lines after them.
82 August 2007
This is another special step
button that allows you to leave
a GOSUB routine. It’s handy for
looking at part of a GOSUB routine,
and it lets you leave when you have
seen enough. Clicking this will jump
you to the command line after the end
of the GOSUB routine.
Run To Cursor
Clicking on any command line
in the program will produce a
blinking cursor. If you then click on
the Run To Cursor button, the
program will execute in RUN mode
until the cursor line is encountered.
The program execution will stop at
that command line.
This control button will toggle
the Variables window open or
closed. When it’s selected, a separate
window will open and the variables
defined in your program will automatically be listed. The values of those
variables will be displayed in hex,
decimal, and binary formats. (Make
sure auto update is selected, so these
are updated after every command).
SFRs stands for Special Function
Registers. These are special
internal locations within the
BasicATOM chip that indicate how the
internal program is responding to your
modifications of the internal PIC MCU
registers. This is really a function for the
advanced user, but can be handy for
understanding how the BasicATOM
Basic program controls the PIC MCU.
This feature shows all the
Random Access Memory in the
BasicATOM chip/module, not just the
variables. This is also handy for the
advanced user to see the inner
workings of the PIC MCU.
Show Gosub Stack
This displays the GOSUB stack.
The GOSUB stack is the list of
location pointers within the Microchip
PIC MCU that directs where to return
to when the subroutine is completed.
By monitoring this, you can see how
GOSUBs have nested, verify where
you came from, and make sure that
you're not somehow getting lost. This
is really an advanced user function.
Set Auto Update
This should always be selected.
It tells the ICD to update the
variable, RAM, SFRs, and stack after
every command is executed. You
should select this when the debugger
is first connected, but it can be turned
on or off anytime.
I want to show an example of
using the ICD. This is a very simple
program written to flash the LEDs on
my Ultimate OEM module with the
BasicATOM 28B chip installed. The
program will flash LED1 on the
Ultimate OEM 100 times and then
light LED2, before looping back to do
it all again. The variable counter stores
the number of flashes, so we can use
the ICD variable window to watch the
counter variable value change. The
program is shown in Listing 1.
ENTERING ICD DEBUG
To get started, the program is
typed into the editor window. When
that’s done, make sure the Ultimate
OEM BasicATOM module is connected to the programming cable and is
powered up. Next, press the Debug
button. If everything compiles and
programs properly, the DEBUG mode
will appear with the first command
line highlighted in green.
I want to see the variable counter
change, so I press the Auto Update
button and also press the Show
Variables button to open the variables
display window. The variable counter
should appear in the window. Next, I
press the Step Into button to advance
the program. If I keep stepping
through the program, LED1 will turn
on and then turn off several times.