Call the dll in BT (usbm.dll)

Hi all

I'm having a hard time finding how to call a DLL in Labview. I read a little bit on this subject but am still a beginner. The DLL in question is usbm.dll (http://www.usbmicro.com/, the list of functions & types is documented here). I use the call library node to call the DLL.

So I call things with no input argument functions work well (for example my first 2 calls check for the presence of the device and the number of devices and work ok returning the correct output)

Then I try to use functions with arguments (3rd stage of the VI) and Labview does not have them (error 1097). I'll for function "int USBm_DeviceValid (unsigned char device)", in my opinion, that argument must be of type uint8 and output type int8... I tried all numeric types, does not.

In addition, if I skip the VI 3 and go to step 4 (calling a function that takes 2 parameters and sends a command to my device): the function is executed (for example the unit move), but then Labview block (exits without error message). Is it because of calling the function?

Any suggestions would be welcome, thanks!

Hi lvrat, thanks for your suggestions.

I had the problem. I got an older version of this DLL usbm (as well as some example of LV files) which works very well. Looks like the DLL most recent that I was using has some issue with Labview...

I enclose these files (they were not easy to find), in case someone else tries to interface to a USBmicro device.

Tags: NI Software

Similar Questions

  • SubVIs called screw embedded in a DLL must be located at the opening of a VI that calls the DLL

    I have compiled a DLL that contains two exported screws calling subVIs that calls another DLL that contains hardware dongle functions.  The build DLL works fine and the two screws work fine as source code.  The reason why I want to build a DLL, it is avoid distributing the source dongle screws in order to make the two functions called more sure.  However, when I try to open a VI that makes a call to one of my two functions of the DLL (screws exported), LabVIEW try to find all the subVIs called by VI exported in the DLL.  This suggests that the DLL does not contain the subVIs - probably each VI called by the exported screws must be built in the DLL - or am I completely wrong?  I tried setting all the subVIs and the dongle DLL like 'always understood' and even export all the subVIs too.  The constructor of the DLL is able to include the entire hierarchy of VI in the DLL?  Am I missing a special combination of parameters?

    To summarize my approach:

    A first level VI (to provide an end user with password protected diagram) calls my DLL (two functions are exported screws) that call subVIs that call the DLL dongle.  I want only to provide my DLL and the dongle DLL, NOT all their source code is linked.

    Any help would be greatly appreciated, that this problem has ceased completely in my development.

    Mike

    After traveling through the builder application LAVA forum, I found a post that discusses a problem of construction of the Advanced setting 'Use LabVIEW 8.x file layout'.  This should be checked to make the build work.  Apparently R & D already know the problem (# 158487).  Moreover, previous projects of 8.6 will have this checked by default, which makes them to build properly.

    The new application now works correctly.

    The problem of generation original DLL is also fixed.

  • Loading of a DLL on RT: Missing Export "DecodePointer" "Kernel32.dll" and 7 error when calling the DLL

    Hi, I recently changed to Visual Studio 2010 and Windows 7 64-bit.

    I have an existing Office RT system running RT 2009.  This system calls a DLL that I already built using Visual Studio .net 2003 and Windows XP.

    Since I've recompiled the DLL I get an error 7 file not found error when I call the RT DLL, even if I simply replaced the old DLL with a new one in the file system so the path has not changed.

    I also noticed that the message on the screen connected to the RT system during startup:

    "achieveworldpeace.dll" load error: lack of export 'DecodePointer' of ' Kernel32.dll'.

    Any ideas on this problem?  It is perhaps as simple as a switch in the compiler?

    Thank you.

    I'm not sure it's a simple switch in the project settings in Visual C. The problem is clearly in the standard C runtime library that gets linked to your DLL and refers to exports of Windows which are not available on the RT system. Don't forget that the RT system is a limited Win32 API emulation.

    I usually avoid these problems using Visual C 6 to create DLLs for LabVIEW projects. The standard library of the C runtimes will not know what Windows API reference more recent exports because they have supported even under Win95. So unless your explicitedly reference code not supported RT APIs you wouldn't have problems. If you do not use the standard C file i/o functions and management of memory in your DLL functions, you can also try to link statically C runtime libraries in your DLL, or vice versa depending on what you have now. It may or may not work. Otherwise there is not much else but by using an earlier version of Visual Studio.

  • allocate memory and call the dll function that writes to the pointer

    Hello!

    I have a DLL that has a function as in the following example, I need to call from labview. In C, I need to allocate memory for data and of course the struct. I add the pointer and the length of the data to the struct and call the function with the struct. The function itself inserts values of the struct and affected memory. Someone at - it a working solution how this can be done with Labview?

    typedef struct Thestruct
    {
    UINT16 val1;
    UINT8 val2;
    UINT8 val3;
    DataLength UINT16;
    UINT8 * data;
    } T_Thestruct;

    MY_API status MY_API_CALL udaReceive (handle, T_Thestruct * args);

    I tried in labview (see photo), but I only got values inside the structure as well as the 1097 error, reserved memory included values as before.

    OK, I found the soluton to my own problem. Alignment on the struct must be corrected in Labview. There must be a value between dataLength 2Bytes dummy and the pointer.

  • do not call the dll of Labview in CVI

    I have a Labview dll should call for the CVI. but it always shows error.

    void __cdecl Idx_RW_Reg (uint16_t registry, int32_t RegLength,
    [LVBoolean Data_in], uint8_t OperationRd1Wr0, TD1Hdl * read_reg_table_in,.
    uint16_t PortAddress, TD1Hdl * Table_of_reg_out, LVBoolean ControlFrame [],.
    uint16_t * PortAddressOut, int32_t len2, int32_t len);

    TD1Hdl * read_reg_table_in: what is it, who can tell me

    typedef struct {}
    int32_t dimSizes [2];
    LVBoolean Boolean [1];
    } TD1;
    typedef TD1 * TD1Hdl;

    Any help is greatly appreciated.

    Thank you.

    Hello

    What is your calling code?

    I suggest you read: call a LabVIEW DLL in a CVI or other C/C++ project

    Kind regards

  • Call the DLL works fine with 1 bunch of entry but with 2 bombs

    I have some problems to make my DLL to work using 2 inputs of cluster.

    I create a simple DLL (MS C++ Express 2010) with 1 bunch and 1 struct entry and everything works.

    If I add a second cluster/struct, Labview bombs and disappear, even if it is the same definition and initialization of structure entries.

    I do think I struct Boundries set to 1 byte.

    Any ideas?

    Thank you! That's exactly what was going on.

  • Call the DLL function with a pointer to a complex structure

    Hello

    I try to call a function by using COLD LAKE. My problem is the function parameters that I'm trying to access.

    Here is the function and its parameters:

    typedef struct _BAR_INFO
    {
    ULONG dwSize;
    ULONG dwFlag.
    } BAR_INFO, PBAR_INFO;

    typedef struct _DEVICE_INFO
    {
    ULONG dwBarNum;
    BAR_INFO BarInfo [6];
    } DEVICE_INFO, * PDEVICE_INFO;

    Int GetDeviceInfo DLLIMPORT)
    unsigned int CIH.
    PDEVICE_INFO pdevinfo
    )
    {
    ULONG i;

    If (DFR > = DevNum)
    Return PCICORE_DEVICE_NO_FOUND;

    If (DevTable [JC]. DevHandle is NOTHING)
    Return PCICORE_DEVICE_NO_INITIALIZE;

    if(pdevinfo == null)
    Return PCICORE_INVALID_PARAMETER;

    pdevinfo-> dwBarNum = DevTable [JC]. DevInfo.dwBarNum;
    < pdevinfo-="">dwBarNum; i ++)
    {
    pdevinfo-> .dwFlag BarInfo [i] =
    DevTable [JC]. DevInfo.BarInfo [i] .dwFlag;
    pdevinfo-> .dwSize BarInfo [i] =
    DevTable [JC]. DevInfo.BarInfo [i] .dwSize;
    }

    Return PCICORE_SUCCESS;
    }

    As an attachment, there is the Info.vi device Get trying to access this feature. The code crashes when the function is called.

    I have probably not pass parameters of data properly to COLD LAKE.

    Thank you for your lights.

    An array of fixed size in C is equivalent to a cluster of LabVIEW that contains the same number of identical items, replace the table with a cluster. In addition, structs are always passed by reference and the C function expects a pointer to a structure, you don't need to unbundle. Skip the cluster to function as a single parameter. Try the attached revised version of your VI.

  • Call the DLL function with pointer to a simple structure

    Hello

    I try to call a function by using COLD LAKE. My problem is the function parameters that I'm trying to access.

    Here is the function and its parameter:

    typedef struct {}
    int major;
    minor int;
    review of int;
    build int;
    } VersionNumberType;

    int Comm_BTE_softVersion (VersionNumberType * pVersion)
    {
    BYTE ByBuffer [2048];

    If (!.) Comm_BTE_readYMem (byBuffer, COMM_BTE_TX14_SOFTVERSIONADDR,
    COMM_BTE_TX14_SOFTVERSIONSIZE))
    {
    return FALSE;.
    }

    //. process the response
    pVersion-> major = (int) (byBuffer [0] & 0xFF);
    pVersion-> minor = (int) (byBuffer [1] & 0xFF);
    pVersion-> revision = (int) (byBuffer [2] & 0xFF);
    < 8)="" )="" |="" ((int)="" (="" bybuffer[5]="">

    Return TRUE;
    } //. end Comm_BTE

    As an attachment, there is the Version.vi soft Comm BTE who try to access this feature. The code crashes when the function is called and labVIEW is closed.

    I have probably not pass parameters of data properly to COLD LAKE.

    Thanks for help.

    Kind regards. NewCLAD.

    Everything is configured properly EXCEPT the digital representation of the values in the cluster. They must match int, which is likely 32 bit on your platform. They are your VI, U8.

  • Call a DLL in TestStand by reference

    All,

    I developed a DLL that control a USB based power. The call of the dll works from TestStand 4.1 most of the time. What I think is happening, is that whenever I call the dll in my main sequence of the file as well as other files in sequence, as several instances of the dll is loaded.

    Part of the init of food must pass back a SESSION number that is used in subsequent calls to the dll. I store as a global variable in TestStand and pass around sequence that never he needs.

    How can I load the DLL at the beginning of the sequence and PASS a reference (handle) to all other calls to the dll?

    Thanks in advance

    Carmine

    Doug,

    Thanks for your help. I found a UnLoadModules() in one of the child seq that I missed. Unless I missed all the others, I think this should be resolved.

    Carmine

  • Dial 1172 error, a run-time error of a VI in the second time in the DLL

    Hi all

    I am a beginner in labVIEW.

    I have to write a test program in labVIEW that uses a DLL created by another programmer.

    I called the DLL of my labVIEW for control of DIOs, a serial port, communicate with a slave device, a flashing task.

    During the test program, I found that the program is OK if I use it just once, however, if I want to execute coninuously using one-loop While, it failed with

    Error 1172.

    As far as I could understand, it seems that the DLL creates a log file in C:\ so that he was called for the first time, and the process does not take control of this logfile even after the closure of the DLL.

    Then when the DLL is called for the second time, it looks for the same log file to write new info, but as he was taken control by the previous process, there is an error.

    Please find the attached files.

    Hope there will be someone who can help me to point out my mistakes in my vi or suggest me a solution for this.

    Thank you and best regards

    Aung

    (Because the system does not accept the attachment of the DLL, I changed the extension to .pdf for the DLL file)

    This is the DLL file (I have lack of attachment in the post)

  • Call a DLL in an integrated project

    Hello world

    I created a Subvi, which returns the recognized audio devices and readers who are searched in a specific way. For audio devices I use lvsound2.llb functions. When I call these functions as soon as it works fine, but when I change the configuration during execution (it's inevitable), it is not up-to-date values.

    Say he finds 4 audio devices and when I disconnect them and rerun the VI it still says 4. To work around this problem, I created a DLL to from this Subvi and call the DLL from my hand. This works very well every time in the Project Explorer, given that the DLL is recalled every time and does not stay in memory in the same way the Subvi front. However, once I build my project into an executable file, it stops working. He always tells me, there is no audio device recognized.

    Project Explorer: Hey 4 devices audio, excellent!

    Casting of Exe: Nope, nothing here.

    Any ideas, where would be the problem? I will attach the VI I used to create a DLL from.

    Kind regards

    Pedro

    Too bad, I had to manually include the "data" of the created DLL file. LabView has failed to do himself.

    Kind regards

    Pedro

  • For the complex data type, how to generate the Dll with compatible interface to C/C++

    Hello

    I used the Labview FPGA module to develop test equipment. Now, I need to write a driver that is to be a Dll with compatible interface to C/C++ for this equipment. So that my client who is familiar with C/C++ can call the driver without any study on labview. But I had a few problem on how to convert labview for C/C++ data complex data type. To clearly explain to my question, I have attached a simple example. (see attachment) I try to generate a Dll for the attached example VI and get the the function prototype at the head of the files as below:

    ' void OpenFpgaReference (LStrHandle * RIODevice, TD1 * errorIn, LVRefNum * FPGAVIReferenceOut, TD1 * errorOut).

    As you have known, the type of data "LStrHandle * RIODevice" and "LVRefNum * FPGAVIReferenceOut" Labview data format are. C/C++ do not have this kind of data type and can not reconige it. As a result, I can't call the Dll of C/C++ programming language. How to convert these two data type of labview for the C/C++ compatible data format, and then build the Dll? Anyone know about this?

    The answer is really apprecaited! Thank you in advanced.

    Ivan.Chen wrote:

    As I found in the following article:

    http://digital.NI.com/public.nsf/WebSearch/FB001AA027C8998386256AAD006C142D?OpenDocument

    LVRefNum is the name of resource of LabVIEW VISA or refnum, and "it is impossible to convert LabVIEW VISA name of resource or refnum VISession valid ID."
    This means that external code modules can not access & control the session VISA which is open by labview. But for my purposes, I will not attempt to access this VISA extenal code(C/C++) session. I just hope that save this session VISA in the external code once I opened it in Labview dll; and pass it to the labview dll when needed. While I have not need to login again when I need to control the device. Is it possible to do?

    A LVRefNum is really just a single int32 value. Its meaning is useless for other environments than those who created it so that you Michael not any what in C/C++ caller but pass it back to other functions in your DLL, but this often isn't a problem at all.

    You can take the following statement of the LabVIEW extcode.h headers and add them to your delabviewed header files to make it work in such a way.

    #define Private (T) typedef struct T # _t {void * p ;} * T}

    Private (LVRefNum);

    The LStrHandle you must set a standard C string instead in your export DLL and document what is the size of the string buffer should have if it is an output parameter.

    TD1 error clusters should also be divided into their parameters (C compatible) separate for all items or just to the left of suite entirely.

    Rolf Kalbermatter

  • Help! How can I call the Matlab file with toolbox (matlab 7.1) in labview 8.6?

    Hello

    I developed a file matlab to optimize a system, it's Toolbox. Entries should be in Labview but also the outputs should be included in the labview graph.  The results include arrays. CVI is not installed. My labview is version 8.6. MATLAB is version 7.1.

    (1) is the version of labview and matlab questions in this problem?

    (2) what is the best solution? Matlab script? DLL? Active X?

    (3) if I could use matlab script, I define the type of each variables in labview, including those of the code?

    Thank you!

    Jessie

    Step 1: Learn patience. This forum provides no immediate technical assistance. It is composed mainly of volunteers, and most of us have full-time jobs.

    (1) is the version of labview and matlab questions in this problem?

    Not really.

    (2) what is the best solution? Matlab script? DLL? Active X?

    Any of these will work. If you want to use the script, then you must use the Matlab Script node. This allows you to enter the Matlab code directly in the node, or you can call scripts that you have on your file system. This method requires that you have MATLAB hand whole on the target computer. If you create a DLL Matlab, then you use the node library function call and call the DLL as any other DLL. This method simply requires that you have the Matlab Runtime on the target computer.  I assume when you say that you're referring to writing your own ActiveX ActiveX component?

    (3) if I could use matlab script, I define the type of each variables in labview, including those of the code?

    I don't know what you mean by defining each variable type. You need to create the entries and exits on the Script node Matlab, so you can pass data between LabVIEW and Matlab environment. The help of LabVIEW contains more information on the use of the Matlab Script node. There are also some examples with LabVIEW.

  • The DLL call fails when DLL uses a wide range

    I call a C++ dll in LabVIEW 32-bit on Windows 7. I kept getting error 1097 and finally understood it is because the dll uses two large paintings of 5 MB each. The tables are initialized in the constructor of an object, malloc is not used, or whatever it is. If I do the smaller berries, then everything works fine.

    The problem is not difficult to work around, now that I know what is the cause, but can someone tell me why a dll using a lot of memory would be a problem? I feel that 10 MB is really a lot of memory to use on modern computers.

    OK, you can test the appeal of the DLL in a Visual Studio test harness?

    In addition, in case you haven't seen another 'DLL error 1097' son type, here are a few. The cause of 1097 in your case can be illuminated by a multitude of courses of troubleshooting:

    Call dll error 1097

    Error code coming 1097 in DLL call

    error 1097 after the call dll function that allocates memory inside

    1097 error in the transition from table from C++ DLL for LabView (seems very relevant, although long)

    I know there are a lot of reading, but there is a good chance that the magic trick is in one of these threads already. We will ride on the shoulders of their work.

  • LabVIEW crashes after the call to the DLL

    Hi all

    I'm working on writing a wrapper for a dll. The call to the dll works fine a returns the appropriate values, but as soon as I close the VI dev LabVIEW environment crashes. Any help to avoid the same. I've been through a lot of posts and I tried varying the types of data sent to the dll, but again it gets crashed.

    the dll function that I use is the prototype (with the calling convention of type C)

    int nomfonction (Struct * cfg, UCHAR dNumber, UCHAR hTYPE)

    The varables UCHAR I'm passing as of 8-bit unsigned integers.

    For the structure, I did a cluster and pass with adapted to the Type and handles.

    The DLL is running very well and the VI stops, too, but as soon as I try to close the dev environment VI crashes. Help, please.

    Thank you.

    It is always possible that there is a bug in your DLL, or you're a failure calling a function in the DLL that is required in order to properly clean. The problem is perhaps not the way you have set up the call library function node.

    If you post: your VI; the header file that defines the structure of the cfg and the function prototype; and all the documentation on the function, so we can tell you if it is properly configured. Without this information there is little we can do.

Maybe you are looking for