Author Topic: combining different registers of a modbus device  (Read 3107 times)

reario

  • Newbie
  • *
  • Posts: 2
    • View Profile
combining different registers of a modbus device
« on: April 23, 2014, 05:22:15 AM »
hi,
Is it possible to display in a DigitalDispaly control the result of sum of 2 different registers in a modbus device?
I've created two data subscribers (one for registry n. 40022 and one for registry n. 40023) but I don't know how combine it in a single source for the digital panel.
The digital panel only accepts one source and one registry.
thanks, Vittorio
« Last Edit: April 23, 2014, 03:21:25 PM by reario »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5269
    • View Profile
    • AdvancedHMI
Re: combining different registers of a modbus device
« Reply #1 on: April 23, 2014, 08:46:49 AM »
Try this to see if it works for you:
Code: [Select]
    Private Sub DataSubscriber1_DataChanged(sender As System.Object, e As MfgControl.AdvancedHMI.Drivers.Common.PlcComEventArgs) Handles DataSubscriber1.DataChanged, DataSubscriber2.DataChanged
        DigitalPanelMeter1.Value = CInt(DataSubscriber1.Value) + CInt(DataSubscriber2.Value)
    End Sub

reario

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: combining different registers of a modbus device
« Reply #2 on: April 23, 2014, 03:26:52 PM »
Try this to see if it works for you:
Code: [Select]
    Private Sub DataSubscriber1_DataChanged(sender As System.Object, e As MfgControl.AdvancedHMI.Drivers.Common.PlcComEventArgs) Handles DataSubscriber1.DataChanged, DataSubscriber2.DataChanged
        DigitalPanelMeter1.Value = CInt(DataSubscriber1.Value) + CInt(DataSubscriber2.Value)
    End Sub
Thanks, it seems to work, but I have two new questions:
1) in the property windows of DigitalPanel I have to set up the PLCAddressValue and the CommComponent. Is it possible to set a dummy values for these fields? Sometimes the program launches an exception if I leave the PLCAddress empty.
2) The DigitalPanel shows only integer value but I'm interested to display also the fractionary part
Thanks, again, Vittorio

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5269
    • View Profile
    • AdvancedHMI
Re: combining different registers of a modbus device
« Reply #3 on: April 23, 2014, 07:42:20 PM »
If you leave the PLCAddress properties blank, the meter will not request values from the PLC. You can then use code to put values in the Value property.

The DigitalPanelMeter is an integer only display, but you can "simulate" a floating point by using DecimalPosition along with ValueScaleFactor. Try putting a 10 in ValueScaleFactor and a 1 in DecimalPosition.