beautypg.com

Chapter 8: comport transaction functions, 1 overview, 2 configuration – Sensoray 2600 User Manual

Page 68

background image

Sensoray 2600 Programming Guide

64

Comport Transaction Functions

Chapter 8: Comport Transaction Functions

8.1 Overview

This section describes the middleware functions that are used to configure and operate the MM’s asynchronous serial
communication ports. All of the programming examples reference constants that are defined in the header file

App2600.h

.

8.1.1 Return Values

All comport functions return a u32 value consisting of a three-byte error code and a status byte. The comport error types are a
subset of the transaction error types described in section 5.5. The error code occupies the most significant three bytes of the
returned value, and the status byte resides in the least significant byte. Zero is returned for the error type if the comport transaction
was successful. The returned status byte, which is valid only if the error code is zero, contains a set of active-high bit flags:

All comport status flags are passed through to the application exactly as they are received in the MM’s response packet.

8.2 Configuration

8.2.1 S26_ComSetMode()

Function:

Sets the operating mode for a comport.

Bit

Description

COM_REJECTED

A comport command was rejected by the MM. This flag has various meanings, depending on the
command that was executed. This is automatically reset at the beginning of each command.

COM_ISOPEN

The comport is open (i.e., transmit and receive operations are enabled). This is set by S26_ComOpen()
and reset by S26_ComClose().

COM_FRAMINGERROR

The UART detected a framing error on a received character. This may be reset by calling
S26_ComClearFlags()

or S26_ComFlush().

COM_PARITYERROR

The UART detected a parity error on a received character. This may be reset by calling
S26_ComClearFlags()

or S26_ComFlush().

COM_OVERFLOWERROR

This indicates one of two conditions:

1. The UART receiver overflowed. This may be reset by calling S26_ComClearFlags() or
S26_ComFlush()

.

2. The receiver’s ring buffer overflowed, or the UART receiver overflowed. To avoid this error, be sure
to remove received data from the receiver buffer before it becomes full. This may be reset by calling
S26_ComClearFlags()

or S26_ComFlush().