LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Recherche d'un code source avec un fichier dll

Bonjour,

 

Je dois faire un programme sous labview pour mon stage qui va permettre d'automatiser une chaine de mesure en thermométrie.

Pour cela je dois d'abord essayer de communiquer avec les appareils de mesure (ici des sondes Oceasoft). Mais malheurement je n'ai pas leur code source !

J'ai donc télécharger un fichier dll (ib97u32.dll) qui est sensé me permettre d'obtenir ce code selon les fabricants des sondes.

Cependant, je ne vois pas comment récupérer le code source après avec Labview, je pense qu'il faut utiliser "appeler une fonction d'un dll" mais je n'arrive pas à configurer correctement l'entrée pour qu'elle détecte ma sonde.

Labview ne détecte pas de problème mais quand je lance le programme il ne se passe rien.

J'espère que vous pourrez m'aider. 

Merci

 

Chey

0 Kudos
Message 1 of 12
(4,577 Views)

You cannot get the source code from a DLL, but you can calll functions within the DLL using Call Library Function Node. You will need documentation on the correct way to call the functions, or at a minimum a .h (header) file that shows the function prototypes. Do you have documentation for the DLL? Can you upload your LabVIEW code, showing what you are trying to do?

0 Kudos
Message 2 of 12
(4,564 Views)

Bonjour,

 

Merci de votre réponse.

Je n'ai rien du tout concernant la dll, je sais juste qu'il me le faut pour communiquer avec les appareils d'après cette page car nos appareils sont de type "DS9097U adapter on COM ports".

J'ai téléchargé la dll ici mais il n'y a rien non plus.

Je ne vois pas comment je peux obtenir un fichier en .h.

Je vous met mon vi en pièce jointe. J'espère que vous allez pouvoir résoudre mon problème.

 

 

 

0 Kudos
Message 3 of 12
(4,549 Views)

Bonjour,

 

Sans documentation associée à votre DLL, ca va être compliqué pour l'utiliser correctement sous LV afin de communiquer avec votre instrument...

 

Apparemment, vous avez un port COM sur votre instrument, vous devriez peut être essayer d'utiliser les drivers NI-VISA de LabVIEW pour établir une communication (http://www.ni.com/white-paper/12822/fr).

Sinon, je vous conseille aussi de contacter Oceasoft pour voir s'ils ont connaissance de cette DLL ou s'ils ont des drivers à vous fournir.

 

Bon courage.


Cordialement,

Celine
National Instruments France

0 Kudos
Message 4 of 12
(4,541 Views)

J'ai déjà contacté oceasoft, ils m'ont juste redirigé vers ce site :

http://www.maximintegrated.com/products/ibutton/software/windowsdk/

 

Il passe par l'intermédiare d'un développement qui se base sur un API  « .net » (OW.NET API) fournie par Dallas. C'est ainsi que j'ai pu trouver le bon dll à utiliser.

 

J'utilise en effet les drivers NI-VISA mais pour VISA Write, il me faut le code source de l'appareil pour le rentrer dans le buffer sinon cela ne fonctionne pas.

 

0 Kudos
Message 5 of 12
(4,536 Views)

It appears that you have all the documentation you need from the links you provided. You have two options for communicating with your device: OW.NET (using the .NET functions in LabVIEW) or TMEX (using Call Library Function Node). You should not mix those functions with VISA functions. You should not call ib97u32.dll directly, since that is a low-level driver. Instead, install the entire driver and SDK package, and follow the documentation to determine which DLL to use.

 

If you have no experience with .NET or C programming, it will be challenging to get this working. The OW.NET approach will likely be easier than TMEX, especially since the TMEX functions appear to use the unusual Pascal calling convention which is not directly supported by LabVIEW.

0 Kudos
Message 6 of 12
(4,506 Views)

J'arrive très bien à communiquer avec mes appareils avec le driver ; Il me donne bien la température de la sonde.

Mais ce n'est pas vraiment ce que je cherche, il me faut vraiment juste le code source car mon but est d'automatiser la chaine de mesure.

 

Je ne connais pas du tout le .NET. En essayant d'utiliser cette fonction dans Labview, j'ai un message d'erreur : "une erreur est survenu lors du chargement de l'assembly" (j'ai mis le seul dll possible dans l'assembly : OneWireAPI.NET.dll que j'ai trouvé dans le dossier "LIb" puis "OW.NET" du SDK package téléchargé). Je ne vois pas comment faire car si je mets d'autres dll, j'ai des messages d'erreur aussi comme quoi il ne reconnait pas le fichier.

 

Sinon, je ne vois toujours pas pourquoi la fonction "appeler un fonction d'une dll" (<=> "Call Library Function Node") ne me renvoie rien. Quelle fonction de ma dll dois-je utiliser pour obtenir le code source en sortie ?

J'ai trouvé une liste des fonctions senséees être contenues dans ma dll : http://files.maximintegrated.com/sia_bu/softdev/owdocs/Docs/TMEX/tmex75tg.html

Mais je ne sais pas laquelle utiliser.

 

Je n'arrive avec aucune des deux méthodes que vous me proposez.

 

 
0 Kudos
Message 7 of 12
(4,493 Views)

Why are you so certain you need the source code? For which library or application do you need source code? The SDK includes sample source code for applications using the OW.NET library, have you looked at it?

 

If you look at the OW.NET API SDK Contents, you will see that you need to install the Visual J# redistributable version 2.0, available from Microsoft. Once you install that, the OW.NET assembly will load in LabVIEW without errors. You can then start duplicating the C# code in LabVIEW. For example, here's a quick translation of the example C# code from the OW.NET Primer written in LabVIEW. Of course I have no way of testing this as I do not have the appropriate hardware.

OneWireExample.png

0 Kudos
Message 8 of 12
(4,483 Views)

C'est mon maitre de stage qui m'a dit qu'il fallait trouver cela pour communiquer avec les sondes.

Désolé mais je m'y connais pas trop, j'essaye juste d'avoir ce que l'on m'a demandé.

J'ai installé Visual J# redistributable version 2.0, mais quand je veux ouvrir le fichier OneWireAPI.NET.dll, labview m'affiche un message d'erreur ("Aucune application capable d'ouvrir ce type de fichier n'a pu être trouvée") et quand j'ouvre OneWireAPI.NET (fichier VJSPROJ) il plante (il s'ouvre et se feme en continu).

 
0 Kudos
Message 9 of 12
(4,464 Views)

After installing Visual J# redistributable, you can load the assembly in LabVIEW using the .NET functions without the error you saw before. Then you can use the LabVIEW .NET functions (constructor, invoke node, property node) to access the functions in OneWireAPI.NET.dll. The functions available in that DLL are documented in the Docs->OW.NET folder inside the SDK.

 

The image I posted is actual code in LabVIEW 2012; you can drag it to your desktop, and from there into the block diagram of a new VI. It may ask you to locate the OneWireAPI.NET assembly; if so, find the location of the dll on your hard drive. You can also duplicate this code yourself; start by placing a .NET invoke node on the block diagram. Right-click to choose the class, select .NET, then browse and find OneWireAPI.NET.dll.

 

You cannot open the SDK examples in LabVIEW, since it isn't LabVIEW code. If you do not have VisualStudio installed, then you cannot open the projects. However you can still open the individual code files in a text editor; .java, .vb, and .cs files are all plain text that you can open in Notepad (or any other text editor).

 

I don't think it will help you to look at the .java source of the OW.NET library itself, unless you are actually trying to duplicate all the functions of it in LabVIEW (which will be a lot of work). I think you want to use the OW.NET library, not duplicate it. The C# and VisualBasic examples will be much more helpful; for example I see that there is a "MissionStartDelay" example which reads temperatures at regular intervals (according to the Readme.html), which sounds like what you want to do.

0 Kudos
Message 10 of 12
(4,457 Views)