Motorola USB08 User Manual

Page 55

Advertising
background image

Software Module Descriptions

RS232 Communication Module U08232.C

USB08 Evaluation Board

Designer Reference Manual

MOTOROLA

Software Module Descriptions

55

The module contains these three interface functions:

initSSCI() — initialization of the software SCI module

getSSCI() — receiving of a character

putSSCI() — transmission of a character

The module initialization function initSSCI() sets the data direction
registers for the output and input port. Before this setting, a 1 is written
to the data register of the transmission line so that the output value of
this line is the standard high state.

The receive function getSSCI() waits until the state of the receiving line
changes to low. This indicates the beginning of the start bit of an arriving
byte. The following eight data bits are scanned suitably, in each case in
the center of the bit time. The result of this scanning is finally returned to
the calling function.

The available implementation does not examine whether the arriving
stop bit shows incorrect low levels (framing error). Also, an over
scanning for the purpose of noise reduction does not take place.

The production of the bit rate is controlled by the module-internal
function delayHalfBit(). The function is implemented with help from some
in-line assembly code to ensure an accurate time performance, which
can be simply changed by the user if necessary. The possible changes
necessary for the adjustment to different baud rates is documented in
the source text on the basis of two examples.

Adjustments regarding the port pins used as sending or receiving lines
are easily possible. The module uses five macros for the control and
scanning in of these pins. These macros are defined in the head of the
file

U08232.C

. Almost all port pins can be used for the software serial

communications interface (SCI) module by changing the bit masks
and/or the port designators in these macros.

In this demo application, the moderate baud rate of 2400 baud is
selected. An increase to 9600 baud is possible, but tests first must show
that the application runs without problems. It has to be taken into account
that the bit rate production is determined by a certain number of
execution cycles by the central processor unit (CPU), which temporarily

Advertising