1 asynchronous serial i/o unit code examples – Intel 386 User Manual

Page 320

Advertising
background image

11-33

ASYNCHRONOUS SERIAL I/O UNIT

11.4.1 Asynchronous Serial I/O Unit Code Examples

The code example contains these software routines:

InitSIO

Initializes the SIO for asynchronous transfers

SerialReadStr

Polled serial read function that reads a specified number of
characters

SerialReadChar

Polled serial read function that reads a single character

SerialWriteChar

Polled serial write function that writes a single character

SerialWriteStr

Polled serial write function that writes out an entire string of
characters

SerialWriteMem

Polled serial write function that writes out a specified number of
characters stored in a buffer

Serial0_ISR

Template interrupt service routine for SIO_0 interrupts

Service_RBF

Service routine for interrupts generated by the Receive Buffer Full
signal

SerialWriteStr_Int

Interrupt driven serial write function

Service_TBE

Service routine for interrupts generated by the Transmit Buffer
Empty signal

The last software routine shows how to use these functions to enable RBF interrupts on the SIO.
See Appendix C for the included header files.

#include <conio.h>

#include <stdio.h>

#include “80386ex.h”

#include “ev386ex.h”

/* Variable Declarations */

int Tbuffer_index = 0;

char trans_buffer[1024];

char rec_buffer;

/*****************************************************************************

InitSIO:

Description:

Initialization routine for Asynchronous Serial I/O Port.

Parameters:

Unit

Unit number of the serial port. 0 for SIO port 0,

1 for SIO port 1.

Mode

Defines Parity, number of data bits, number of stop bits--

Reference Serial Line Control register for various

Advertising