LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

No device response Labview MODBUS serial

Good afternoon,

I've been trying to manage a device with labview and a modbus serial connection. I've been using a simple VI to try and see if the answer from the slave would be correct, but every time I try to read a value i get 0 as a response. I don't know if the problem is in the way I programmed the test or maybe some other thing. I'll add the program I'm using, wich is the one called Prueba conexion. The other one is a subVI that i'm using to calculate the checksum of the string I'm sending. 

More specifically, I'm sending 0103 11A9 0001 5116, and I'm just receiving 0103 0200 00, wich means is reading 2 bytes but the informaation in them is 0. 

Thanks for any reply.

Download All
0 Kudos
Message 1 of 6
(1,779 Views)

@sanwinner wrote:

Good afternoon,

I've been trying to manage a device with labview and a modbus serial connection. I've been using a simple VI to try and see if the answer from the slave would be correct, but every time I try to read a value i get 0 as a response. I don't know if the problem is in the way I programmed the test or maybe some other thing. I'll add the program I'm using, wich is the one called Prueba conexion. The other one is a subVI that i'm using to calculate the checksum of the string I'm sending. 

 

 

More specifically, I'm sending 0103 11A9 0001 5116, and I'm just receiving 0103 0200 00, wich means is reading 2 bytes but the informaation in them is 0. 

Thanks for any reply.


If you are receiving 010302.... then that means the device has responded. Are you sure you are reading the right registers? 

 

It looks like you are using the Modbus library incorrectly. The library does it's own checksum internally and you don't need to worry about it. It will return an error if they don't match. The return data is simply the data the device is returning from the registers. So the data coming out of the "read holding registers" will just be the data, not the full Modbus return message.

0 Kudos
Message 2 of 6
(1,742 Views)

Thank you for your answer,

The directions of the registers are correct, so I don't think that's it. Also, in my program the first 010302 are "forced" to appear in the return string, so I'm not sure if the device has responded correctly. 

I'm not sure I understand the last part of your message, does that mean that when i input 0103 11A9 0001 5116, being 11A9 the direction to read the Temperature of the furnace that I'm trying to control, the data coming out of the read holding registers would be that temperature?

Thanks again for your answer

0 Kudos
Message 3 of 6
(1,740 Views)

The vi you uploaded seems to try and mash together using the NI Modbus library and your own implementation of Modbus. You can probably save some headache by just using the Modbus library. Set the starting register and the number of registers you want to read and the library will either return the data or an error. Your code also shows you are using RTU mode so the data will not be human readable (perfectly ok to receive null or non-displayable characters) If the registers are holding a string you can type cast to a string to convert it, but that's a bit odd and I have not seen that very often. Usually the registers will hold a numerical value and depending on the type and size you may need to do some conversion on the data to display it correctly.

 

Can you clarify what data you are trying to read and from how many registers?

0 Kudos
Message 4 of 6
(1,732 Views)

Thanks you for your answer.

After doing some changes to the program, I'm now able to receive something in return on the read holding register, but im not sure if what I'm getting is correct or what conversion do i need to do to display it correctly.

To answer your question, right now I'm trying to control a furnace, and I'm trying to read the temperature of that furnace wich is in a register. When i send the order to read that register, im receiving a number wich value changes a lot (if a send the same order to read the temperature more than one time). I think this is because the temperature is hold as a float number in the register, but it's coming out as a U16 with the modbus library, and i can't seem to be able to change it properly. 

Do you think this may be the cause? Do you know how to convert this number to display it correctly?

Thanks again for your answer and sorry if I didn't explain something clearly.

0 Kudos
Message 5 of 6
(1,684 Views)

You need to read the manual which should tell you how the data is written in that register.  Often, if it is a floating point, it will be single precision float and is split across two 16-bit registers which you need to read and typecast to a single precision float.  Or it might be an integer that you might need to multiply be a scale factor, or you might need to rescale it from 0 to 65535 to some engineering range of values (such as 0- 2000 deg F).

 

Read the manual.

Message 6 of 6
(1,681 Views)