How easy was that? All we have to
do is send our text through a serial connection. As you’ll see in the demo program, Say is the command to speak the
text that follows and EOM is the end-of-message marker. When active, the Emic
TTS will tell us by lighting a red LED and
setting the Busy output high. When the
current phrase is complete and we can
send a new one, the LED will change to
green and Busy will go low. Before we get
to the code, let me discuss the two operational modes that are supported by the
Emic so that you will understand why I
wrote the program the way I did.
There are a couple of configuration
switches on the Emic TTS. SW1 sets the
command mode for the device. When
SW1 is on, the Emic TTS expects
commands in text mode. In this mode, the
command above would look like this:
Figure 2. Emic TTS connections.
SEROUT Tx, Baud, [“say=Nuts & Volts rocks!;”]
This mode is very useful if you’ve got the Emic
connected to a terminal program, but consumes a lot of
program space when used in an embedded micro. So,
we’re going to set SW1 to off, which puts the Emic into hex
mode. In this mode, “say=” (four bytes) is replaced with
$00 (one byte), so we will ultimately save code space.
To make our program easy to read, we’ll create a constant
called Say that has a value of $00. What we get is
conservation of code space without sacrificing the ability
to read and understand the program.
The second switch, SW2, is used to select/deselect
character echo. When on, SW2 will cause every character
transmitted to the Emic TTS to be echoed back. Again, this
is more useful when connected to a terminal than an embedded micro. When SW2 is set to off, we don’t get the echo, but
we do still get status and other important information from
the Emic TTS. Okay, let’s get to it. Grab your Emic TTS (SIP
version) and plunk it into a breadboard. The circuit is
straightforward and will only take a few minutes to connect.
Stamp Based Chatterbox
Okay, here’s what our program is going to do:
• Reset the Emic TTS
• Display a menu
• Accept and validate user input
• Run the selected demo item
The first thing we’re going to do is reset the Emic TTS
so that we can start in a known state. There are two ways
to do this: hard and soft. Doing a hard reset requires an
external control line. If you have a project that is short on
I/O, you can let the Emic RST\ line float and do a soft reset
through the serial link. The only downside to the soft reset
process is that we have to wait if the Emic is busy. Here’s
our code to do a hard reset and preset a couple of program
variables to the Emic TTS defaults:
vol = 4
spd = 2
ptch = 1
The purpose of our program this month is to put the
Emic TTS through its paces so we can make decisions
about text, volume, speed, and pitch before installing it into
that currently silent project that’s just aching for a voice.
The program, as written, will work on any BS2 family.
Since the communication rate between the host processor
and the Emic is a tame 2400 baud, you can even connect
it to a BS1 — though you’ll probably want to minimize the
connections. Check the Parallax website for BS1 and
Javelin samples, if those micros interest you.
The first four lines handle the reset and confirmation
process. As you can see, we just need to pull the RST\ line
Figure 3. Audio Filter for FREQOUT and DTMFOUT.