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 ... 5 6 [7]
91
Support Questions / ModbusRTU Serial: reading multiple values
« on: December 10, 2014, 08:01:22 PM »
Ultimately in the application I am working on, I want to read and write to various addresses, but don't need to poll the ModbusRTU device.  So I have tried some of the following code.

'****   This works to read one register ****

        Dim strValue1 As String
        Dim n_strMessage As String

        Try
            strValue1 = ModbusRTUCom1.Read("42817", 1)(0)
            lblReadResult.Text = strValue1

        Catch ex As Exception
            n_strMessage = "Function frmModbusRTUtest: failed with error: " & vbCrLf & ex.Message
            Call ShowMessageBox(clsDisplayMessage.enumDisplayMessageType.Critical, n_strMessage)
        End Try


'****   This code fails to read the multiple registers and generates an exception "No Reponse from PLC. Ensure baud rate is correct."    ****

        Dim strDate As String
        Dim strTime As String
        Dim strValue1 As String
        Dim strValue2 As String
        Dim strValue3 As String
        Dim strValue4 As String
        Dim strValue5 As String
        Dim strValue6 As String
        Dim n_strMessage As String


        Try
            strValue1 = ModbusRTUCom1.Read("42817", 1)(0)
            strValue2 = ModbusRTUCom1.Read("42818", 1)(0)
            strValue3 = ModbusRTUCom1.Read("42819", 1)(0)
            strValue4 = ModbusRTUCom1.Read("42820", 1)(0)
            strValue5 = ModbusRTUCom1.Read("42821", 1)(0)
            strValue6 = ModbusRTUCom1.Read("42822", 1)(0)

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


        Catch ex As Exception
            n_strMessage = "Function frmModbusRTUtest: failed with error: " & vbCrLf & ex.Message
            Call ShowMessageBox(clsDisplayMessage.enumDisplayMessageType.Critical, n_strMessage)
        End Try



It actually worked one time, but has generated the exception all the other times.
Any suggestions???

92
Support Questions / Re: Looking for Example code for using ModbusRTU serial
« on: December 10, 2014, 07:52:48 PM »
In this particular application the baud rate must be 9600 for the modbusRTU device.  I would be happy with a polling rate of 2 times per second.  I did try to change the PollRateOverride from 0 to some different values, but it didn't seem to have any effect.  I will work with it again tomorrow.
Thanks

93
Support Questions / Re: Looking for Example code for using ModbusRTU serial
« on: December 10, 2014, 06:04:10 PM »
Thanks for quick response , it was very easy to set up and worked first try.

I placed a digitalpanelmeter on the form and it read the address, looked like it was polling at about 4 times a second.  However when a placed 5 digitalpanelmeters on the form with 5 different addresses, the update rate became erratic, typically about  3 seconds per update.   So what should I be doing to help the performance?
 

94
Support Questions / Looking for Example code for using ModbusRTU serial
« on: December 09, 2014, 06:24:22 PM »
I have used the AdvancedHMI for one application and now I have another the needs ModbusRTU serial communications.  I will be interfacing through a USB/serial to RS-485 converter.  HMI will be a Windows 7 64bit machine.   Is there any sample code or setup documentation to guide me through this?

Thanks in advance!

95
Thanks, will give it a try.

96
Can you develop an AdvancedHMI application on a Windows7 PC and deploy it on an XP machine?

thanks
Scott

Pages: 1 ... 5 6 [7]