04-21-2016 04:51 AM
Bonjour à tous,
Je viens demandez votre aide sur l'utilisation des dlls pour communiquer avec un appareil via LabVIEW. Mes bases en LV s'arrête à l'acquistion, l'envoie, l'édition de fichier et création de VI simple. Je travaille sur le développement d'un banc d'essai, je dois communiquer avec deux appareils dont l'un est un Analyseur de spectre (ça c'est fait) et l'autre un ANum_LFRF (il permet d'envoyer des Basse fréquence et recevoir des Radiofréquences). Mon soucis est au niveau de l'ANum_LFRF, je n'arrive pas à communiquer avec lui même avec les DLLs.
J'ai déjà fait "l'importation d'une bibliothèque partagé" (cela ne fonctionne pas, problème avec le header .h) puis j'ai éssayer de faire "appeler une fonction d'une DLL " (je n'arrive pas à réecrire, je ne sais pas comment faire).
Donc, j'aimerai avoir votre aide pour communiquer avec cette appareil. Comment faire pour créer un driver pour cette appareil pour LabVIEW.
Merci d'avance
Mahana T
04-22-2016 04:43 PM
I found that you uploaded the header file, DLL, and limited documentation in another thread: http://forums.ni.com/t5/Discussions-au-sujet-de-NI/Utilisation-d-une-Fonction-Win32-pour-%C3%A9tabli... It would have been a good idea to include that information here, because without it, there is no way to answer your question unless someone happens to have used the same device. Also, as you are probably aware since you posted the same question in the French forum, this is the English forum. While there are several of us who read French, you are more likely to get a response if you post your question in English and include all the relevant information.
It appears that your DLL uses an unusual interface. There is a single function in it called API. You call that function with two parameters: a string containing the text of a command to execute, and a structure (cluster in LabVIEW) containing parameters. I do not see any reason you'd need to use the shared memory functions mentioned in your other thread. You do, however, need some understanding of C in order to use this DLL.
The first step is to create a cluster that matches the "TAPILFRF" structure defined in the IPC.h file. In LabVIEW, the equivalent of the fixed-size character array is a cluster containing the same number and type of elements as the array, so that would be a cluster of 1024 U8 values. You'll need 4 of these to represent StringIn1..4, and another 4 to represent StringOut1..4. You'll also need 8 U8 values for the ByteIn1..4 and ByteOut1..4, arranged in the same order as they're arranged in the struct. Use the documentation to determine what values to put into that cluster when you call a command. You should follow standard C conventions such as terminating each string with a null character.
Once you have that cluster set up properly, calling the API function is straightforward. You pass two parameters - a string (configured as a C string) with the command name, and the cluster configured as "Adapt to Type." The return value indicates success or an error.