1 mapi_uartinit(), 2 mapi_uarttx(), Serial/rs232 interface – Maxim Integrated 78M6612 M-API Library User Manual

Page 39: Mapi_uartinit(), Mapi_uarttx()

Advertising
background image

UG_6612_036

78M6612 M-API Library User Guide

Rev. 1.00

39

4.9 Serial/RS232 Interface

4.9.1 MAPI_UARTInit()

Purpose

Configure the communication speed, flow control, character parity and number of
stop bits. The serial interrupt service routine is NOT maskable, the interrupt
vector is set internally. Xon/Xoff will always be enabled. Non-parity, 8 data bit, 1
stop bit is the only supported configuration. The only thing the application can
change is the baud rate.


Synopsis

Bool MAPI_UARTInit ( IN enum SERIAL_SPD speed, Bool XOnOff)


Parameters

speed

:

Input parameter

This selects the communication speed. Possible values are:

_RATE_300

0

_RATE_600,

1

_RATE_1200,

2

_RATE_2400,

3

_RATE_4800,

4

_RATE_9600,

5

_RATE_19200,

6

_RATE_38400,

7 (default)


Return Codes

None.

4.9.2 MAPI_UARTTx()

Purpose

Setup the Tx buffer before sending data to the PC UART. Subsequent call to this
API will append the buffer to the existing transmittal buffer. An application should
call this API immediately after calling MAPI_UARTInit(). This is a non-
blocking call so always call MAPI_TxLen to make sure the transmission is
completed successfully.


Synopsis

enum SERIAL_RC data MAPI_UARTTx ( U08x xdata *buffer, U16 len )


Parameters

buffer

Input parameter.

Specifies a pointer to the data buffer containing data to send to the
PC UART.

Len

Input parameter.
Specifies the current number of bytes to be sent.

Return Codes:

S_EMPTY Successful transmission.

S_PENDING, Successful transmission thus far but not yet finished.

Where return code SERIAL_RC is defined as: Enum SERIAL_RC.

After calling this API, an application can make sure all bytes were transmitted by
checking that MAPI_TxLen() returns a 0.

Advertising