AdvancedHMI Software
General Category => Open Discussion => Topic started by: halosome on September 29, 2019, 04:20:07 PM
-
SS10 = New AdvancedHMIControls.SevenSegment2
SS11 = New AdvancedHMIControls.SevenSegment2
SS12 = New AdvancedHMIControls.SevenSegment2
SS10.Location = New Point(400, 160)
SS11.Location = New Point(400, 220)
SS12.Location = New Point(400, 280)
SS10.ForeColorInLimits = SystemColors.Info
SS11.ForeColorInLimits = SystemColors.Info
SS12.ForeColorInLimits = SystemColors.Info
SS10.BackColor = SystemColors.Window
SS10.PLCAddressValue = New Drivers.PLCAddressItem("43006,1,,,0.1,0")
SS11.PLCAddressValue = New Drivers.PLCAddressItem("43008,1,,,0.1,0")
SS12.PLCAddressValue = New Drivers.PLCAddressItem("43010,1,,,0.1,0")
Me.Controls.Add(SS10)
Me.Controls.Add(SS11)
Me.Controls.Add(SS12)
Me.Refresh()
-
It should be similar to this:
Private SS10, SS11, SS12 As AdvancedHMIControls.SevenSegment2
Private Sub MainForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
SS10 = New AdvancedHMIControls.SevenSegment2
SS11 = New AdvancedHMIControls.SevenSegment2
SS12 = New AdvancedHMIControls.SevenSegment2
SS10.Location = New Point(600, 160)
SS11.Location = New Point(600, 320)
SS12.Location = New Point(600, 480)
SS10.Size = New Size(220, 88)
SS11.Size = New Size(220, 88)
SS12.Size = New Size(220, 88)
SS10.ForeColorInLimits = SystemColors.Info
SS11.ForeColorInLimits = SystemColors.Info
SS12.ForeColorInLimits = SystemColors.Info
SS10.BackColor = SystemColors.Window
SS10.ComComponent = Me.ModbusTCPCom1
SS11.ComComponent = Me.ModbusTCPCom1
SS12.ComComponent = Me.ModbusTCPCom1
SS10.PLCAddressValue = New Drivers.PLCAddressItem("43006", 1, "", "", 0.1, 0)
SS11.PLCAddressValue = New Drivers.PLCAddressItem("43008", 1, "", "", 0.1, 0)
SS12.PLCAddressValue = New Drivers.PLCAddressItem("43010", 1, "", "", 0.1, 0)
Me.Controls.Add(SS10)
Me.Controls.Add(SS11)
Me.Controls.Add(SS12)
End Sub
-
My guess is that you are missing to set the Size
-
Thank you both.
Its right, I tried the code, it works. But there is another problem now, the modbustcp.beginread which i call every 100mS pops up an exception:
MFgControls.advancedHMI.driver.comm.PLCDriverException: 'ModbusTCP SendData DLL Instance not Created.
The BeginRead is calling from the MainForm, the add controls code is in Form10. If I don't show form10, everything is OK, if I show Form10, the exception pops up right away.
-
Does it happen if you call Read instead of BeginRead ?
The error can happen if the IPAddress is left at 0.0.0.0
-
You got it. I left form10's driver to 0.0.0.0.
Thanks Archie!