LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Modbus reading RS232/USB

Hello,
I am using a RS232/USB converter to read some data from pCO5+ Carel which is using in a chiller.
Hereby I attached the picture of VI.

I have a problem for reading the holding registers, as you can see after some minutes the value of some addresses go to zero without any error.
I increased the timeout from 5 sec to 8 sec and I have also increased the waiting time of the while loop from 1 sec to 2 sec but the problem remains.
I looked at the same topics but I could not find a solution.
I have also change the wire/ cable (it is not too long). I have used another converter (RS485/USB) but the problem remains.
there is not any certain interval of time for this kind of problem which read 0.

could anybody help me with this issue?

 

 

Download All
0 Kudos
Message 1 of 7
(933 Views)

You'll need to do some more debugging in order to figure out why you are getting zeroes.  Put an indicator on the error to see what if any kinds of errors you are getting on the Modbus functions.  Although I see you do have probes on those wires, and you did say the values go to zero without any error.  But I don't know any reason why you'd get default data and not show an error.

 

Some other advice:

1.  The Modbus Init belongs before the loop not inside.  Why would you want to initialized a connection on every iteration of the while loop.

2.  Index Array is resizable.  Take one of those and drag the bottom border downwards to get more outputs.  Wire up the index constants.  Delete the rest.

3.  You are putting data on the end of your array.  You should be using Build Array with concatenate to do that.  Insert into Array is rarely needed and only if you wanted to put data in the middle of an array.

Message 2 of 7
(886 Views)

Thank you for your reply and advice.
Actually I am confused and I can not understand the reason of this problem.
Anyway thank you so much.

0 Kudos
Message 3 of 7
(882 Views)

At least do #1 and fix the Modbus Init.

And put indicators on the error wires.  You could also put conditional probes on there so that they pause the code upon error.

 

You've got to be getting errors somehow.

Message 4 of 7
(878 Views)

I did both , also before posting my problem. 
Init was out of the loop and I have activated the pause on the warning or error, but the loop does not stop and gives always "no error" message.

😞

0 Kudos
Message 5 of 7
(873 Views)

I have no idea how those function would be returning default data without having some sort of communication error that would show up on the error wire.  Not unless the device is actually returning zero data instead of real data.  Then that is a problem in the device.

 

What you could do is put the display code in case structure so that data is only displayed if the data is non-zero.  (Of course that causes a problem if you ever get real zeroes in your data.)

 

You could try opening the modbus VI's and probe them to see how they work and where the data might be falling apart.  But you can only get so far on those before you run into password protected VI's.  Another older modbus library I use is here.  https://www.ni.com/example/29756/en/  These are fully open subVI's.  I think you can also find in through JKI's VI Package Manager.

Message 6 of 7
(869 Views)

thank you again.
your suggestion works for my case since the reading is humidity and pressure and these value will never go to zero during my test.
I will try to do so.
I really appreciate your attention and help.

 

0 Kudos
Message 7 of 7
(851 Views)