01-27-2021 05:58 AM
Hi everyone
I'm trying to make a TCP/IP connection with a PLC, using an open source DLL wrriten in .NET (This Library)
first of all I create an Action Step, and call the object ModbusClient and the Connect method:
ModbusClient().Connect("device ip", port)
then I create the second Action Step, and call the WriteSingleCoil method to write a True status to Address 8193:
ModbusClient().WriteSingleCoil(8193,True)
after second step execution I get an exception error: connection error
it seems that first step execute independently and when the program execute the second step, the connected TCP/IP connection at the first step does not exist anymore.
I've read somewhere that we must store Object Reference in a Local variable and define it in the rest of the functions in different steps.. but I don't know what it means and don't know what to do..
I'm quite new to Teststand.. can anybody help ??
Thank you, Eric.
Solved! Go to Solution.
02-02-2021
01:05 AM
- last edited on
10-20-2024
02:13 PM
by
Content Cleaner
02-10-2021
06:42 PM
- last edited on
10-20-2024
02:16 PM
by
Content Cleaner
Hi ericmateovisan,
You can create first object reference then use "Use Existing Object(EasyModbus.ModbusClient).Connect(System.String, Int32)" in your next steps.
1. Create object .NET Invocation = ModbusClient(), return value is object reference
2. .NET Invocation= Use Existing Object(EasyModbus.ModbusClient).Connect(System.String, Int32)
3. .NET Invocation= Existing Object(EasyModbus.ModbusClient).WriteSingleCoil(Int32, Boolean)
important point is here, that you need to use only existing object.
check it please here topic: Use Existing Object
02-13-2021
05:03 AM
- last edited on
10-20-2024
02:16 PM
by
Content Cleaner
02-13-2021
05:08 AM
- last edited on
10-20-2024
02:17 PM
by
Content Cleaner
@sezgin.caluk wrote:
Hi ericmateovisan,
You can create first object reference then use "Use Existing Object(EasyModbus.ModbusClient).Connect(System.String, Int32)" in your next steps.
1. Create object .NET Invocation = ModbusClient(), return value is object reference
2. .NET Invocation= Use Existing Object(EasyModbus.ModbusClient).Connect(System.String, Int32)
3. .NET Invocation= Existing Object(EasyModbus.ModbusClient).WriteSingleCoil(Int32, Boolean)
important point is here, that you need to use only existing object.
check it please here topic: Use Existing Object
thank you for your reply... this solved my problem. thank you so much 😊💙