2 s26_comsetbreakchar() – Sensoray 2600 User Manual

Page 70

Advertising
background image

Sensoray 2600 Programming Guide

66

Comport Transaction Functions

Returns:

Error/status value, as described in section 8.1.1.

Notes:

Following a MM reset,

S26_ComSetMode()

should be called to configure each comport that will be used. A

comport must be configured before opening it or attempting to send data to or receive data from its remote serial
device.

The target comport must be closed when

S26_ComSetMode()

is called. If the comport is open, the command will

be rejected and the status byte’s

COM_REJECTED

flag will be set.

Example:

// Configure COM1 on MM number 0 for the following operating mode:

// 9600 baud, no parity, 8 data, one stop, no flow control, light LED upon receive.

u32 errstat = S26_ComSetMode( 0,

LOGDEV_COM1,

SIO_BR_9600,

SIO_PHY_RS232 | SIO_PARITY_NONE | SIO_DATA_8 | SIO_STOP_1 | SIO_FLOW_OFF,

SIO_LED_RECEIVE,

1000,

1 );

if ( errstat & GWERRMASK )

printf( "COM1 error detected.\n" );

else if ( errstat & COM_REJECTED )

printf( "Error: cannot set mode while COM1 is open.\n" );

else

printf( "Successfully configured COM1.\n" );

8.2.2 S26_ComSetBreakChar()

Function:

Specifies the Break character for a comport.

Prototype:

u32 S26_ComSetBreakChar( u32 hbd, u8 dev, u8 BreakChar, u32 msec, u32 retries );

Returns:

Error/status value, as described in section 8.1.1.

Notes:

Following a MM reset,

S26_ComSetBreakChar()

may be called for each comport to specify the port’s break

character. The break character will be automatically inserted into the comport’s receive buffer in the event a break

Parameter

Type

Description

hbd

u32

MM handle.

dev

u8

Logical device identifier for the target comport. Specify a value from 1 to 4 to
address comport 1 to 4, respectively.

BreakChar

u8

Specifies the character that is to be inserted into the receive buffer upon detection of
an incoming break condition. The default break character is 0x00 upon power-up or
reset of the MM.

msec

u32

Maximum time, in milliseconds, to wait for the MM to respond.

retries

u32

Maximum number of transaction retry attempts.

The leds byte is shown to the right.

When set to logic one, each bit will cause the comport’s status
LED to light for approximately 100 milliseconds in response
to the associated event.

Any combination of these bits may be specified. For
example, the XMT and RCV bits may both be set, in which case
the LED will light when characters are sent or received at the
comport.

After a module reset, the RCV flag is set and all other flags are
reset to zero.

XMT

causes the LED to light when a character is transmitted.

RCV

causes the LED to light when a character is received.

ERR

causes the LED to light when a receiver break condition

is detected or when an error (framing, overrun or parity) is
detected.

7

0

6

0

5

4

0

3

XMT

2

1

0

RCV ERR

0

0

Advertising