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: 

How to communicate with NFC module

Solved!
Go to solution

Hi 

 

I have a PN532 NFC module, and want to communicate with it via LabVIEW.

I studied some documents and found require call "libnfc.dll".

I don't know how to call DLL file by LabVIEW. Can anyone show me some examples? If can show me call "libnfc.dll", will better.

Thank you.

 

I found this API datasheet on http://www.libnfc.org/api/group__dev.html#ga9a0b9811c0e7f93e7474db82a1fb4501

 

 

0 Kudos
Message 1 of 2
(3,437 Views)
Solution
Accepted by topic author QH_Dai

If you have both a library (.dll) file and a header (.h) you can use the Tools > Import > Shared Library (DLL) wizard to load the library. This will attempt to automagically create VIs for the functions in the library, but you should take care to check the results as/before you use them.

 

If you have just the DLL (or you have both, but don't need all of the functions!) you can use the Call Library Function Node. This can be found using the palettes on the Block Diagram, under Connectivity > Libraries & Executables > Call Library Function Node. You can then either double click, or right click and select Configure, to configure this function call.

 

You set the path or name of the library (you can use the name alone if LabVIEW can find the library on the search path - otherwise you'll need to use the full path) or you can tick a box to specify the path on the block diagram (at which point you wire a path to the node). You type the name of the function you want to call (as you read from the libnfc references you linked to) and then you add parameters to match the types given in the same reference.

 

For example, using the nfc_list_devices function that comes up at the top of the page when I click the link you gave, you would set 3 parameters,  and make the return value a numeric type. Some useful links for types in LabVIEW compared with C/C++ can be found below:

Dereferencing Pointers from C/C++ DLLs in LabVIEW

Calling C/C++ DLLs Containing Simple and Complex Datatypes from LabVIEW

 

The types of the parameters should correspond with with the types in the documentation - it looks like a string (C String Pointer), an array of strings (see the first link above for more information on arrays) and a numeric value (the same type as the return value).

 

You'd then take the output of the function (the return value) as the value you wanted (the number of devices found) and probably wire the other 3 parameters as inputs, and ignore the outputs of those rows.


GCentral
Message 2 of 2
(3,404 Views)