Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

MODBUS RTU multiple write & read ( NI VISA )

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

 

and then i tried this and this not working too

 

 

Error SFIM 2.jpg

 

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

 

Thanks~

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

Hi rhiesnand,

 

To check if you are getting errors, you can wire error indicators to the error wires. This will allow you to see if there are any errors being generated in the VISA Read/Write VIs.

 

Is the CVM device working as you expect? Are the CVM read buffer, substring, byte count and voltmeter values correct?

 

It may be that there the full frame is not available yet when you are doing the VISA Read because you are using the Bytes at Port property rather than specifying a fixed number of bytes to read. If you use constants for the bytes to read, do the read buffers show what you expect?

 

Also, you could try using the Modbus API rather than VISA commands to do the modbus communication. This API can be downloaded here:

https://decibel.ni.com/content/docs/DOC-30140

 

Catherine B.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 6
(7,454 Views)

Hi Catherine,

 

i think no, you can see that i request  0A04 0000 0002 70B0 but the answer is incorrect, the number of byte doesnt match. you can see this video :

https://drive.google.com/file/d/0B_94Z4CwsTYeajlnaTF0bzF0TVk/edit?usp=sharing

 

yeah right, i tried modbus library, i think with this method is more simple : 

CVM + SFIM.jpg

 

but on that VI just read first register, how to read 10 register on CVM ? it just 1 register that could be show.

 

MANUAL MODBUS.jpg

according on that manual of CVM if i request 10 register from 00 (starting address) that should be response Volt, Ampere, Watt, VarL,PF.

any suggestion ?

 

Thanks~

 

0 Kudos
Message 3 of 6
(7,413 Views)

Hi rhiesnand,

 

Can you clarify the behavior you were seeing when using the NI Modbus Library? Was it successfully reading the first register specified, but not all 10? The output of the Read Input Registers VI is an array of values, so you may need to extract the elements or index through the array to access all of the register values.

 

Also, there are a couple of different Modbus libraries. The newer, more robust library (LabVIEW Modbus API) can be downloaded at:

https://decibel.ni.com/content/docs/DOC-30140

 

There is a discussion board specifically for questions about the LabVIEW Modbus API:

https://decibel.ni.com/content/thread/17712?tstart=0

Catherine B.
Applications Engineer
National Instruments
0 Kudos
Message 4 of 6
(7,381 Views)

 

Hi Catherine,

 

yes, it only read first register, not all 10. sorry, could you show me with screenshot how to extract that element ? i still didnt get it.

 

i already download it.

0 Kudos
Message 5 of 6
(7,316 Views)

Hi rrhiesnand,

 

As you can see in the picture below, the outputs of the Read Input Registers VIs are 1D arrays of values. You can use a for loop and auto-indexing to index through the array of register values. If you are reading 10 register values, you will likely want to add more indicators so you can display all of the values you are reading.

 

for loop with autoindexing.png

 

More information about auto-indexing can be found in the LabVIEW Help:

http://zone.ni.com/reference/en-XX/help/371361K-01/lvhowto/auto_indexing_1/

Catherine B.
Applications Engineer
National Instruments
0 Kudos
Message 6 of 6
(7,302 Views)