AdvancedHMI Software

General Category => Open Discussion => Topic started by: halosome on September 29, 2019, 03:04:03 PM

Title: Dynamically assign PLCAddress to number displayer, SevenSegment2 and Odometer
Post by: halosome on September 29, 2019, 03:04:03 PM
Is it possible to assign the PLCAddress on those displayers in programming? I tried use to integers or strings ("41001") and they all failed.

I am trying to use a group of displayers to show several groups of devices by selecting different ModbusTCP Addresses.
Title: Re: Dynamically assign PLCAddress to number displayer, SevenSegment2 and Odometer
Post by: Godra on September 29, 2019, 05:41:55 PM
See your other topic for answer:

https://www.advancedhmi.com/forum/index.php?topic=2517.0

Title: Re: Dynamically assign PLCAddress to number displayer, SevenSegment2 and Odometer
Post by: halosome on September 29, 2019, 06:24:06 PM
I try to make it simple so I directly drag the controls in the form, but when I change the controls' PLCaddress, the value not changed, it sticks to the one from the address in the form designer.

Dim addr1 as integer = 40001
Dim addr2 as integer = 40011
If DeviceID=1 then
Odometer1.PLCAddressValue.PLCAddress = addr1.ToString
Odometer2.PLCAddressValue.PLCAddress = (addr1+1).ToString
Else
Odometer1.PLCAddressValue.PLCAddress = addr2.ToString
Odometer2.PLCAddressValue.PLCAddress = (addr2+1.ToString
End If
Title: Re: Dynamically assign PLCAddress to number displayer, SevenSegment2 and Odometer
Post by: halosome on September 29, 2019, 08:35:37 PM
Hello Godra and Archie, please help.

It seems most of the problems are solved except this one, I really need help in solving this issue because I would like to create one page for several same devices (their Modbus addresses are the only difference). Once I select a device, the device base address plus offsets will be applied to all the display components. But currently they all stick to the address at the form designer.

Title: Re: Dynamically assign PLCAddress to number displayer, SevenSegment2 and Odometer
Post by: Godra on September 29, 2019, 09:27:10 PM
Code: [Select]
        Dim addr1 As Integer = 40001
        Dim addr2 As Integer = 40011
        If DeviceID = 1 Then
            Odometer1.PLCAddressValue = New Drivers.PLCAddressItem(addr1.ToString)
            Odometer2.PLCAddressValue = New Drivers.PLCAddressItem((addr1 + 1).ToString)
        Else
            Odometer1.PLCAddressValue = New Drivers.PLCAddressItem(addr2.ToString)
            Odometer2.PLCAddressValue = New Drivers.PLCAddressItem((addr2 + 1).ToString)
        End If
Title: Re: Dynamically assign PLCAddress to number displayer, SevenSegment2 and Odometer
Post by: halosome on September 29, 2019, 10:11:13 PM
It seems working! I will test it tomorrow.

Thank you!