Publication 1756-RM004B-EN-P - October 2000
5-2 Serial Port API
Serial Data Transfer
The serial API communicates with foreign serial devices via industry
standard UART hardware. The API acts as a high level interface that
hides the hardware details from the application programmer.
The primary purpose of the API is to allow data to be transferred
between the module and a foreign device. Because each foreign
device is different, the communications protocol used to transfer data
must be device specific. The application must be programmed to
implement the specific protocol of the device in order for the data can
to be processed by the application and transferred to the control
processor.
Serial Port API Functions
This section provides detailed programming information for each of
the API library functions. The calling convention for each API function
is shown in C format. The API library routines are categorized by
functionality as shown in table 5.B.
IMPORTANT
Take care if using PRT1 (COM1) when the console is
enabled or the Setup jumper is installed (see
chapter 1). If the console is enabled, the serial API
will not be able to change the baud rate on PRT1. In
addition, console functions such as keyboard input
may not behave properly while the serial API has
control of PRT1. To avoid this situation disable the
console when using PRT1 with the serial API.
Table 5.B Serial Port API Functions
Function Category Function Name Description
Initialization MVIsp_Open Initializes access to a serial port.
MVIsp_OpenAlt Alternate form of MVIsp_Open with more
options
MVIsp_Close Terminates access to a serial port
Configuration MVIsp_Config Configures a serial port.
MVIsp_SetHandshaking Setup handshaking for a serial port
Port Status MVIsp_SetRTS Set the state of the RTS line.
MVIsp_GetRTS Get the state of the RTS line.
MVIsp_SetDTR Set the state of the DTR line.
MVIsp_GetDTR Get the state of the DTR line.
MVIsp_GetCTS Get the state of the CTS line.
MVIsp_GetDSR Get the state of the DSR line.
MVIsp_GetDCD Get the state of the DCD line.
MVIsp_GetLineStatus Get the serial port line status
Communications MVIsp_Putch Send a character to a serial port.