|
The Easy Way
by Charles Kosina
Start ý An
Example ý State Machine Control ý Keyboard
Scanning ý Receive Serial Data ý LCD
Module ý Transmit Data ý Debugging
Techniques ý Other Options ý Sources
and PDF
DEBUGGING TECHNIQUES
The built-in JTAG programming and
emulation support on the ýF000 make debugging a dream rather than
the nightmare it can be with other chips. But, you donýt always
get this luxury. Debugging techniques have been covered in previous
Circuit Cellar articles, so I wonýt go into too much detail
here. [1, 2]
One technique that works well is to send
out a character to a serial port representing the current state of
a state machine. Listing
6 shows how this is done. It
is similar to Listing 3 with added debug instructions. By comparing
the current state with the previous state, you send out the debug
character only once. State 0 will send out the ASCII character A and
so on. This way, you can trace the program flow within a state machine.
The penalties are a reduction of the program execution speed and having
to use a serial port that may be required for other tasks. Nevertheless,
this is one technique that has served me well numerous times.
If you donýt have a UART available, there
are other options. A spare I/O port bit can be used with bit-banger
software to emulate a serial port. An LCD module can also be used
to show the current state. In any case, use the highest bits per second
possible to reduce the speed penalty.
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. |