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
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
modbusSession (Variable type)
In french: modbusSession
The modbusSession type is used to identify a connection to a Modbus server.
Note: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
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)
Properties

Properties specific to modbusSession variables

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

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: 03/28/2025

Send a report | Local help