AdvancedHMI Software

General Category => Support Questions => Topic started by: ronj on September 29, 2015, 08:42:57 AM

Title: Modbus TCP: Button to clear several coils at once
Post by: ronj on September 29, 2015, 08:42:57 AM
Hi,
I have an application using Modbus TCP to control a VSD that has separate "coils" for forward and reverse operation. To stop, I need to clear both "coils". Is there a way for a single button to write the same value (in this case reset) to more than one "coil" address?

Regards,
Ron
Title: Re: Modbus TCP: Button to clear several coils at once
Post by: Archie on September 29, 2015, 08:49:33 AM
You can do this with a little VB code.

- Add a Button to the form from the All Windows Forms group in the ToolBox
- Double click the button to get  back to the code
- Enter code similar to this:

ModbusTCPCom1.Write("40001","0")
ModbusTCPCom1.Write("40002","1")
Title: Re: Modbus TCP: Button to clear several coils at once
Post by: ronj on September 29, 2015, 09:25:29 AM
Hi Archie,
Your suggestion works well - thanks.
I notice it also works in the click event of a PilotLight like this:

    Private Sub PilotLight4_Click(sender As Object, e As EventArgs) Handles PilotLight4.Click
        ModbusTCPCom1.Write("00001", "0")
        ModbusTCPCom1.Write("00002", "0")
    End Sub

Is there any problem with using a PilotLight like this?

Ron
Title: Re: Modbus TCP: Button to clear several coils at once
Post by: Archie on September 29, 2015, 09:51:29 AM
You can use any of the controls. They all have the click event that works the same.