LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

modbus

Hello everyone,

I have to use the Modbus protocol with LabView 8.0 to communicate with an actuator (the PC is the master and the slave actuator). I am using LabView 8.0 and Modbus library.

The frame has to send 15 bytes:
- Header in master / slave 1 byte
- The address of 4 bytes,
- Code based on a 09 byte (my first question is what corresponds to modbus function code?)
- And the data of 7 bytes,
- And finally the 2-byte CRC.

What function should I use to send and receive such a frame?
For the moment I decided to function as RTUs.

Thank you in advance for your help.

 

En français,

 

 Bonjour à tous,

Je dois utiliser le protocol modbus avec LabView 8.0 pour communiquer avec un actionneur (le Pc est le maitre et l'actionneur l'esclave). J'utilise LabView 8.0 et sa bibliothèque Modbus.

La trame à envoyer comporte 15 octets :
- en entête maître / esclave sur 1 octet,
- l'adresse sur 4 octets,
- le code fonction 09 sur un octet (ma première question est à quoi correspond se code fonction modbus? )
- et les données sur 7 octets,
- et pour finir le CRC sur 2 octets.

Quelle fonction dois-je utiliser pour envoyer et recevoir une telle trame ?
Pour le moment j'ai décidé de fonction en RTU.

Merci d'avance pour votre aide.
 

0 Kudos
Message 1 of 8
(2,999 Views)

Hello, 
 

 Here is my source code.

If you have any comments.

Thank you in advance.

Bonjour,

Toujours pas de réponse... Voici le ficihier de mon code source.

Si vous avez des commentaires.

Merci d'avance.

0 Kudos
Message 2 of 8
(2,963 Views)
Nobody to explain me what does'nt work???
0 Kudos
Message 3 of 8
(2,945 Views)

Are you sure that function code 9 is correct?  I don't know what that is, and I couldn't find it in the modbus specs at www.modbus.org.

 

 

Do you have a link to the instruction manual for the actuator?

0 Kudos
Message 4 of 8
(2,934 Views)

Hello,

 

1- Yes i'm sure this is the function code 09.

2- I have already  search this function code but never found it

3- The actuator i got is a new product developing, and the protocol specification is like  describe above

 

(0                         / 1-2-3-4               /5                          /6-7-8-9-10-11-12 / 13-14    )

 

( Master or slave / adress on 4 bytes  / function code :09 / Data                     /  CRC16  )

4- Have you seen my .vi code ?

 

Thanks in advance,

 

Laurent.

0 Kudos
Message 5 of 8
(2,927 Views)

I did look at your VI.  But I'm not looking into it so deeply because I just don't have the time or inclination to reengineer all the calculations that go into the CRC calculations and the like.

 

Is this actuator a device you are making?  Or something you bought?  Where is the documentation that talks about code 9.

 

I'd be really suspicious about anything using function code 9.  The modbus spec. says this is one of the functions codes that are specifically reserved.  (For what, I don't know.)

 

See page 51 of this document.  http://www.modbus.org/docs/Modbus_Application_Protocol_V1_1b.pdf

 

It may be that the code you are using is perfectly within spec. for Modbus, but the device you are trying to communicate with is violating the spec.

Message 6 of 8
(2,923 Views)

Thanks Ravens,

 

In fact, my actuator is not using Modbus !!! This is the MSDIAL protocol (Motor Sensor Dialog)...

 

I don't know why i can't communicate with this device ; maybe the conversion of the frame sends not good..

 

(I 'm sure the CRC calculate is good)

0 Kudos
Message 7 of 8
(2,897 Views)

Well, that changes everything! Smiley Wink

 

Do they have any sofware used to communicate with the actuator?  If so, you could use something like Portmon to snoop on the communication while there software is talking to it and see if you can learn anything from that.  Other things to check would be the basic serial port settings (baud rate, stop bits, parity), that you are using the right kind of cable (straight through, null modem, or some special proprietary cable), and that the actuator has any settings such as a slave address set correctly or a parameter that allows it to be controlled by the serial port set.

0 Kudos
Message 8 of 8
(2,889 Views)