Author Topic: Unable to Use ModbusRTUCom Driver directly via code  (Read 971 times)

Jie

  • Newbie
  • *
  • Posts: 5
    • View Profile
Unable to Use ModbusRTUCom Driver directly via code
« on: October 04, 2020, 02:51:09 AM »
Hi,

I am trying to make the VB.Net send the value to PLC (Panasonic FP0R)
If i am using Basic Button or Basic Label, it works.
But if i am using below code, ModbusRTUCom is not declared error came out on Visual Studio 2019

ModbusRTUCom.Write(400003, txtFinalOutput.Text)

I trying to declare as below just for testing, but no data register changes on the PLC.
 Dim driver As New AdvancedHMIDrivers.ModbusRTUCom
            driver.Write("400003", "1")

Any idea ?

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Unable to Use ModbusRTUCom Driver directly via code
« Reply #1 on: October 04, 2020, 03:29:00 AM »
By creating a new driver you are using its default parameters, which might not match your setup.

See this topic:  https://www.advancedhmi.com/forum/index.php?topic=1545.0


Jie

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Unable to Use ModbusRTUCom Driver directly via code
« Reply #2 on: October 04, 2020, 03:32:41 AM »
Hi Godra,

Thanks for the link,

is there any way to just use ModbusRTUCom.Write(400003, txtFinalOutput.Text) without getting an error "ModbusRTUCom is not declared" in VS2019 ?

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Unable to Use ModbusRTUCom Driver directly via code
« Reply #3 on: October 04, 2020, 05:09:36 PM »
You have to have the driver declared, whether by adding it to the form or by creating it in the code.