AdvancedHMI Software

General Category => Support Questions => Topic started by: tbrew01 on August 28, 2013, 05:49:39 AM

Title: write numeric up/down to holding register using modbus tcp
Post by: tbrew01 on August 28, 2013, 05:49:39 AM
Hi, does anyone have any sample code to write a numerical up/down to a holding register using the modbus TCP driver? I'm very new a VB i have programmed a bit of c, java lots of ladder etc. I'll have to go back and learn VB from the basics put i'm in a rush to prove a concept, and short for time. any help would be awesome.

Thanks guys
Title: Re: write numeric up/down to holding register using modbus tcp
Post by: Archie on August 28, 2013, 07:20:46 AM
The simplest way is to add a numeric up/down from the ToolBox to your form, then double click it to get back to the code, then add this code:

Code: [Select]
    Private Sub NumericUpDown1_ValueChanged(sender As System.Object, e As System.EventArgs) Handles NumericUpDown1.ValueChanged
        ModbusTcpCom1.Write("40001", NumericUpDown1.Value)
    End Sub