beautypg.com

Niolock, Nserialconfigure – Measurement Computing Net232 User Manual

Page 12

background image

12

Net232 User’s Guide,

1037-0901, rev 2.0

nIOLock

Function: int nIOLock (long session, short iotype, short channel, short lock);
Parameters:

Long

session

The session handle of the Net232

Short

iotype

Always a 9

Short

port

The serial port being locked (1 for the Net232,
0 for the AUX port)

Short

lock

0 to unlock, 1 to lock

Returns: 0 if successful, error code if not.

Description: This function is used to lock the serial port of the Net232 so that another session can’t have access to

it. If a serial port is left unlocked, then another session could gain access to that port, causing
unpredictable results.

Example:

ErrVal = nIOLock(session, 9, 1, 1);

nSERIALConfigure

Function: int nSERIALConfigure (long session, short port, long baudrate, short parity,

short databits, short stopbits, short flowctrl, long reserved);

Parameters:

Long

session

The session handle of the Net232

Short

port

The serial port being configured

Long

baudRate

The baud rate to be used

Short

parity

The parity setting to be used

Short

databits

The number of data bits to be used

Short

stopbits

The number of stop bits to use

Short

flowControl

The handshaking method to use

Long

reserved

Always 0

Parameter Values:

Port:

Aux = 0
Net232 = 1

Baud Rates:

300, 1200, 2400, 4800, 9600, 19200, 28800, 38400, 57600,
115200.

Parity Settings:

odd = 79
Even = 69
None = 78

Data Bits:

7, 8

Stop Bits:

1,2

Flow Control:

none = 0
Xon/Xoff = 1
Dtr/Dsr = 2
Rts/Cts = 3

Returns: 0 if successful, error code or warning if command not completed.

Description: This function is used to configure the selected serial port parameters of the Net232 ethernet interface.

The parameters used must match the Net232 serial port configuration switches on the rear of the unit.
Because this function may take some time to complete, the return value must be tested to see if the
command has completed. The return value for command pending is –801.

Example:

Do {

ErrVal = nSERIALConfigure(session, 1, 38400, 78, 8, 1, 3, 0);

} while (errVal == -801);