The Set Up sub menu provides for setting the start and stop time for the
Delay mode, the duration in minutes for the Now mode, the frames/min,
Set Up and setting the time and date of the Real Time Clock. The navigation switch moves the cursor on the screen to indicate what is under edit. It also
adjusts the value of the parameter. Pushing the navigation switch exits the
edit mode and saves the value.
The Run sub menu provides for automatic or manual operation. Manual
Run operation focuses or triggers the camera from the front panel. Automatic
operation starts the Delay or Now mode, or cancels a mode in operation.
The Options sub menu provides for toggling the use of an LED during a
Options session (the LED lights when a frame is triggered), toggling the backlight
of the LCD Display, and toggling the Super Cap charging circuit.
The Power Down item places the intervalometer in Sleep mode. The
power switch must be cycled to display the main menu again.
■ FIGURE 4. Intervalometer Operation.
After turning it on, the intervalometer
presents the main menu. The menu
items and their functionality appear in
the table here.
evaluate to true:
IF MenuIndex < 0 THEN
municate with the LCD. After I verified
the LCD operation, I connected a
microcontroller port pin to the third pin
on the pin header, and verified that I
could write text to the display. But I discovered that the text started wrapping
after 20 characters rather than 16.
Parallax Support said I should remove a
surface mount jumper from the back of
the LCD PC board. With this fix, the display wrapped the text correctly.
With the LCD in place, I wanted
to display the time of day using the
RTC. I soldered it and its crystal to the
Protoboard. I completed the connections from the SX- 48 to the RTC, and
ported a BASIC Stamp program to S/X
Basic. The program initialized and
displayed the time on the LCD.
At first, the time did not appear
because the RTC was initialized
incorrectly. The syntax was correct for
the BASIC Stamp but not for the SX- 48
(the compiler did not detect the
sytax errors). The Parallax online
discussion Forum helped me correct
the program. I was relieved to see the
RTC operating because I thought I
had burned it or the crystal when I
soldered them to the board!
To complete the RTC development, I soldered a Super Cap to the
Protoboard. I added code to my program to operate a charging function
through the RTC. I have found that the
RTC accurately maintains the time and
date for more than a month on just
the Super Cap current.
I selected an ALPS four direction
switch with center push for menu
navigation. Since the small switch had
no mounting fixtures, I mounted it to a
one inch square piece of Vectorboard.
I enlarged some of the holes, and
mounted the switch in the center. I
drilled a hole in each corner, and used
two of them to mount the Vectorboard
with the switch on the front panel of
my enclosure (see Figure 3).
I verified the switch operation
with a program that displayed the
closed connection on the LCD. I
placed all of the switch connections
on a single port of the microcontroller.
In this manner, I only have to read the
port, mask the reading, and compare
the result to constants in order to
determine the position of the switch.
I prefer to develop programs in small
steps to both gain confidence in the system and to minimize code defects. When
there is a defect, then I have only to look
at the most recent changes to correct it.
As the program grew in size, I found that
locating defects, in some cases, was a little more difficult as more parts of the
The main loop of the program monitors the four position switch. The up
and down switch positions navigate the
menu like a Windows list box. The left
and right positions move between menu
levels and select menu items, respectively. I used the push button connection to finalize editing of parameters.
I found it challenging to detect a
number less than zero. For example,
the index of the current menu item is
zero and I want to navigate up. The
program decrements the index and its
value becomes 255. The SX- 48 does
not recognize the value as -1, and the
following SX/BASIC statement did not
When I needed to detect a
negative number, I checked for 255
explicitly. Fortunately, I did not have a
case where 255 was a valid value for
any of my indexes. Once I recognized
this, I was comfortable adopting it as a
standard for this project. I would not
recommend it for all projects.
As I started adding more functionality, I found odd things happening on
the display. The cursor would be in the
wrong place or a value would not display correctly. For example, when editing frames per minute, I wanted to write
“Frames/min” and “ 10” on the first line,
and clear the second line. The label
would appear but the value did not.
When I stepped through the
program, I discovered that it wrote the
label on the first line, the value on
the second line, and then cleared the
second line. I was not able to see this
under normal execution because it happened so quickly. The debugger was a
valuable tool to help resolve this issue.
As the code grew larger, I noticed
that the menu text was not displaying
correctly. I reviewed the S/X BASIC
READ command that helps move the
text to the display. The command
expects to find menu text on a single
page of 256 bytes. My menu data
crossed a page boundary, and was more
than 256 bytes. To resolve this, I moved
the menu text to its own file and gave it
a starting point on a page boundary.
Also, my menu became simpler (and
smaller) which focused the program on
basic intervalometer functions.
I completed the programming for
editing parameters and started
working on the camera interface. In
addition to a resistor array, I added a
set of optocouplers (one for focus and
one to trigger the picture). The optocouplers isolate the power supply of