Chapter 4: Software
R-Engine-D
4-18
Function Argument
Baud Rate
6 28,800
7 4,800
8 9,600
9 19,200
10 38,400
11 57,600
12
0
115,20
Table 4.2 Baud rate val
for SER1 and SE
Unlike the other serial ports, DMA transfer is not used to fill the input buffer for SCC. Instead, an
interrupt-service-routine is used t
ce characters into t
buffer. If the processor does not respond
to the interrupt—because it is masked, for example—the interrupt service routine might never be able to
complete this process. Over time
means data might
the SCC as bytes overflow.
Initialization occurs in a manner
ilar to SE
M
structure is once again used to hold
state
und buffers operate as before, and must be
prov
i
ues
R 2
o pla
he input
, this
be lost in
otherwise sim
R0. A
CO
information for the serial port. The in-bound and out-bo
ided upon in tialization.
s1_init
Arguments: unsigned char b, unsigned char* ibuf, int isiz, unsigned char* obuf, int osiz, COM* c
Return value: none
This function initializes SER1 with the specified parameters.
b
is the baud rate value shown in Table 4.2.
Arguments
ibuf
and
isiz
specify the input-data buffer, and
obuf
and
osiz
specify the location and size of
the transmit ring buffer.
s2_init
Arguments: unsigned char b, unsigned char* ibuf, int isiz, unsigned char* obuf, int osiz, COM* ca,
COM * cb
Return value: none
This function initializes SER2 with the specified parameters.
b
is the baud rate value shown in Table 4.1.
Arguments
ibuf
and
isiz
specify the input-data buffer, and
obuf
and
osiz
specify the location and size of
the transmit ring buffer.
NOTE: The only difference between functions for SER1 and SER2 is that SER2 functions requires
both COM arguments.
As a part of initializing the serial port, the function call also sets up the interrupt service routine that
andles the data transfer between the SCC26C92 and the AM186ER. The SCC26C92 UART takes up
o
eed for an interrupt service routine. Since both channels on the SCC26C92 use
e same interrupt, there is no need for an ISR for SER2.
h
external interrupt
/INT0
on the CPU. As a part of the
“ser1r.h”
,
s1_isr();
has been created t
automatically handle the n
th