Labview equivalent of C pointer

Dear All,
In the Labview program, that I'm currently writting, I'm using a dll that was written in C. The C function I'm trying to call, is expecting a pointer to char in its prototype like so: void example(unsigned char *a); What is the Labview equivalent of a char *.
Thanks in advance for your help,
Regards,
Alan

There is a difference in passing a char type and a char array (string).  First of all, C expects the string to end with the NULL character (\0).  You need to append the NULL to the string, then convert the string to a byte array (String to Byte Array function).  Then in order to pass the array to the C DLL, you need to declare the parameter as Type=Array, Data Type=U8, Dimensions=1, Array Format=Array Data Pointer.  This will pass the string into the DLL.
- tbob
Inventor of the WORM Global
Attachments:
GetFirstFile.png ‏2 KB

Similar Messages

  • LabView equivalent to running batch files using the "shell" command (VisualBasic)

    I'm converting a VisualBasic app to LabView and am having trouble figuring out how to run a batch file with LabView.
    The VB code that I'm trying to replicate is:
    'UNLOAD RTX DRIVERS
    Dim ProcessId As Long
    ProcessId = Shell(App.Path + "\UnloadReloadRTX.bat", vbNormalFocus)
    Wait 400
    I haven't found a LabView equivalent to the Shell command. Any suggestions will be appreciated.
    thanks,
    Todd

    It seems as if this question pops up every week. Use the System Exec.vi found under Funtions - Communications palette. It is the equivalent of Shell.
    - tbob
    Inventor of the WORM Global

  • How do I pass a 1D LabView array as a pointer to an array in a C DLL?

    Hello,
    I am trying to pass a 1D Labview array of DOUBLE to a C DLL which is expecting a pointer to an array of DOUBLE.  I have read that LabView stores arrays as a pointer to a pointer and that the first element of a LabView array is actually the size of the array.  So I think my question is then how do I dereference the first pointer and pass in a pointer which points to the second element in the array?    
    Any thoughts out there?
    Thanks!

    Hi justyou,
    There are many, many resources on this topic, so I will guide you to the two most useful ones:
    The "Call DLL.vi" example that ships with LabVIEW explains how to use almost any data type when executing DLLs. The "Call DLL.vi" can be found by browsing the Example Finder.
    Integrating DLLs. This page is the portal for DLL interation related resources. Read the tutorials and try the examples...
    This should give you some ideas.
    Have fun!
    - Philip Courtois, Thinkbot Solutions

  • LabVIEW Equivalent of 'Whos' command in MATLAB

    Hi 
    Similar to 'Whos' command in MATLAB I wanted to list all the constant and controls (if possible) I used in my LabVIEW code. Does anyone know if its possible with any additional code or Toolkit. 
    Thanks in advance. 
    Thanks & Regards,
    Kunal Raithatha.
    CTD - CLAD (I wish I can take off that A, and maybe use it later to replace D :-)
    Easy Tip :- "To copy an image to a VI icon, drag the image file and place it on the icon
    located in the upper right corner of the front panel or block diagram" ...If you know any
    more reply back.

    Smercurio_fc
    Pupose is to enlist name and value of constants n controls I used in quite a big VI, values of the constants are often manipulated to adjust the requirement. It will be good at the end if I can print them altogether. 
    Thank You.
    Thanks & Regards,
    Kunal Raithatha.
    CTD - CLAD (I wish I can take off that A, and maybe use it later to replace D :-)
    Easy Tip :- "To copy an image to a VI icon, drag the image file and place it on the icon
    located in the upper right corner of the front panel or block diagram" ...If you know any
    more reply back.

  • Labview equivalent to matlab filter function

    Hi
    I have a script In Matlab that is using the built-in filter function in matlab.
    y = filter(B,A,x);
    were x is the signal to be filtered and A/B is the filter coefficients.
    Is there a labview function that gives my the same y as Matlab does if x, A and B is the same.
    Best wishes 

    sorry. I post some Matlab code and VI to demonstrate.
    Matlab code:
    clear;
    x = 1:12;
    A = [1 2 1 1];
    B = [1 1 2 1];
    y = filter(B,A,x)
    %y =
    %     1     1     4     2     8     0    17   -10    40   -45   107  -157
    y2 = filter(B,A,x, [0 1 0]')
    %y2 =
    %     1     2     2     5     3     9     1    18    -9    41   -44   108
     and my VI is attached (screenshot). My Y is correct to the first filter call to matlab (y = y in both lw and matlab). And that is good. But the other call use a the vector Zi = [0 1 0] and from Matlabs help
    [Y,Zf] = FILTER(B,A,X,Zi) gives access to initial and final
        conditions, Zi and Zf, of the delays.  Zi is a vector of length
        MAX(LENGTH(A),LENGTH(B))-1, or an array with the leading dimension 
        of size MAX(LENGTH(A),LENGTH(B))-1 and with remaining dimensions 
        matching those of X.
     Any idees how this can be done in LabView or what the Zi does in the Matlab implementation?
    Message Edited by Tudor on 02-11-2010 09:29 AM
    Attachments:
    lw-filter.jpg ‏55 KB

  • Labview, ActiveX, and VarPtr

    I currently have a 3rd party ActiveX product that I am using with Labview 11.0.  One of the Methods requires me to pass the VARPTR of a TYPE (Labview Cluster) and the LEN of the TYPE.  In Visual Basic, VARPTR and LEN produces a 32bit signed long integer word.  How do I get the Labview-equivalent of VARPTR and LEN values of a Labview Cluster to pass to the routine.

    You can get a pointer to a memory address in LabVIEW.  The functions you'll need are DSNewPtr, MoveBlock, and DSDisposePtr.  These functions are built into LabVIEW and you can call them using a call library function node configured with the library name set to "LabVIEW."  They are documented in the LabVIEW help, and there are examples for how to use them on this forum.  You can get the size of a cluster by flattening it to a string, then getting the string length.  If your ActiveX component expects to do something useful with that cluster, you may need to reorganize the cluster or add extra padding elements because LabVIEW does not necessarily pack structure elements the same way other software does.  Also be aware that LabVIEW data has the opposite endianness of most Windows software so you may need to do some byte-swapping.

  • Interface LabVIEW and matlab

    Hello, I want to interface LabVIEW with MATLAB using TCP/IP for data transfer. Can anyone, please give me a step-by-step instruction to how to do this? Or else can you point out where I can get them? Thanks.
    Solved!
    Go to Solution.

    Hi Sanchu,
    As TCP/IP is such a generic protocol then you should be able to fairly easily build TCP/IP interfaces for both your LabVIEW and Matlab code and transfer data using ASCII, or variants etc depending on what sort of data you are trying to transfer. I'm not too familiar with Matlab, but on the LabVIEW end there are some very good TCP/IP server and client examples that ship with LabVIEW.
    Another option that you may want to consider, and the reason I'm answering this is that I've recently done a project whereby we took some legacy Matlab code which we wanted to transpose into LabVIEW so that we could then fully automate a test system we have using TestStand. Much of it we were able to derive LabVIEW equivalent functions, but for some functions where LabVIEW didn't appear to have a suitable equivalent, or where it was simply more efficient, we simply copy and pasted the Matlab code into either in the first instance MathScript nodes (not dependant on Matlab) or Matlab script nodes (which will hopefully return to at a future date to fully transpose over to LabVIEW so that we are no longer dependant on a Matlab licence).
    In both instances the relative ease of doing this was very impressive, and we were able to wrap huge amounts of Matlab code within LabVIEW with very few issues. As an idea, have you considered wrapping your Matlab functionality in this way and then keeping all the TCP/IP client and server comms within LabVIEW?
    N.B. if you haven't found it search the palette for 'Matlab Script'
    Best of luck,
    David
    David Clark
    CLA | CTA
    CLA Design Ltd
    Hampshire, England

  • Is there a 'compile time' if/else statement in LabVIEW

    I have some LabVIEW software that includes subVIs to read from and write to digital IO lines. However, I need to also be able to run this software on systems which don't have an IO card (or associated drivers) installed and so I want to be able to allow the software to be on PCs that do or don't have the drivers installed.
    Optimally, I would like to modify the software so that at runtime, by reading the settings in a configuration file, a boolean is set to determine whether the IO functions are called. I tried this but, unfortunately, am getting error messages when I try and start up the software due to the lack of the 'nidaq32.dll' file on the target PC. I'm guessing this is because the subVIs are only within case structures and so must be loaded into memory regardless of whether they are to be used.
    Is there any way around this problem? If I were writing this in C I guess I would use '#if' statements to include/exclude the IO functions at compile time. Is there an equivalent in LabVIEW? I guess my options are:
    1. Finding some way of allowing the IO functions to be included at runtime though I'm thinking this might not be possible.
    2. Include/exclude the IO functions at compile time with some LabVIEW equivalent of the C '#if' preprocessor directive.
    3. Give in and install the nidaq32.dll file with the software.
    Just to complicate matters, I'm currently running LabVIEW 5.0.1 (I do plan to upgrade soon) so am limited to the functions available in this version.
    Thanks.

    CAS wrote:
    Just to complicate matters, I'm currently running LabVIEW 5.0.1 (I do plan to upgrade soon) so am limited to the functions available in this version.
    That's the main problem.
    On newer versions you can:
    define simulated devices (http://zone.ni.com/devzone/cda/tut/p/id/3698)
    use the conditional disable structure (see e.g.: http://zone.ni.com/devzone/cda/tut/p/id/3046, (see section 6))
    Time to upgrade!
    Message Edited by altenbach on 06-21-2007 07:32 AM
    LabVIEW Champion . Do more with less code and in less time .

  • How do you use Synergy 7.1 with LabVIEW?

    My company has reciently installed and configured IBM Rational Synergy 7.1 to be used as our Source Code Control tool.  I have installed the appropriate Microsoft Source Code Control Interface so that Synergy will show up in LabVIEW and it does show up in the "Source Control" options window.
    However when I select Synergy as my source control tool it does the following:
    1.  Brings up the login window - I am able to login with no problem
    2.  Brings up a dialog allowing me to select the project to work on, and after I select the project I get two errors...
    one from Synergy: "The workspace/project you want to add to IBM Rational Synergy is not under the work area path 'C:\xxx"
    (where xxx is my work area for the Synergy project I selected)
    then one from LabVIEW:  "Error -2941 occured at prefPage_Source Control.vi     An error occured trying to get the source control project path.    Possible reasons:  LabVIEW:  The source control provider does not support the specified operation."
    I first tried this on an earlier version of Synergy that matched what is being used in:
    http://digital.ni.com/public.nsf/allkb/16D37CCC8659123F8625720500087DB4
    But I was getting pretty much the same errors back then too.  It seems like it should work in LabVIEW, I just have no idea what I am doing wrong!
    Anyone out there successfully using LabVIEW with Synergy????
    Thanks,
    Trevor.

    In theory if a source control provider supports the Microsoft SCC interface, it *should* work with LabVIEW. In practice, each provider has custom implementation that sometimes causes problems when trying to configure the provider from LabVIEW. One sticking point for many providers is the expectation or assumption that an IDE will use some concept of a "project" and therefore pass data associated with that project to the provider. LabVIEW does not enforce that concept but does pass valid information.
    Synergy was tested back when it was a Telelogic product. It was difficult to configure and required exact steps to get it to work correctly. The linked knowledge base were steps taken that worked for a few customer setups. It's possible that on other Synergy setups the exact steps may not work. Also, you might check to make sure you try to configure existing Synergy projects  and not try to create new ones from LabVIEW.
    The error you mentioned seems to imply that some data is not supported by Synergy. I am not sure if Synergy would be able to track down the issue, but I would recommend contacting them to see if they can pinpoint what data LabVIEW is sending is not valid.
    George M
    National Instruments

  • How to get data from a pointer to an array using dlportio?

    I use DLPORTIO.DLL to access the parallel port on a WinXP. The purpose is to read data coming from an fpga.
    The transfer rate is quite high (more than 500kB/s).
    DLPORTIO.DLL can buffer data from the parallel port.
    I would like to use this fonctionality to speed up the data transfer by ready 16 x 8 bits that have been buffered. I get the pointer to the element from the dll. 8bits means U8 in Labview and, of course, 16 => U16 and 32bits => U32. But what to connect when I want 128bits??? How to use the pointer cominf from the dll and say to Labview it is the pointer to the first element of my 16 element array??
    Thanks to all
    Dai Tran Duy
    Dai
    LV 7.1 - WIN XP - RT - FP
    Attachments:
    dlportio.zip ‏852 KB

    LabVIEW does not have a 128 bit numeric so you will need to create a work around of sorts. What I would suggest is creating some wrapper dll functions. These funcitons would take say an array of U8s from LabVIEW, convert them into your 128 bit number and then call your dll with that.
    In addition take a look at the manual on exteranl code in LabVIEW, Using External Code in LabVIEW, which discusses how to pass arrays to a dll. In addition there is a shipping example in LabVIEW 7.0 that shows how to pass all sorts of LabVIEW and C data types. The example even includes C code snipits.

  • How can I get all the options of Field Point Explorer 3.0.2 in Measuremen​t and Automation Explorer 3.1?

    I am a student using LabVIEW and Compact Field Point to implement a
    senior design project in Electrical and Computer Engineering.  We
    have LabVIEW 7.1 and a cFP-2020 and additional modules.  We are
    trying to use the CTR-500 module to output a pulse train to drive a
    stepper motor.  We have found instructions online of how to do
    this, but they all use Field Point Explorer.  The instructions
    make use of options in Field Point Explorer that are not included in
    Measurement and Automation Explorer (the software included with the
    cFP).
    I have downloaded Field Point Explorer 3.0.2 and followed the
    directions.  Now, in LabVIEW, when I using the newly created .iak
    file, I get a dialogue asking to find the SubVI: 'FP Read (Float Array
    -IO).vi'.  Included with LabVIEW are subvis for FP Read, but not
    with the float array part.  So I figure I cannot use Field Point
    Explorer created .iaks with LabVIEW 7.1.  So how cannot I access
    the same options in Measurement and Automation that I was able to find
    in Field Point Explorer?
    Thanks

    Hi,
    FieldPoint Explorer is no longer used to configure FieldPoint systems. However, I do not think that the configuring your system in FieldPoint Explorer is causing the error.
    FieldPoint systems are now setup in Measurement and Automation Explorer (MAX).  Information on setting up FieldPoint systems in MAX can be found in the MAX help under: Installed Products>> FieldPoint. Also, I recommend upgrading to the latest FieldPoint driver and version of MAX.  The FieldPoint VI's will be slightly different when you upgrade, so there is a good chance that this will eliminate the error.
    Regards,
    Hal L.

  • Extracting pointer information and displaying it as an image

    Hey,
    I am using Intel's OpenCV image processing library in LabVIEW.
    There's a pointer to a struct IplImage that is passed around in order to run image processing functions.
    The struct IplImage is defined as: 
    typedef struct _IplImage
    int nSize; /* sizeof(IplImage) */
    int ID; /* version (=0)*/
    int nChannels; /* Most of OpenCV functions support 1,2,3 or 4 channels */
    int alphaChannel; /* ignored by OpenCV */
    int depth; /* pixel depth in bits: IPL_DEPTH_8U, IPL_DEPTH_8S, IPL_DEPTH_16U,
    IPL_DEPTH_16S, IPL_DEPTH_32S, IPL_DEPTH_32F and IPL_DEPTH_64F are supported */
    char colorModel[4]; /* ignored by OpenCV */
    char channelSeq[4]; /* ditto */
    int dataOrder; /* 0 - interleaved color channels, 1 - separate color channels.
    cvCreateImage can only create interleaved images */
    int origin; /* 0 - top-left origin,
    1 - bottom-left origin (Windows bitmaps style) */
    int align; /* Alignment of image rows (4 or 8).
    OpenCV ignores it and uses widthStep instead */
    int width; /* image width in pixels */
    int height; /* image height in pixels */
    struct _IplROI *roi;/* image ROI. when it is not NULL, this specifies image region to process */
    struct _IplImage *maskROI; /* must be NULL in OpenCV */
    void *imageId; /* ditto */
    struct _IplTileInfo *tileInfo; /* ditto */
    int imageSize; /* image data size in bytes
    (=image->height*image->widthStep
    in case of interleaved data)*/
    char *imageData; /* pointer to aligned image data */
    int widthStep; /* size of aligned image row in bytes */
    int BorderMode[4]; /* border completion mode, ignored by OpenCV */
    int BorderConst[4]; /* ditto */
    char *imageDataOrigin; /* pointer to a very origin of image data
    (not necessarily aligned) -
    it is needed for correct image deallocation */
    IplImage;
    I am having problems with closing OpenCV's GUI window when called from LabVIEW in Linux. A solution to this may be to not use OpenCV's GUI window in LabVIEW for Linux, but rather pass back the pointer to the processed image in LabVIEW. From that pointer, we can send it to a C wrapper to extract some information that we want from the struct in order and pass back those values to LabVIEW. Then LabVIEW will process those values and display the image. What will I need to extract from the pointer (via a C wrapper) in order to display the image onto LabVIEW?
    I attached a LabVIEW example that I found. This example loads and displays an image. I am thinking of doing something similar to that. Instead of loading an image from the file dialog, I will pass all of the necessary information to Draw Flattened Pixmap.
    Attachments:
    Picture4.vi ‏56 KB

    My description of my problems with interfacing OpenCV with LabVIEW is contained in this discussion
    Basically, the code works in C in Linux, C in Windows, LabVIEW for Windows, but not in LabVIEW for Linux.
    We finally were able to get OpenCV to interface with LabVIEW for Linux by doing some complex edition to make install. However, LabVIEW was still having trouble with the function to close all HighGUI windows. Even though it went through the function, it will not close the HighGUI window. Also the HighGUI window freezes and when it eventually closes, it crashes LabVIEW.
    When I test it by writing C programs, the function does what it is supposed to do.

  • Output on LabVIEW the TestStand step results

    Hi,
    I'm building on LabVIEW 8.5 a simple TestStand User Interface.
    My sequences return some values but I don't know how to output them on LabVIEW.
    I was thinking of a table to store the results.
    Any hints on how I'm able to do so?
    I apreciate all the help.
    Thanks in advance.
    Regards,
    Daniel Coelho
    Daniel Coelho
    VISToolkit - http://www.vistoolkit.com - Your Real Virtual Instrument Solution
    Controlar - Electronica Industrial e Sistemas, Lda

    Use the TesStand ExecutionView Manager available in the TestStand tool pallet of LabVIEW and the Execution View. Then when you call our test code (dll, LabVIEW, CVI or what ever) and the return values are returned to the step.Result container based on the type of step. The ExecutionView Manager will automatically display the return value in the Execution View indicator on front panel, if it is a string, a number or a Boolean or etc.
    Look at "C:\Program Files\National Instruments\TestStand 4.1\UserInterfaces\Simple\LabVIEW" as a starting point.
    Notice that there is not any code that reads the return value from the test steps and displays it. The TestStand Engine automatically does it for you. Using the ExecutionView Manager and the Execution View, your LabVIEW user interface will not know when a test step is run or what the return values are without setting up events to trap UI messages from the TestStand Engine.
    If all you need is to see the return value and results this is the way to go.
    Omar 

  • How to use a namespace in a C++ code communicated with labview

    I have a long code written in c++.  Now I want to acquire data with labview, send some data points as an entry to my c++ code and it will return a value to Labview.  I tried with a simple sum of two elements and it worked, but in my long code I have so use some namespaces and subfunctions.  If I try to compile it does not accept a namespace such as std.
    Can anybody help me?

    I'm not certain the difference (and there isn't an attachment). However, if the functions you are exposing from your DLL are not marked as extern "C", then you'll have a lot of difficulty calling it from LabVIEW. You don't want to deal with the C++ name mangling, so keep the API simple and straight C. Behind the function signature, however, you can use whatever you want.
    If you are already doing this, can you answer the following
    1. What, exactly, is going wrong?
    2. What version of LV?
    3. What version and platform is the C++ compiler?
    Brian Tyler
    http://detritus.blogs.com/lycangeek

  • Send command to modem using serial port and capture the response in the labview

    hello.
    I am doing my shool project.
    I want to send command to modem using serial port and get the response in the labview.
    When i run my program and enter"AT", only messy code will be displayed.
    can anyone help me? thanks 

    Dora0512 wrote:
    Thanks for you all. My partner got it already.
    I am doing send sms part.
    Can anyone tell me why my program is not so steadily?
    It means this program can run. But somtimes I cannot receive sms. sometimes can
    Basically, it is not well-written from both a LabVIEW and a communications point of view.  Unfortunately, I can't elaborate because today is an exrtremely busy day at work.  I'm hoping this bump will prompt someone to help you with your problem.  If you could also provide us with the programmer's guide or the manual for your equipment, that would be extremely helpful.
    Bill
    (Mid-Level minion.)
    My support system ensures that I don't look totally incompetent.
    Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.

Maybe you are looking for

  • Windows 7 Backup Error

    I encountered the below error when attempted to alter a Windows 7 backup. Error: "Set up backup: The function atetmpted to use a name that is reserved for use by another transaction. (0x80071A09)" Solution: Create backup without schedule, enable sche

  • Unsmooth playback uploading video from iPhone 4 to Facebook

    I took a four minute video the other day in a vehicle and when I uploaded it to Facebook, it was very choppy visually. Is there a reason why it doesn't play back smoothly? I notice that not only in this particular video, but in videos I took standing

  • In InDesign CS6, can we now make the hyperlinks open in a new window?

    With InDesign CS5, we could link outside the document using a PDF exported file, but when customers clicked on the hperlink, it opened a window on top of the pdf file which meant that the customers had to hit their back button and scroll down the pdf

  • Share video dimensions for iDvd ??

    Hi, when checking out the share dialog I was confused as to what dimension to use when Wanting the use the video in iDvd. None of the dimensions are dvd standard ( 720x 480 : ntsc ) ( 720 x 576 : pal ). Any ideas ?? Cheers, Gerrit.

  • Action Script to add a parent node value to the top node

    I need to add a new parent node value to a hierarchy for the top node.  The action script parameters to add a node is "Add|Version|Hierarchy|Node|Parent Node|Leaf property".  I am at a loss on what to do for the top node since there is no Parent Node