Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

modbus gurus please read

Solved!
Go to solution

I have a Modbus instrument (VP Flowscope) that I am trying to interface to and I've never worked on Modbus before.  I wanted to see if anyone here had some advice for getting this working quickly.

 

I've written code using the NI DSC toolkit, the code on the NI-Lab (which is pretty much the same as the NI DSC), and another download that can be found here:

 

http://www.ni.com/example/29756/en/

 

All of them fail with my setup, although I think I can see a response from the slave device.  

 

Attached are a couple snapshots of my code and a screenshot of what I see on the oscilloscope.  On the oscilloscope plot, I believe the second transaction is a response from the slave because if I change any settings (address, parity, etc) then I don't see this transaction.

0 Kudos
Message 1 of 5
(3,728 Views)

So, I downloaded a few tools I found and got some data back (see image).

 

Looks like my slave device is sending extra bytes before and after the transmission (or the timing is incorrect).  If I strip off these bytes, the data is fine.

 

So, my question is, does anyone know how to send the request and then parse the response separately.  The way this is implemented in the Labview DSC VIs, it doesn't seem like I can get at that level of control (the read/write VI executes and can't be opened/edited).

 

I will be looking at the code from the link I provided in more detail to see if it can be modified to allow me access to the low level bytes.  If all I need to do is strip off a couple received bytes, I wish I could do that with the MODBUS package. 

 

 

0 Kudos
Message 2 of 5
(3,715 Views)

Hi,

 

What kind of interface (hardware) are you using ?

I have seen this before with one of my USB-serial devices. But only with leading zero's

 

Kees

0 Kudos
Message 3 of 5
(3,691 Views)

I am using a FTDI USB to RS485 Converter (USB-RS485-WE-5000-BT).

 

I got this working last evening with the MODBUS 1.2.1 library.  Was able to dive down and throw away the data that was messing this up.  It still is intermittent though.  Sometimes I get garbage data and extra bytes even though the response looks pretty much the same on the oscilloscope (a bit of jitter).  

0 Kudos
Message 4 of 5
(3,672 Views)
Solution
Accepted by topic author thad_tensentric

I got this working with the MODBUS 1.2.1 library, where one can dive down into the code and see the sent/received bytes.

 

Once I saw that my sent bytes were the same as what I saw in the other programs, after a bit of work to clear some false errors (reading of 00 only from VISA read is IO exception error) I was able to then see that the received bytes were the same as well.

 

 

0 Kudos
Message 5 of 5
(3,671 Views)