Free Alarm Logging Software?

Just looking back at this code
Code:
For i = 1 To 500
SubscriptionID(i) = ModbusTCPCom1.Subscribe("4000" & CStr(i), 1, 100, AddressOf ModbusTCPCom1_DataReceived)
Next

I had CStr(i), 1, 100, ......

I've changed to CStr(i), 1, 500, and seem to be able to read more data.

Is this correct?

I'm imagining this is telling the subscription to cycle between 40001 and 40500??
The 100 that you changed is actually an unused parameter. It used to allow you to update values at different rates, but that functionality was removed long ago in favor of another method.

Out of curiosity try changing MaxReadGroupSize property of the driver to 30 and see if that has any effect.
 
Dammit! Thought I had it sussed!

So, where am I at?

OK, in the temp AdHMI set up with BasicLabels works fine at reading more data.

Back to my project. As proof, I put BasicLabels into this.

I set up 5. reading addresses:
40168
40169
40171
40172
40173

40172 & 40173 have "com error - no values returned from driver"

Yet the same addresses on the temp AdHMI does read ok.

So: I commented out this section of code
Code:
For i = 1 To 500
SubscriptionID(i) = ModbusTCPCom1.Subscribe("4000" & CStr(i), 1, 100, AddressOf ModbusTCPCom1_DataReceived)
Next

and now those basiclabels all read data.

Further playing with this section; I found that reducing "4000" to "40" also allows those basiclables to read data. But the rest of the program doesn't execute then (no messages when the data changes anymore)

For now.... I'm completely stumped and its 3am here in UK! I'm done for the night!

Archie, I really appreciate your help. Can you can shed any light onto this at all?
 
The 100 that you changed is actually an unused parameter. It used to allow you to update values at different rates, but that functionality was removed long ago in favor of another method.

Out of curiosity try changing MaxReadGroupSize property of the driver to 30 and see if that has any effect.

I don't know what I did earlier (losing track now) but I had it up to 43 and got a little more data from it.

Now, any more or less than 20 makes less data come through! :cry:
 
I did a quick test with a Modbus simulator and everything is working on my end. I did modify the subscribing code a little:
Code:
        Try
            For i = 1 To 500
                SubScriptionID(i) = ModbusTCPCom1.Subscribe("4" & CStr(i).PadLeft(4, "0"c), 1, 100, AddressOf ModbusTCPCom1_DataReceived)
            Next
        Catch ex As Exception
            Dim dbg = 0
        End Try

I then used this in the DataReceived event so I could see that data from the higher registers were being returned:

Code:
   Private Sub ModbusTCPCom1_DataReceived(sender As Object, e As Drivers.Common.PlcComEventArgs)
        Dim index As Integer = CInt(e.PlcAddress.Substring(1))
        If index > 450 Then Me.Text = e.PlcAddress & "=" & e.Values(0)
    End Sub

I then tried MaxReadGroupSize of 20 and 100. Both results were the same.
 
I did a quick test with a Modbus simulator and everything is working on my end. I did modify the subscribing code a little:
Code:
        Try
            For i = 1 To 500
                SubScriptionID(i) = ModbusTCPCom1.Subscribe("4" & CStr(i).PadLeft(4, "0"c), 1, 100, AddressOf ModbusTCPCom1_DataReceived)
            Next
        Catch ex As Exception
            Dim dbg = 0
        End Try

I then used this in the DataReceived event so I could see that data from the higher registers were being returned:

Code:
   Private Sub ModbusTCPCom1_DataReceived(sender As Object, e As Drivers.Common.PlcComEventArgs)
        Dim index As Integer = CInt(e.PlcAddress.Substring(1))
        If index > 450 Then Me.Text = e.PlcAddress & "=" & e.Values(0)
    End Sub

I then tried MaxReadGroupSize of 20 and 100. Both results were the same.

Hey Archie...

I tried the modified code above but was still getting the same results.

I could read up to a certain index. Had the BasicLabels active to see where I could get up to. This time it was 152.

Again, commenting out the whole Try, For i = 1 to 500 section allowed the addresses above 40152 to be read.

Much faffing around and trying alsorts, but decided to focus on that section. I noticed if I reduced For i = 1 to 500 to For i = 1 to 100 then the BasicLabels for the addresses above 152 worked again.

I played around with the i = 1 to XXXX value until I found where it caused an error. At value 169 it was OK, at 170 it caused issues.

At 169, I was able to read my last bit of my datablock as required. And funny enough, my data block is 169 words long!

I'd like to try extending my data block and then extending the For i = 1 to XXX to match the DB length (in words) and see how that behaves. But for now, I need to progress with the project and get it on a trial run before I go away on holidays! Then I can have some data on my return to analize! :p

Can't thank you enough for your help with this Archie! 🍺 I'll buy you a beer!
 

Similar Topics

Hi everyone, I'm in search of software for electrical drawings, preferably free but also interested in paid options. Any recommendations or...
Replies
33
Views
1,674
Hello, S7-200 is installed with dot matrix printer. its printer is not working. now I have changed the printer. Problem in new printer is that...
Replies
0
Views
218
We are to develop a first application in Codesys. It will contain motion (Softmotion) with drives on Ethercat (CSP mode). Off course there will be...
Replies
2
Views
939
Just started working with some HART loops and I'm trying out Pactware.I'm using Krohne and it works just fine recognizing my modem. I downloaded...
Replies
9
Views
1,453
Hi, There's a problem I face with upgrading the OS from XP which has the Step 7 Lite installed to windows 10. As I can't use a cracked version of...
Replies
2
Views
639
Back
Top Bottom