AdvancedHMI Software

General Category => Support Questions => Topic started by: xpsarin on December 12, 2014, 03:16:59 PM

Title: triplc
Post by: xpsarin on December 12, 2014, 03:16:59 PM
Hello! i'm new to plc and need some help..

I have a triplc t100md+ that i want to control with the modbusRTU driver, i'm trying to add plcadress in advancedhmi.
But i can't get it to change outputs and trigger inputs on the plc, i guess i'm doing something wrong with plcadress,
i checked the com port and that should be the right one.

Hope someone knows what i'm doing wrong thanks!
Title: Re: triplc
Post by: Archie on December 12, 2014, 04:35:59 PM
If you add a BasicLabel and set the PLCAddressValue to a known good Modbus address, do you get any messages?
Title: Re: triplc
Post by: xpsarin on December 12, 2014, 04:56:54 PM
The problem is i don't know if im adressing it right, tried basiclabel and it does not work.

Invalid address Rele2 - Conversion from string "R" to type 'integer' is not valid
Title: Re: triplc
Post by: Archie on December 12, 2014, 05:54:41 PM
Modbus addresses are typically like 40001

Your user manual should give you some kind of cross reference of your PLC addresses to Modbus addresses
Title: Re: triplc
Post by: xpsarin on December 12, 2014, 06:38:03 PM
Thanks for your help so FAR! i found the addresses in the manual but now when i try one of them i get this error:

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

any idea what to try?
Title: Re: triplc
Post by: Archie on December 12, 2014, 07:14:21 PM
Are you using the latest version of 3.93? There have been daily updates working through some bugs in the Modbus driver after some new features were added.
Title: Re: triplc
Post by: xpsarin on December 12, 2014, 07:44:41 PM
yes im using v3.93

this is what i see when i click on details:

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.Collections.Generic.List`1.get_Item(Int32 index)
   at AdvancedHMIDrivers.ModbusRTU.ModbusRTUCom.GetNextTransactionID(Int32 maxValue)
   at AdvancedHMIDrivers.ModbusBase.Write(ModbusAddress address, String[] dataToWrite)
   at AdvancedHMIDrivers.ModbusBase.Write(String startAddress, String dataToWrite)
   at AdvancedHMIControls.ThreeButtonPLC.MouseDownActon(String PLCAddress)
   at AdvancedHMIControls.ThreeButtonPLC._Click1(Object sender, MouseEventArgs e)
   at System.Windows.Forms.ButtonBase.OnMouseDown(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseDown(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.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.34014 built by: FX45W81RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
----------------------------------------
AdvancedHMI
    Assembly Version: 3.9.3.0
    Win32 Version: 3.9.3.0
    CodeBase: file:///C:/Users/T%C3%B3rfr%C3%AD%C3%B0ur/AppData/Local/Apps/2.0/9K4BRZP4.ATY/JGRY8B1P.W2Q/adva..tion_6306b017ecad1fdd_0001.0000_827ffe6c8a519be0/AdvancedHMI.exe
----------------------------------------
Microsoft.VisualBasic
    Assembly Version: 10.0.0.0
    Win32 Version: 12.0.20806.33440 built by: FX45W81RTMREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.34239 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Runtime.Remoting
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.34243 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Remoting/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.34230 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
AdvancedHMIDrivers
    Assembly Version: 3.9.3.0
    Win32 Version: 3.9.3.0
    CodeBase: file:///C:/Users/T%C3%B3rfr%C3%AD%C3%B0ur/AppData/Local/Apps/2.0/9K4BRZP4.ATY/JGRY8B1P.W2Q/adva..tion_6306b017ecad1fdd_0001.0000_827ffe6c8a519be0/AdvancedHMIDrivers.DLL
----------------------------------------
AdvancedHMIControls
    Assembly Version: 3.9.3.0
    Win32 Version: 3.9.3.0
    CodeBase: file:///C:/Users/T%C3%B3rfr%C3%AD%C3%B0ur/AppData/Local/Apps/2.0/9K4BRZP4.ATY/JGRY8B1P.W2Q/adva..tion_6306b017ecad1fdd_0001.0000_827ffe6c8a519be0/AdvancedHMIControls.DLL
----------------------------------------
MfgControl.AdvancedHMI.Controls
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Users/T%C3%B3rfr%C3%AD%C3%B0ur/AppData/Local/Apps/2.0/9K4BRZP4.ATY/JGRY8B1P.W2Q/adva..tion_6306b017ecad1fdd_0001.0000_827ffe6c8a519be0/MfgControl.AdvancedHMI.Controls.DLL
----------------------------------------
MfgControl.AdvancedHMI.Drivers
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Users/T%C3%B3rfr%C3%AD%C3%B0ur/AppData/Local/Apps/2.0/9K4BRZP4.ATY/JGRY8B1P.W2Q/adva..tion_6306b017ecad1fdd_0001.0000_827ffe6c8a519be0/MfgControl.AdvancedHMI.Drivers.DLL
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
Title: Re: triplc
Post by: Archie on December 12, 2014, 08:18:19 PM
Did you try a BasicLabel with a known valid Modbus address in PLCAddressValue? The BasicLabel is the best for showing connection issues.
Title: Re: triplc
Post by: xpsarin on December 12, 2014, 08:22:57 PM
When i use basiclabel and put in address 40001.1 which should be input or 40017.1 which is the output it just says basiclabel
Title: Re: triplc
Post by: Archie on December 12, 2014, 08:25:19 PM
Do you have your programming software shut down, so AdvancedHMI can't get access to the port?

On your ModbusRTUCom1 driver instance, do all the settings match what you use in your programming software (e.g. BaudRate, Parity, StopBits, PortName)?
Title: Re: triplc
Post by: xpsarin on December 12, 2014, 08:30:35 PM
BaudRate was not the same as the plc, but that did not make any changes.
What should the BasicLabel show me?
Title: Re: triplc
Post by: Archie on December 12, 2014, 08:50:29 PM
If everything is good, it will show the value of the register in PLCAddressValue. If not, it should show the error, such as "COM1 cannot be opened"
Title: Re: triplc
Post by: xpsarin on December 12, 2014, 08:55:04 PM
Here is a picture of it
http://gyazo.com/efa9165b7319e1da4467180ee0ba7748

Title: Re: triplc
Post by: Archie on December 12, 2014, 08:58:15 PM
Try reading a full word with 40017 to see if you get any result.

The bit level reading feature was recently added and may still have some bugs that need worked out
Title: Re: triplc
Post by: xpsarin on December 12, 2014, 09:02:54 PM
Tried 40017 and 400171 still nothing, proably just me doing something wrong
Title: Re: triplc
Post by: Archie on December 12, 2014, 09:07:58 PM
I tried a few different things, but can't reproduce what you are seeing.

Give this a try:

Put 40017 in PLCAddressKeypad
Run the application, then click on the BasicLabel
You should get a popup keypad
enter a value of 1

Let me know what you get from that
Title: Re: triplc
Post by: xpsarin on December 12, 2014, 09:18:04 PM
http://gyazo.com/0875a9e06ece31bdca451034e118fe48
Title: Re: triplc
Post by: Archie on December 12, 2014, 09:31:14 PM
For some reason the driver is not creating what is referred to a DLL. This is what allows all of the communications.

In the Solution Explorer, exapand down the AdvancedHMIDrivers project, then expand down the Modbus folder. Right clock ModbusRTU.vb and select View Code

Go down to line 199 and put a break point by clicking in the left margin until you get a red dot

Run the application and it should stop at that break point. When it does press F10 and see if it steps through this code:

            If MyDLLInstance >= DLL.Count Then
                Dim NewDLL As New ModbusRTUDataLinkLayer(m_PortName)
                NewDLL.BaudRate = m_BaudRate
                NewDLL.DataBits = m_DataBits
                NewDLL.Parity = m_Parity
                NewDLL.StopBits = m_StopBits
                DLL.Add(NewDLL)
            End If
Title: Re: triplc
Post by: xpsarin on December 12, 2014, 09:43:09 PM
http://gyazo.com/5cb4642b7f46da173284a56fd15f5f3b

did i do that right?
Title: Re: triplc
Post by: Archie on December 12, 2014, 09:47:42 PM
Yes, now continue to press F10 to see if it executes the code or steps over that block of code. It should go all the way down to the DLL.Add(NewDLL)

Then after F10 a couple more times, it should go to the code :
If EventHandlerDLLInstance >0 Then
Title: Re: triplc
Post by: xpsarin on December 12, 2014, 09:48:36 PM
yes it does that
Title: Re: triplc
Post by: Archie on December 12, 2014, 09:54:59 PM
So now go to line 258 and put a breakpoint to see if it steps through this code. You can remove the other breakpoints by clicking them again.

            If e.RawData Is Nothing OrElse e.RawData.Length < 4 Then
                Exit Sub
            End If

            Dim RTU As New ModbusRTUFrame(New List(Of Byte)(e.RawData).ToArray, e.RawData.Length)

            ProcessDataReceived(RTU.PDU, e)
Title: Re: triplc
Post by: xpsarin on December 12, 2014, 10:00:08 PM
nothing happens when i click F10 from there?
Title: Re: triplc
Post by: Archie on December 12, 2014, 10:00:42 PM
Are you using 64 bit or 32 bit operating system? We may find out more things by using a serial port monitor.
Title: Re: triplc
Post by: Archie on December 12, 2014, 10:01:24 PM
nothing happens when i click F10 from there?
Does it stop at the break point at line 258?
Title: Re: triplc
Post by: xpsarin on December 12, 2014, 10:04:17 PM
64-bit yes it stops there, i cant jump with f10 from there
Title: Re: triplc
Post by: Archie on December 12, 2014, 10:07:46 PM
If you can download and install the trial version of this software and monitor the serial port you are using, we can see if the request packets are being sent to the PLC and if the reponses come back.

http://www.hhdsoftware.com/serial-monitor

Title: Re: triplc
Post by: Archie on December 12, 2014, 10:09:09 PM
i cant jump with f10 from there
Does anything happen if you press F10 after it stops at the breakpoint? What about F11?
Title: Re: triplc
Post by: xpsarin on December 12, 2014, 10:12:59 PM
F11 worked
Title: Re: triplc
Post by: xpsarin on December 12, 2014, 10:15:36 PM
I downloaded that software to monitor serial
Title: Re: triplc
Post by: Archie on December 12, 2014, 10:27:06 PM
Once you get that software installed, start a new session and set it up for a Request/Response view. Then start up AdvancedHMI and see if it shows packets going out the serial port. If it does, send me a screen shot of the packets.
Title: Re: triplc
Post by: xpsarin on December 12, 2014, 10:33:03 PM
when i move program to plc i see stuff change on the monitor but nothing on visual studio
Title: Re: triplc
Post by: Archie on December 12, 2014, 10:36:14 PM
When you said F11 was working, were you able to step down to the ProcessReceivedData()?

You should be able to step into the subroutine
Title: Re: triplc
Post by: xpsarin on December 12, 2014, 10:42:57 PM
yes but now its not working, when i go in debug i see advancedhmi in serial monitor
Title: Re: triplc
Post by: Archie on December 12, 2014, 10:44:13 PM
Did you get some packet captures in serial monitor from AdvancedHMI running? If so, can you send a screen shot of them?
Title: Re: triplc
Post by: xpsarin on December 12, 2014, 10:46:30 PM
http://gyazo.com/5bd1f27afc9c7b89ea27847f61cf7d87
Title: Re: triplc
Post by: Archie on December 12, 2014, 10:48:44 PM
Now select one of the packets so it shows the byte values in the packet
Title: Re: triplc
Post by: xpsarin on December 12, 2014, 10:52:00 PM
it dosent show anything
Title: Re: triplc
Post by: xpsarin on December 12, 2014, 11:00:29 PM
do you want to try with teamviewer?
Title: Re: triplc
Post by: Archie on December 12, 2014, 11:01:14 PM
I don't remember right off, but somehow you can get it to show the byte values that are sent and received. If you can't get that to work, we can go back to stepping through the code.

Open ModbusBase.vb and put a breakpoint at line 664, then run the application, When it stop at the break point, step through with F10 or F11 to see if it goes to line 655:
            If PDU.ExceptionCode = 0 Then
Title: Re: triplc
Post by: Archie on December 12, 2014, 11:01:56 PM
do you want to try with teamviewer?
That would work if we can do that. I will be able to quickly step through the code to find the problem.

You can email me directly at the support at adancedhmi.com email address
Title: Re: triplc
Post by: xpsarin on December 12, 2014, 11:07:05 PM
can you link me to that, i cant find it?