ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Communication / Modbus functions
  • Properties specific to modbusSession variables
  • WLanguage functions that use modbusSession variables
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
modbusSession (Type of variable)
In french: modbusSession
The modbusSession type is used to identify a connection to a Modbus server.
Remark: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
New in version 2024
WEBDEV - Server code This type of Variable is now available in WEBDEV Server (Windows and Linux).
Example
// On crée une session et on se connecte au serveur Modbus Ã  l'adresse 192.168.1.18 sur le port 3275
Session is modbusSession
Session = ModbusConnectTCP("192.168.1.18",3275)

// Si la connexion Ã©choue, affiche l'erreur
IF ErrorOccurred = True THEN
Trace(ErrorInfo())
ELSE
// Ecrit une valeur dans le registre 0x42 du serveur.
ModbusWriteRegister(Session, 0x42,0xCAFE)
END

// Déconnection du serveur
ModbusDisconnect(Session)
Remarks

Properties specific to modbusSession variables

The following properties can be used to handle Modbus sessions:
Property nameType usedEffect
ResponseTimeoutentierMaximum timeout for a Modbus server response.
SlaveIDentierSlave ID. Used to change the slave ID without having to open a session again.

WLanguage functions that use modbusSession variables

modbusSession variables can be handled using the following WLanguage functions:
ModbusConnectRTUConnects a client to a Modbus slave via a serial port.
ModbusConnectTCPConnects a client to a Modbus server via transmission control protocol (TCP).
ModbusDisconnectCloses the Modbus session.
ModbusReadBitReads one or more bits from a Modbus slave, starting at a specific address.
ModbusReadFloatReads one or more single-precision floats from a Modbus slave, starting at a specific address.
ModbusReadRegisterReads one or more registers from a Modbus slave, starting at a specific address.
ModbusWriteBitWrites one or multiple bits to a specific address in a Modbus slave.
ModbusWriteFloatWrites one or more single-precision floats to a Modbus slave, starting at a specific address.
ModbusWriteRegisterWrites one or more registers (16-bit values) to a Modbus slave, starting at a specific address.
See also
Minimum version required
  • Version 26
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 11/18/2023

Send a report | Local help