4-14
The asynchronous serial I/O ports available on the NEC V25 processor have many other features that might
be useful for your application. If you are truly interested in having more control, please read Chapter 11 of
the User’s Manual for a detailed discussion of other features available to you.
4.4
Functions in SCC.OBJ
The functions found in this object file are prototyped in scc.h in the
tern\v25\include
directory.
The SCC is a component that is used to provide a third asynchronous port. It uses the 8 MHz system clock
for driving serial communications. The divisors and function arguments for setting up the baud rate for this
third port are different than for SER0 and SER1.
Function Argument
Baud Rate
1
110
2
150
3
300
4
600
5
1200
6
2400
7
4800
8
9600 (default)
9
19,200
10
31,250
11
62,500
12
125,000
13
250,000
Unlike the other serial ports, macro service transfer is not used to fill the input buffer for SCC. Instead, an
interrupt-service-routine is used to place characters into the input 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, this means data might be lost in the SCC as bytes overflow.
Special control registers are used to define how the SCC operates. For a detailed description of registers
MR1 and MR2, please see Appendix C of this manual. In most TERN applications, MR1 is set to 0x57,
and MR2 is set to 0x07. This configures the SCC for no flow control (RTS, CTS not used/checked), no
parity, 8-bit, normal operation. Other configurations are also possible, providing self-echo, even-odd parity,
up to 2 stop bits, and 5 bit operation, as well as automatic hardware flow control.
Initialization occurs in a manner otherwise similar to SER0 and SER1. A COM structure is once again
used to hold state information for the serial port. The in-bound and out-bound buffers operate as before,
and must be provided upon initialization.
scc_init
Arguments: unsigned char m1, unsigned char m2, unsigned char b, unsigned char* ibuf, int isiz, unsigned
char* obuf, int osiz, COM *c
Return value: none
This initializes the SCC2691 serial port to baud rate b, as defined in the table above. The values in m1 and
m2 specify the values to be stored in to MR1 and MR2. As discussed above, these values are normally
0x57 and 0x07, as shown in TERN sample programs.
ibuf and isiz define the input buffer characteristics, and obuf and osiz define the output buffer.