|
by
Tom Napier
Start ı The
Hardware The Firmware ı Sources
and PDF
THE FIRMWARE
The PIC16C54 microcontroller runs at
a clock rate of 6.144 MHz. The serial input algorithm was conservatively
designed so that it would not be confused if it powered up in the
middle of a continuous string of irrelevant ASCII characters. It bit-slips
through successive random characters until it locks on the start and
stop bits. Then it looks for a colon. All other characters are ignored.
(The command strings are transmitted as comments so that the other
equipment being controlled does not get confused by them. Colons are
not used to control the other equipment in the system.)
After finding a colon, the microcontroller
starts examining successive characters. If the next character is neither
the assigned address character or an "@", the unit switches
back to search mode. Otherwise, it starts storing characters and comparing
them to the valid range. Any invalid character immediately restarts
the colon search. Even the right number of valid characters must be
followed by a semicolon before anything further happens. At that point,
the selected commands are sent to the relay driver chips via the PICıs
output pins.
Whenever a command switches an input from
one output connector to another, the firmware turns off the current
output relay. It waits long enough for the relay to switch off before
turning on the new output. This avoids overloading the signal source.
However, the program first checks whether a command will change the
output relays. This stops it from switching an output off momentarily
(i.e., it avoids output glitches) if the same command is sent twice
or if the auxiliary outputs are switched without altering the output
relay connection. Listing
1 shows the PIC program.
A UNIVERSAL REMOTE CONTROL
The outcome of this development is a
compact remote control receiver, which can be adapted to many other
functions with a few changes to the firmware. System size and cost
have been reduced by combining the serial interface and the function
decoding in a single chip.
PREVIOUS
NEXT
Circuit Cellar provides up-to-date information for engineers. Visit
www.circuitcellar.com for
more information and additional articles.
For subscription information, call (860) 875-2199, subscribe@circuitcellar.com
or subscribe online.
ıCircuit Cellar, the Magazine for Computer Applications. Posted with
permission. |