LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

MODBUS RTU multiple request & response ( NI VISA )

Solved!
Go to solution

hi 

i wanna ask how to multiple request and response on MODBUS RTU using VISA ? i tried to monitoring 2 device digital metering, i made a Labview program to communicate that device alternately using Stacked Sequence Structure, but it only can communicate with 1 device, and the response i think there are some error, the number of byte doesnt match what i request ( 0A04 0000 0002 70B0 ) 

this is my screenshot

Error SFIM.jpg

 

any suggestion ? or maybe use other way to multiple request and response use NI VISA ?

 

Thanks~

0 Kudos
Message 1 of 12
(5,320 Views)

Before trying to work with two devices.  Start with trying to get one to work.

 

Nothing jumps out at me at first glance of your VI.  But I would recommend using the Modbus Library instead.

0 Kudos
Message 2 of 12
(5,281 Views)

i did it if just one device and can work correctly,  this is my screenshot on 1 device

 

PERFECT Modbus CVM NRG.jpg

 

i wanna try using VISA firstly ( basic serial communication ), next i`ll try modbus library

any suggestion ? am i right using Stacked Sequence Structure ?

 

Thanks~

 

0 Kudos
Message 3 of 12
(5,258 Views)
0 Kudos
Message 4 of 12
(5,255 Views)
Solution
Accepted by topic author rhiesnand

It was pretty tough to see that video.

 

Obviously in the 2nd frame, the lower comparison was coming out True which meant the False case where stuff happened couldn't execute.  (Seems like reverse logic to me.)

 

Well you check the first two bytes to see if they were not equal to 010A.  Well they were because that is the response to the command you send taht started out 010A.

 

In the first frame it worked because you send out the command starting 0A04, and compare to see it is not equal to 0404, which of course it is not.  What is the point of this?  It seems like mixed up logic.  That you want to confirm it is the correct slave address and correct command (thus they would be equal) in order to execute the decoding code.

 

The other comparison is pointless also because you are trying to see if the first two bytes are equal to 0A, (no matter which frame you are in) which they will never be because a 2 byte string can never equal a 1-byte string.

 

By using highlight execution, you should have been able to figure out what was and wasn't executing and why.

 

Also, you only need one VISA close since you are only opening up one VISA resource.

 

Really, you'd be better off using the Modbus library.

 

Here is a much cleaner version of your code using the Modbus library.

 

 

0 Kudos
Message 5 of 12
(5,242 Views)

Buenas noches es que quiero desarrollar una apliacion para mostrar una animacion de una cara que tenga gestos controlables

0 Kudos
Message 6 of 12
(5,236 Views)

@jorge6904 wrote:

Buenas noches es que quiero desarrollar una apliacion para mostrar una animacion de una cara que tenga gestos controlables


Google:

Good night is that I want to develop an app to show an animation of a face that has controllable gestures

 

So post in English in a new message thread.

Or a new message in the Spanish forum. 

Discusiones sobre Productos NI

 

Your question has nothing to do with the thread you posted into.

0 Kudos
Message 7 of 12
(5,225 Views)

Hi Raven,

 

i need that to compare, because this digital metering if on Serial Communication using VISA cannot work perfect, see this video, this video when i didnt use comparison.

https://www.dropbox.com/s/st6qs1cbtr72m0m/bandicam%202014-05-05%2015-06-09-546.avi

so on that video i need to compare to distinguish when the data will be processed.

this video when i did with comparsion, work correctly without miss data 

https://www.dropbox.com/s/illmc235nn8kv3z/bandicam%202014-05-21%2016-12-36-500.avi

 

yeah i just realized, compare 0A is useless Smiley Very Happy 

 

Thank you, its work 

CVM SFIM.jpg

 

could you explain me what the function that i circled ? i didnt get it ( Still Newbie on Labview Smiley Embarassed )

 

and on SFIM metering i think on that device need IEEE 754, and i still studying about IEEE 754

 

Thanks~

 

 

0 Kudos
Message 8 of 12
(5,209 Views)

I didn't wire a constant that was a 32 in my snippet (you can drag and drop that to your block diagram so you don't need to recreate.)  Mine was a zero, but it acutally doesn't matter what the constant's value is.

 

What is important is that the constant has the representation of a U32 integer.  It defines what type of wire to convert the incoming array of U16's to a U32.

 

One possibility is that the data coming in is in the wrong endian order.  Which of the two U16's is the most significant and which is the least.  You may want to get rid of the typecast and use an Index Array function into two U16 scalar elements.  Then use Join Numbers to combine them into a single U32.  Which ever is the most significant U16 word will go into the top.

 

You can also do what I showed, but use the Swap Words function right after the typecast to fix the endianness of the numbers.

 

All of these functions, typecast, join numbers, swap words, are on the Numeric >> Data Manipulation palette.

Message 9 of 12
(5,195 Views)

OK, maybe i need to learn more about this Labview, anyway thank you so much Ravens for your help !!! if i have question i`ll ask you again Smiley Very Happy

 

Thanks~

0 Kudos
Message 10 of 12
(5,149 Views)