X hits on this document

78 views

0 shares

0 downloads

0 comments

28 / 37

MODBUS Communications Driver - Functions

PortSetup: Get/Set Communications Parameters

SYNOPSIS

short status = MB GetPortSetup(short *port, short *baudcode, short *parity, short *stops, short *datasize); _

short status = MB_SetPortSetup(short port, short baudcode, short parity, short stops, short datasize);

status port baudcode parity stops datasize

Error Return Port Number Baud Rate Code Parity Mode Number of stop bits Data transmission size (bits)

Integer Integer Integer Integer Integer Integer

DESCRIPTION

Use this command to change the Port and Speed used by the Driver. The port number can range from 1 (for COM1:) to the highest communications port supported by your machine (usually 4 or 8). The Baud Rate code must be chosen from the table below.

Currently, MBDRV MODBUS "RTU Mode" communications are always set for 8 data bits and 1 stop bit. Accordingly, MB_GetPortSetup always returns 1 and 8 for the stop bits and data size variables. MB_SetPortSetup ignores these variables, but they are included for potential use in a future version of the Driver DLL.

Code

Baud Rate

0

110

1

150

2

300

3

600

4

1200

5

2400

The Baud Rate code must be an integer from 0 to 11. Here is a table of the baud rate values:

Code

Baud Rate

6

4800

7

9600

8

19200

9

38400

10

57600

11

115200

Note. When using the MB_GetPortSetup function, you can supply NULL pointers for any values you don’t want to retrieve.

Page 20

June 6, 1998

Revision 2.210

Document info
Document views78
Page views80
Page last viewedFri Dec 02 20:18:49 UTC 2016
Pages37
Paragraphs781
Words6172

Comments