Added a button and the EthernetIPforPLC5Com1 to the default MainForm AdvancedHMI project in VS2017. set the ip address for the EthernetIPforPLC5Com1 (PLC 5 80E) object to the correct value.
Added to the button click event
Private Sub MainMenuButton1_Click(sender As Object, e As EventArgs) Handles MainMenuButton1.Click
MsgBox(EthernetIPforPLC5Com1.Read("N16:255"))
End Sub
Below is the stack trace when run in debug mode
MfgControl.AdvancedHMI.Drivers.Common.PLCDriverException occurred
HResult=0x80131500
Message=Read Failed - 240. Error code in EXT STS Byte
Source=MfgControl.AdvancedHMI.Drivers
StackTrace:
at MfgControl.AdvancedHMI.Drivers.AllenBradley.PCCC.PCCCforHMI.Read(String startAddress, Int32 numberOfElements)
at MfgControl.AdvancedHMI.Drivers.AllenBradley.PCCC.PCCCforHMI.Read(String startAddress)
at MfgControl.AdvancedHMI.MainForm.MainMenuButton1_Click(Object sender, EventArgs e) in C:\Projects\Mondelez\AdvancedHMIv399x\AdvancedHMI\MainForm.vb:line 32
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at MfgControl.AdvancedHMI.MainMenuButton.OnClick(EventArgs e) in C:\Projects\Mondelez\AdvancedHMIv399x\AdvancedHMI\FormChangeControls\MainMenuDriven\MainMenuButton.vb:line 208
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at MfgControl.AdvancedHMI.My.MyApplication.Main(String[] Args) in :line 81
the value in the PLC is 230. The weird thing is if I change the address to
MsgBox(EthernetIPforPLC5Com1.Read("N16:254"))
or
MsgBox(EthernetIPforPLC5Com1.Read("N16:256"))
it works without issue... Any ideas?