MODBUS Communications Driver - Functions
PortSetup: Get/Set Communications Parameters
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
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.
The Baud Rate code must be an integer from 0 to 11. Here is a table of the baud rate values:
Note. When using the MB_GetPortSetup function, you can supply NULL pointers for any values you don’t want to retrieve.
June 6, 1998