User`s guide
boolean slta-rxrdy(void);
This function returns TRUE if the UART has one or more characters in its input
FIFO buffer and FALSE otherwise. The UART used in the programmable serial
gateways has a 16-character input FIFO buffer.
long slta-getchar(void);
This function tests to see if a character is waiting in the UART’s input FIFO
buffer. If there is no character waiting, the function returns - 1. If there is a
character waiting, it is returned in the least significant byte, and zero is returned
in the most significant byte.
Example:
when (slta-rxrdy()) {
// keep polling UART
char c;
c = (char) slta-getchart);
// get the character
1
Advanced Applications
For most applications, the functions in PSG . LIB are all that are necessary to
create custom programs for a programmable serial gateway using Neuron C.
However, for specialized applications, the registers of the UART and the
programmable serial gateway may be accessed directly by the application
software. This section describes these registers and how they are accessed. For
complete documentation, obtain a data sheet for the UART. The UART is an
Exar Model 16C5501 (httn://www.exar.com/products/st16c550.html).
The registers are accessed using the
s 1 ta-wri t e-uar t ( 1
and
s 1 ta-read-uart
( ) functions, which can be used to access any of the locations
in the PSG/3 or PSG-20 I/O space. When using these functions, include the file
PSGREG . H, which contains definitions for many of these locations.
void slta-write-uart (unsigned addr, unsigned data);
This function writes the data byte to the memory mapped I/O location defined by
addr.
extern unsigned slta-read-uart (unsigned addr);
This function reads the data byte from the memory mapped I/O location defined
by
addr,
and returns that value.
The map for the extended address space is shown in the following sub-sections.
Neuron C declarations for these addresses and bit assignments are provided in the
include file SLTAREG
. H
on the PSG software diskette.
13-10
Programmable Serial Gateway