AVR-Single-Chip-Processor AT90Sxxxx
of ATMEL in practical examples.
ANSI-terminal programmable signal generator
This application provides a pulse generator for signals from 5 microseconds to 65,535 microseconds length
and selectable high/low pulse length of any combination. The duration of the signal and the active high
period duration are programmable providing these numbers (in microseconds) with an ANSI-compatible
terminal program to the STK200 via the board's SIO connection.
This application requires:
the STK200 board with a AT90S8515 on board; or alternatively: a 2313 with a SIO interface (re-adjustment of some
parts of the source code is also required then!),
a computer with a RS232 interface and an ANSI-compatible terminal program (like HyperTerminal for
Windows),
connecting the computer's SIO interface with the board's interface (with at least a two-wire connection).
Usage:
Start your terminal program and set the required parameters: COM x, 9600 Baud, 8 bits data, No parity, 1 stop-bit
Switch the board on; your terminal should turn to black background and show the welcome message,
Input the total length of the pulses in microseconds (5 to 65535) and press return,
Input the length of the active high part of the pulse in microseconds (5 to 65534) and press return,
Changing the source code in the string area at the end of the code (from Label 'ErrorStr' downwards) can
yield strange results due to two different serious compiler bugs!
Strings always have to have an even number of chars!
The number of byte or char constants on one line has also to be even!
Don't mix Strings and byte or char constants on one line! Always place them in extra lines!
Watch the list output of the compiler for messages stating "Garbage at end of line!". It is not a fatal
error causing a break, but all labels behind this line might be corrupt!
Compare the label 'Check' on the end of the compiler listing. If it points exactly to itself anything is
ok with the strings. If it doesn't point to itself you sure ran into that bug and your terminal output and
all following labels will be corrupted.
While the above points result in erroneous label adresses the use of semicolons in strings causes
another compiler bug: he ignores the part of the string behind that char on the same line. That bug is
not easy to find, so either avoid the use of that char or place it as hex byte on an extra line, together
with another char.
The golden rule of string programming: ALWAYS place strings behind the end of your executable
code. Otherwise you risk jumps to false labels and your AVR might do interesting things with the
false code.