R-Engine-D
Chapter 4: Software
4-19
By default, the SCC26C92 is enabled for both
transmit
and
receive
. This will allow for the use of an
485 operation is half-duplex only, which means
RS-232 in full-duplex mode. Once this is done, you can transmit and receive data as needed. If you do
need to do limited flow control, the MPO pin on the J1 header can be used for RTS. For a sample file
showing RS232 full duplex communications, please see r
e_scc.c
in the directory
tern\186\samples\re
.
RS485 is slightly more complex to use than RS232. RS
transmission does not occur concurrently with reception. The RS485 driver will echo back bytes sent to
the SCC. As a result, assuming you are using the RS485 driver installed on another TERN peripheral
board, you will need to disable
receive
while transmitting. While transmitting, you will also need to place
the RS485 driver in transmission mode as well. While you are receiving data, the RS485 driver will need
to be placed in receive mode.
s
n
_send_e/s
n
_rec_e
Arguments:
none
Return value:
none
This function enables transmission or reception on the SCC26C92 UART for channel
n
, where
n
can be
‘1’ or ’2’. After initialization, both of these functions are disabled by default. If you are using RS485,
only one of these two functions should be enabled at any one time.
Transmission and reception of data using the SCC is in most ways identical to SER0. The functions used
putser
n
er
n
etsers
n
h
nctions work for both SER1 and SER2, yet it is still important to remember that any function
cal
pass both COM arguments. Refer to the full definition of
s2_init()
for the format that
st be followed for all calls to SER2
low control is also handled in a mostly similar fashion. The follow table summarizes the flow control
sig
to transmit and receive data are similar. For details regarding these functions, please refer to the previous
section.
putsers
n
gets
g
T e above fu
l to SER2 must
mu
F
nals.
Channel
Flow control line SCC name Location on RE
SER1
RTS
OP0
J2 pin 27
SER1
CTS
IP0
J2 pin 36
SER2
RTS
OP1
J1 pin 3
SER2
CTS
IP1
J2 pin 24