ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Communication / Modbus functions
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Closes the Modbus session.
This function disconnects the client from the Modbus server or slave and releases the serial port in the case of an RTU session.
New in version 2024
WEBDEV - Server codeWindows This function is now available for WEBDEV websites in Windows.
WEBDEV - Server codeLinux This function is now available for WEBDEV websites in Linux.
Example
// Create a session and connect to the Modbus slave through the COM4 serial port
Session is modbusSession
Session = ModbusConnectRTU("COM4")

// If the connection fails, display the error
IF ErrorOccurred = True THEN
Trace(ErrorInfo())
ELSE
// Write a value to register 0x42 in the slave
ModbusWriteRegister(Session, 0x42, 0xCAFE)
END

// Disconnection
ModbusDisconnect(Session)
Syntax
ModbusDisconnect(<Session>)
<Session>: modbusSession variable
Name of the modbusSession variable that corresponds to the Modbus session to be closed.
Business / UI classification: Business Logic
Component: wd290com.dll
Minimum version required
  • Version 26
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 11/17/2023

Send a report | Local help