Author Topic: ModbusTCP SendData DLL Instance not created  (Read 1142 times)

iDeeW

  • Newbie
  • *
  • Posts: 18
    • View Profile
ModbusTCP SendData DLL Instance not created
« on: December 30, 2016, 09:03:52 AM »
Everybody ,

I'm using the latest version & getting an error when I try to write a register.

Code: [Select]
ModbusTCPCom1.Write(40016, 100)
Below is the full error massage. Any ideas?

An exception of type 'MfgControl.AdvancedHMI.Drivers.Common.PLCDriverException' occurred in MfgControl.AdvancedHMI.Drivers.dll but was not handled in user code

Additional information: ModbusTCP SendData DLL Instance not created


Thanks,
« Last Edit: December 30, 2016, 09:09:21 AM by iDeeW »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5268
    • View Profile
    • AdvancedHMI
Re: ModbusTCP SendData DLL Instance not created
« Reply #1 on: December 30, 2016, 09:44:22 AM »
Try to do a read before doing the write

iDeeW

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: ModbusTCP SendData DLL Instance not created
« Reply #2 on: December 30, 2016, 12:39:39 PM »
I wanted to use it with TextChange event of a Textbox.

Code: [Select]
Private Sub tbAlm_TextChanged(sender As Object, e As EventArgs) Handles tbAlm.TextChanged
        ModbusTCPCom1.Write(40016, 100)
    End Sub

The above error pops, when I hit F5 to start the app.

When I do it the same with a button click event, everything works.

Thanks
« Last Edit: December 30, 2016, 12:43:40 PM by iDeeW »

Godra

  • Hero Member
  • *****
  • Posts: 1438
    • View Profile
Re: ModbusTCP SendData DLL Instance not created
« Reply #3 on: December 30, 2016, 07:15:50 PM »
I just tested your code and it works with the TextChanged event of a TextBox.

Tried it with both direct and indirect change of the text.

As Archie suggested, also try reading before writing:

Code: [Select]
    Private Sub tbAlm_TextChanged(sender As Object, e As EventArgs) Handles tbAlm.TextChanged
        ModbusTCPCom1.Read("40016")
        ModbusTCPCom1.Write("40016", "100")
    End Sub
« Last Edit: December 30, 2016, 07:24:39 PM by Godra »

ddddd13

  • Full Member
  • ***
  • Posts: 118
    • View Profile
Re: ModbusTCP SendData DLL Instance not created
« Reply #4 on: November 13, 2019, 06:28:40 PM »
I tried the same thing it didn't work. When I put the quotation marks in "40005", "1" it worked!!!

Godra

  • Hero Member
  • *****
  • Posts: 1438
    • View Profile
Re: ModbusTCP SendData DLL Instance not created
« Reply #5 on: November 13, 2019, 07:43:11 PM »
The code I posted already shows them both with quotation marks.

One needs to observe the format of the function while typing the code.
If it asks for a String and Integer value is typed instead, causing issues, then just "quote" it.