Author Topic: write numeric up/down to holding register using modbus tcp  (Read 2440 times)

tbrew01

  • Newbie
  • *
  • Posts: 8
    • View Profile
write numeric up/down to holding register using modbus tcp
« 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

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5268
    • View Profile
    • AdvancedHMI
Re: write numeric up/down to holding register using modbus tcp
« Reply #1 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