From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview + modbus rtu + usb-rs485 module

Solved!
Go to solution

Hi everyone, I am trying to comunicate with a VFD (D700 mitsubishi) by modbus rtu protocol using labview 2020.

I have already done some examples like these : https://www.youtube.com/watch?v=m1TB9twXYaA&t=442s 
but it didn't work. I thought it was that I need to wait a time to receive the answer from the VFD, so I tried with a VI library called 'KELLER' but It didn't work, I think that keller is no compatible with labview 2020.

 

I already set the VFD with the parameters to be have to communicate by modbus protocol.

I read some posts on the community but I couldn't get a solution.

 

Here I added two examples of what I am trying to do.

 

Any help or suggestion is welcome

0 Kudos
Message 1 of 11
(5,627 Views)

Your attachments are missing.

0 Kudos
Message 2 of 11
(5,607 Views)

Sorry, here they are!

Download All
0 Kudos
Message 3 of 11
(5,591 Views)
Solution
Accepted by topic author navarro08

Hi,

 

Couple of reasons why it is not working:

  • Unit ID is 17 . This is the ModBus slave address. Normally 1 is used.
  • Sure the start address (1003) is correct. For some devices reading registers is defines as 41003. That is address 1002,.
  • Some manufacturers reverse the RS-485 lines naming. In my world it is D+ and D- or A and B. I also see that D(B)+ and D(A)-    Try to reverse te RS-485 lines just to be sure.

Kees

0 Kudos
Message 4 of 11
(5,580 Views)

And in my experience, the most notorious problem is hex / decimal representation of numbers.

Register Adresses are usually, (but not always!!!) given in hex, and controls and constants are shown in decimal by default in LV.

So, first try: Change representation of controls/constants to hex, and try again.

 

Anyway: I also recommend to try an other modbus tool. Maybe, the supplier has a specific tool for this device, but since Modbus is a standard, there are 3rd party tools available. I've used "CAS Modbus Scanner" a while ago.

0 Kudos
Message 5 of 11
(5,570 Views)

 

When I stop it using the control of the while loop...I get this error

 

navarro08_0-1611179138995.png

 

 

Thank you

0 Kudos
Message 6 of 11
(5,555 Views)

Put an error indicator on the error wire inside the while loop.

Get rid of the shift registers on that error wire.

 

Error 56 is a timeout error.  Basically the device didn't respond in time.  But what is strange is that you created a serial master, and I associate an error of 56 with TCP/IP communications.

 

Something else weird I see.  When I hover over the Create Serial Master, I see an extra input on the left called Device Data Model.  A cluster with a single boolean of Initialized.  I've never seen that before.  I clicked on the polymorphic selector and see it is set for Automatic.  Go down and explicitly select New Serial Master.  The extra input goes away.

 

Try running it again.

 

And look into Kees's comment about the slave address and verify that 17 is actually what your device is set for.

0 Kudos
Message 7 of 11
(5,550 Views)

Yeah, ID = 1 is normally set, but I was trying the same example that the manual has, just to verify that the values are the same!

I change the pins on my usb-rs485 module and it worked!!!! It seems that was the problem, but I don't get why if in the 2 wire echo connection rec+ and send+  are connected to the A+   , and rec- send- to B-   .

 

But well boys, it is working! Thank you so much for your help!

0 Kudos
Message 8 of 11
(5,544 Views)

'A two wire Echo connection' ??

 

With a RS-232 interface has a transmit and a receive. It is obvious that the transmit cannot be connected to the transmit. A Cross cable is used.

 

With RS-485 a differential line is used. Both sides (there can be more than two) are bi-directional. A differential line is the same for each connected device. SO the + is connected to the + and the - to the -

Because of this used differential line the maximum distance is higher than the distance wit a RS-232 interface.

 

If you use long lines (> 10-100 meter, also depends on the speed) you also should use proper terminate resistors and the 0V connection.

 

Kees 

0 Kudos
Message 9 of 11
(5,504 Views)

@K C wrote:

'A two wire Echo connection' ??

 

With a RS-232 interface has a transmit and a receive. It is obvious that the transmit cannot be connected to the transmit. A Cross cable is used.

 

With RS-485 a differential line is used. Both sides (there can be more than two) are bi-directional. A differential line is the same for each connected device. SO the + is connected to the + and the - to the -

Because of this used differential line the maximum distance is higher than the distance wit a RS-232 interface.

 

If you use long lines (> 10-100 meter, also depends on the speed) you also should use proper terminate resistors and the 0V connection.

 

Kees 


It is because he has a 2-wire connection.  The same wires are used for transmitting and receiving.  Only one device can talk at a time.  With 2-wire, the transmit and receive buffers in each device are wired together.  So if device starts talking on the wires, device B will receive it at both the transmit and receive pins.  Device A will also receive it at its receive pins.  So device A will wind up getting an echo of the message is just sent.

 

The RS-485 ports have means of ignoring the message back to itself, or doing some sort of tri-state on the transmit and/or receive pins so they don't have intefere with the communications.

 

If this was 4-wire RS-485, the transmit and receive pins on each end would be distinct and only connected to the transmit and receive buffers in each device's serial port.  They would not be tied together internally.  And of course transmit pins would connect to receive on the other device, and vice versa.  And of course polarity always matters.

 

It all comes down to reading the manual for the serial port to know how to wire it and setting any dips switches or jumpers, or software driver configuration settings, as needed to make it work.

 

0 Kudos
Message 10 of 11
(5,494 Views)