Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - scott.clark

Pages: 1 ... 4 5 [6] 7
76
Using v3.83 and Visual Studio 2013.

How can I gracefully handle loss of ethernet communications with my plc?  When I unplug the ethernet cable, I got this unhandled exception. 

An unhandled exception of type 'System.NullReferenceException' occurred in AdvancedHMIDrivers.dll
Additional information: Object reference not set to an instance of an object.

Ideally, I would like to display a message that communications to the plc have been lost and then clear the message when communications have been reestablished.

Thanks

77
Support Questions / Re: ModbusRTU Serial: writing multiple values
« on: December 30, 2014, 07:32:50 AM »
Would a single value character string array also result in a function code 10h packet?  If it does, then it would be useful to me.  Thanks!

        Dim Values() As String = {"1"}
        ModbusRTUCom1.Write("40001", Values)

78
Support Questions / Re: ModbusRTU Serial: writing multiple values
« on: December 29, 2014, 06:18:44 PM »
Hope you all had a good Christmas.  I am still working with this write procedure.

Unfortunately my ModbusRTU device does not support the 0x06(06) function code for writing.

Here is some code I tried and the results

     strAddress="44097"
     strValue1(0) = "1"
     ModbusRTUCom1.Write(strAddress, strValue1(0))

The data sent to the modbus device by the above code: 01 06 10 00 00 01 4C CA



What I need to be sent is:  01 10 10 00 00 01 02 00 01 76 51



I also tried sending a two register array two registers of data, "44097 - 44098"

     Dim strAddress As String = "44097"
     Dim strWriteValues2(1) As String
     Dim modbusAddress As New MfgControl.AdvancedHMI.Drivers.Modbus.ModbusAddress(strAddress)

     strWriteValues2(0) = "1"
     strWriteValues2(1) = "0"
     ModbusRTUCom1.Write(modbusAddress, strWriteValues2)                             

What was sent was: 01 06 10 00 00 01 00 00 B4 97


Any more suggestions that would result in a function 0x10 write code?

Thanks!

79
Support Questions / Re: decoding ModbusRTU serial read result
« on: December 24, 2014, 08:39:48 AM »
So to clarify, the modbusRTU read returns one word(16 bits) for each register.  So -256 would represent 1111 1111 0000 0000

80
Support Questions / ModbusRTU Serial: writing multiple values
« on: December 23, 2014, 07:00:30 PM »
What is the syntax for writing multiple values with ModbusRTU Serial?  My ModbusRTU device only supports writing to holding registers with the 0x10(16) function code.


81
Support Questions / Re: ModbusRTU Serial: reading multiple values
« on: December 23, 2014, 06:57:00 PM »
This issue was that there is a 5 element limit to reading and writing on my ModbusRTU device.  Got to read the fine print......


82
Support Questions / decoding ModbusRTU serial read result
« on: December 23, 2014, 06:05:54 PM »
So I am reading a group of bits as a word:

strValue1 = ModbusRTUCom1.Read("41281")
lblReadResult.Text = strValue1

The result displayed lblReadResult.Text is "-256"

So what is the binary value of the register "41281"?  It thought it was a signed integer, but I am not sure.
   


83
Support Questions / Re: ModbusRTU Serial extended register addresses
« on: December 23, 2014, 05:55:11 PM »
Thanks! Works like a charm:)

84
Support Questions / ModbusRTU Serial extended register addresses
« on: December 23, 2014, 11:43:45 AM »
The modbusRTU device I am working with has some registers in extended address range that I would like to access.

0x6000 to 0x615D
0x7000 to 0x71A8

Does the AdvancedHMIDrivers ModbusRTUCom have a way to access this register address range?

Thanks!

85
Support Questions / Re: ModbusRTU Serial: reading multiple values
« on: December 17, 2014, 08:47:38 AM »
Thanks for the feedback.  I think the issue is some limitiation with my ModbusRtU device.

86
The MultiStateSelector SelectedStateBackColor by default is Maroon.  I have tried to select several other colors but get the message "Property Value is not valid"  Details: Value of '357' is not valid for 'green'. 'green' should be greater than or equal to 0 and less than or equal to 255.

How do I change the color?


87
Support Questions / Re: ModbusRTU Serial: reading multiple values
« on: December 16, 2014, 03:02:34 PM »
I am now using v3.93

I found out there is a 5 element register limit in reading and writing to my modbusRTU device.  I changed the code as follows:

            strValue1 = ModbusRTUCom1.Read("42817")
            strValue2 = ModbusRTUCom1.Read("42818")
            strValue3 = ModbusRTUCom1.Read("42819")
            strValue4 = ModbusRTUCom1.Read("42820")
            strValue5 = ModbusRTUCom1.Read("42821")
         

            strDate = strValue5 & "-" & strValue4
            strTime = strValue3 & ":" & strValue2 & ":" & strValue1
            lblReadResult.Text = strDate & "  " & strTime


The first time the code executes, it returns and displays the data.  Polling at 3 second intervals, it may or may not return the data the 2nd time, but by the third time we get the exception "No Response from PLC. Ensure driver settings are correct."

I am guessing it is some type of timing issue with my ModbusRTU device. 

The protocol documentation for my ModbusRTU device states:
Physical layer            =    RS485
Baud Rate             =    9600 bps
Data Length             =    8 bit
Parity                =    None
Stop Bit             =    1
START/STOP             =    silent interval of 3 characters
MIN TIME BETWEEN TWO RETRY    =    500 msec



88
Support Questions / Re: Looking for Example code for using ModbusRTU serial
« on: December 16, 2014, 02:50:53 PM »
I tried my application now with version 3.93 and was still getting "Com Error-20.No response from PLC".  What I found is that the ModbusRTU device I am dealing with has a maximum 5 element limitation on reading and writing registers.  I now have have a form with 9 digitalpanelmeters, and as long as there are now more than 5 addresses in a continuous space, there are no errors.

This is my first ModbusRTU project.  What is typical limitation on number of elements that can be read or written in one packet?

 

89
Support Questions / Re: Looking for Example code for using ModbusRTU serial
« on: December 11, 2014, 04:43:07 PM »
I have been using version 3.83

Experimenting with 3.83 and 3.91, the results are similar

.
Version 3.83
If I have 3 digitalpanelmeters polling address, 42817, 42818 and 42819, the digitalpanelmeters update OK.  If I had 3 more with addresses 42820, 42821 and 42822, then I get a "Com Error-20.No response from PLC" on each of the panelmeters.  I can see the indicators showing that its polling about once a second(PollRateOverride=0)

Version 3.91
"Com Error 2. Illegal data address"

With the six digitalpanelmeters, when the form opens, all 6 update with data, then alternate showing that same data and "Com Error 2. Illegal data address" in the digitalpanelmeter label.

With three digitalpanelmeters, it works OK.

I am using Visual Studio Express 2013 on a 64bit windows machine.

90
Support Questions / Re: ModbusRTU Serial: reading multiple values
« on: December 11, 2014, 03:57:42 PM »
I started a new project using the 3.91 version. 

As before, this code still works:
 
Dim strValue1 As String
        Dim n_strMessage As String

        strValue1 = ModbusRTUCom1.Read("42817", 1)(0)   ' What does the (0) at the end of this line do???
        lblReadResult.Text = strValue1


This code works about 50% of the time and the other 50% returns an exception "No Reponse from PLC. Ensure baud rate is correct."

Dim strValue1 As String
Dim strValue2 As String

strValue1 = ModbusRTUCom1.Read("42817", 1)(0)
strValue2 = ModbusRTUCom1.Read("42818", 1)(0)
lblReadResult.Text = strValue2 & ":" & strValue1


Also tried this example for multiple values, the result was an exception "Illegal data address"

Dim values() As String
values = ModbusRTUCom1.Read("42817", 6)
lblReadResult.Text = values(0)


more suggestions?

Pages: 1 ... 4 5 [6] 7