February
1998, Issue 91
Low-Cost
Voice Recognition
TINY
ALGORITHMS
The
software for Tiny Voice was written entirely in assembly.
There is a total of eight routines.
The
main program, MAIN.ASM, responds to events and schedules
the remaining subroutines.
COMPARE.SUB
handles the pattern matching. It compares the input
template to each active template in memory and calculates
the best match.
EEPROM.SUB
handles the reading and writing of data to the EEPROM.
It bit-bangs two I/O pins to simulate an I2C protocol
used by the EEPROM.
IRQ.SUB
is the interrupt handler. Interrupts are caused by a
button press.
The
most complicated routine is INPUT.SUB. It samples the
input, determines where the word starts and ends, and
builds up the voice template.
TIME_NOR.SUB
normalizes the length of the speech input to a fixed
length of twelve two-element data values.
DIV16_8.SUB
is an integer divide routine that divides a 16-bit number
by an 8-bit number. This routine is called repeatedly
by the time-normalization routine.
And
finally, DELAYMS.SUB is a simple program where a delay
is set by the value passed in the accumulator.
Tiny
Voice is entirely event-driven and spends most of its
time in the Stop mode. Events are caused by the interrupt
of pressing push buttons. The event handler is shown
in Figure 3.
|

(Click here to enlarge)
|
Figure
3—The main routine performs the event handler. Events
are generated by an interrupt caused by pressing
a push button or by system reset. The events dispatched
are Select, Train, Untrain, and Recognize. |