quite inexpensive for such a custom built
module. The RS-232 Driver Module is available
in two configurations: modems (DCE); and
things that connect to modems (DTE). I’m
using the DCE version since I want to connect
to the PC serial port (just like a modem
would). For the connection to the PC, I used a
nine pin straight-thru cable. The completed
adapter is shown connected to the BasicBoard
in Figure 4. The BasicBoard supplies the power
to the module so it’s a simple connection
between the serial port adapter module on the
BasicBoard and the PC serial port.

Figure 4.
Completed
Setup.

Software

To demonstrate how to use the adapter,
I now have to show the software to control
it. The application will create a simple
communication connection between the
BasicBoard and the Atom development
software’s built-in terminal window. The program will have
the BasicBoard send out a statement requesting which LED
the user would like to light up (0 through 7). The user then
enters the LED number in the terminal window and presses
the enter key on the PC. The ASCII value of the number is
sent through the serial adapter and when the BasicBoard
receives that value, it turns on the LED. It will also display
the value chosen on the BasicBoard’s LCD display. The
program runs over and over again, asking for and receiving
the LED information.

The BasicBoard’s Atom programming software screen
with terminal window after the BasicBoard has sent the
information is shown in Figure 5. This is how it should look
when you get your hardware serial port adapter working.

Now, onto the code listing for
the BasicBoard. It is fairly simple but
the key lines are the HSEROUT and
HSERIN commands. These are
specially written to control the
hardware serial port. Before we can
use these commands, we first have
to set up the hardware serial
port and that is done with the
SETHSERIAL command:

Finally, the main program is written that sends out
the statements to be displayed in the PC terminal window.
Each line is sent with a separate HSEROUT command. The
HSEROUT sends the ASCII codes 10 and 13 which represent
the line feed and carriage return.

hserout [“Hello I am the Basic Board”]
hserout [10,13]
hserout [“Which LED would you like me to light”]
hserout [10,13]

Figure 5. Atom
Screen Capture.

sethserial H57600

This sets the BasicBoard hardware serial port to 57,600 baud at
eight data bits, no parity, and one
stop bit. You can check the various
options for this setup in the Atom
command manual. The program
then establishes the variables the
program will use and also sets up
the BasicBoard LCD similar to the
LCD project in the BasicBoard manual.