Reference an FPGA Array of Controls

I am developing a cRIO application that has an array of 23 controls in the FPGA.  The FPGA Interface C API Generator defined them as a name and size.
typedef enum
   NiFpga_ControlArrayU32_Setpoints = 0x8118,
} NiFpga_ControlArrayU32;
typedef enum
   NiFpga_ControlArrayU32Size_Setpoints = 24,
} NiFpga_ControlArrayU32Size;
How would I reference the 15th setpoint, as NiFpga_ControlArrayU32[15] or as an offest to 0x8118?
Solved!
Go to Solution.

Hi Paul_Knight,
When the C headers are generated, there should be one called NiFPGA.h.
There is a function within this header for reading a U32 array. The function is called NiFpga_ReadArrayU32. Here is some documentation on the various read array functions.
http://zone.ni.com/reference/en-XX/help/372928G-01/capi/functions_readarray/
You should be able to read the array values and store them into an array in C. Then you can access them as you would normally within your C program. Hope this helps!
Robert B
Applications Engineer
National Instruments

Similar Messages

  • FPGA Read/Write Control Function Issues

    Hello all!  Rather new to using FPGA, but I have an interesting issue that's popping up.
    Currently pulling in RAW voltage data from a set of sensors (Pressure Transducers, Load Cells, etc) through a cRIO DAQ.  Have the FPGA file setup to pull in that data already and have the main VI and all the sub-VIs working just fine.
    What I'm trying to do is save the raw voltage data (TDMS files) on the lower level and the convert and display on the upper level so that I don't have to convert and save (speed up saving data).  So that leaves 3 distinct "levels/sections":
    On FPGA that pulls in the raw data
    On FPGA that saves the raw data
    Main VI that does all the controls/conversions/displays etc.
    Number two is where I'm having an issue.  I want to save all the data in parallel so I'm creating a save FPGA for the I/O devices (8 Relays to command solenoid valves, 3 Pressure Transducers, 1 Load Cell, 4 Thermocouples).
    The issue I'm having is when I use the FPGA Read/Write control to read in from the Target and save to the TDMS.  When I only use a single FPGA target reference the lines are broken, but as soon as I switch to two targets, it now works.
    I've attached a screen cap of the current problem.  The set-up on the bottom (with only one target) doesn't work.  But the second I add more than one target, it works.
    Any reason why it might be doing this?  Any ideas/suggestions at all on how to go about setting this up in general?
    Thanks!
    Attachments:
    FPGAError.jpg ‏35 KB

    HySoR,
    You might check the documentation for "data" terminal of "TDMS Write" (http://zone.ni.com/reference/en-XX/help/371361H-01/glang/tdms_file_write/). One DBL element is not accepted, but 1D DBL array is accepted.
    data is the data to write to the.tdmsfile. This input accepts the following data types:
    Analog waveform or a 1D array of analog waveforms
    Digital waveform
    Digital table
    Dynamic data
    1D or 2D array of:
    Signed or unsigned integers
    Floating-point numbers
    Timestamps
    Booleans
    Alphanumeric strings that do not contain null characters

  • 2012 Dynamic Event Registration Array of Controls

    In upgrading to LV2012, I have discoverd what may be a bug, or at least an incompatability between 2011 and 2012 with respect dynamic event registration of an array of controls as opposed to individual control references.
    This bit of code worked in 2011 but doesn't in 2012, with error 1 generated at the reg events block when run in 2012. I have been in contact with technical support, but haven't yet heard their take on this.
    Any thoughts.
    Solved!
    Go to Solution.
    Attachments:
    Top Application.png ‏13 KB
    SubVI.png ‏23 KB

    I've got the bug too -- it appears this bug is present when arrays of control refs are connected to the ConPane. Link to cross-post on LAVA about the original problem. As Patrick@Vision mentions above, one workaround is to ensure that the array of control refs is no longer on the ConPane by collapsing the Register for Events node onto the caller.
    a.lia-user-name-link[href="/t5/user/viewprofilepage/user-id/88938"] {color: black;} a.lia-user-name-link[href="/t5/user/viewprofilepage/user-id/88938"]:after {content: '';} .jrd-sig {height: 80px; overflow: visible;} .jrd-sig-deploy {float:left; opacity:0.2;} .jrd-sig-img {float:right; opacity:0.2;} .jrd-sig-img:hover {opacity:0.8;} .jrd-sig-deploy:hover {opacity:0.8;}

  • Incorrect data type when writing to FPGA Read/Write Control

    I have run in to a problem this morning that is causing me substantial headache.  I am programming a CompactRIO chassis running in FPGA mode (not using the scan engine) with LabVIEW 2012.  I am using the FPGA Read/Write Control function to pass data from the RT Host to the FPGA Target.  The data the RT host is sending comes from a Windows host machine (acting as the UI) and is received by the RT Host through a network published variable.
    The network published shared variable (shared between the RT and Windows system) is a Type Def cluster containing several elements, one of which is a Type Def cluster of fixed point numerics.  The RT system reads this shared variable and breaks out the individual elements to pass along to various controls on the FPGA code's front panel.  The FPGA's front panel contains a type def cluster (the same type def cluster, actually) of fixed point numerics.
    The problem comes in the RT code.  After I read the shared variable I unbundle the cluster by name, exposing the sub-cluster of fixed point numerics.  I then drop an FPGA Read/Write Control on the RT block diagram and wire up the FPGA reference.  I left click on the FPGA Read/Write Control and select the cluster of fixed point numerics.  I wire these together and get a coercion dot.  Being a coercion dot hater, I hover over it the dot and see that the wire data type is correct (type def cluster of fixed point numerics), but the terminal data type is listed as a cluster containing a Boolean, code integer and source string, also known as an error cluster.  I delete the wire and check the terminal data type on the Read/Write Control, which is now correctly listed as a type def cluster of fixed point numerics.  Rewiring it causes the terminal to revert back to the error cluster.  I delete the wire again and right click on the terminal to add a control.  Sure enough, a type def cluster of fixed point numerics appears.  Right clicking and adding an indicator to the unbundle attached to the network shared variable produces the proper result.  So, until they are attached to each other, everything works fine.  When I wire these two nodes together, one spontaneously changes to a error cluster.
    Any thoughts would be appreciated.

    My apologies I never got back to responding on this.  I regret that now because I got it to work but never posted how.  I ran in to the exact same problem today and returned to this post to read the fix.  It wasn't there, so I had to go through it all over again.
    The manifestation of the problem this time was that I was now reading from the Read/Write FPGA front panel control and writing to a network published shared variable.  Both of these (the published shared variable and the front panel control) were based on a strict type defined cluster, just like in the original post.  In this instance, it was a completely different cluster in a completely different project, so it was not a one-off thing.
    In addition to getting the coercion dot (one instance becoming an error cluster, recall), LabVIEW would completely explode this time around.  If I saved the VI after changing type definition (I was adding to the cluster) I would get the following error:
    Compile error.  Report this problem to N.I. Tech Support.  Copy cvt,csrc=0xFF
    LabVIEW would then crash hard and shutdown without completing the save.  FYI, I'm running LabVIEW 12.0f3 32-bit.
    If I would then reopen the RT code, the same crash would occur immediately, ad nauseam.  The only way to get the RT code to open was to change the type defined cluster back to the way it was (prior to adding the new element).
    I didn't realize it last time around (what originally prompted this post), but I believe I was adding to a type def cluster when this occurred the first time.
    So, how did I fix it this time around? By this point I tried many, many different things, so it is possible that something else fixed it.  However, I believe that all I had to do was to build the FPGA code that the RT code was referencing.  I didn't even have to deploy it or run it... I just had to build it.  My guess is that the problem was the FPGA Reference vi (needed to communicate with the FPGA) is configured (in my case) to reference a bit file.  When the development FPGA Main.vi ceases to match the bit file, I think that bad things happen.  LabVIEW seems to get confused because the FPGA Main.vi development code is up and shows the new changes (and hence has the updated type def), but when you ask the RT code to do something substantial (Open, Save, etc), it refers to the old bit file that has not yet been updated.  That is probably why the error getting thrown was a compile error.
    I'm going to have to do an additional round of changes, so I will test this theory.  Hopefully I will remember to update this post with either a confirmation or a retraction.

  • FPGA Read/Write Control Issues

    Hello all!  Rather new to using FPGA, but I have an interesting issue that's popping up.
    Currently pulling in RAW voltage data from a set of sensors (Pressure Transducers, Load Cells, etc) through a cRIO DAQ.  Have the FPGA file setup to pull in that data already and have the main VI and all the sub-VIs working just fine.
    What I'm trying to do is save the raw voltage data (TDMS files) on the lower level and the convert and display on the upper level so that I don't have to convert and save (speed up saving data).  So that leaves 3 distinct levels/sections:
    On FPGA that pulls in the raw data
    On FPGA that saves the raw data
    Main VI that does all the controls/conversions/displays etc.
    Number two is where I'm having an issue.  I want to save all the data in parallel so I'm creating a save FPGA for each I/O device (8 Relays to command solenoid valves, 3 Pressure Transducers, 1 Load Cell, 4 Thermocouples).  To do this I want to create a separate VI for each device (not sure if that's a smart thing to do).
    The issue I'm having is when I use the FPGA Read/Write control to read in from the Target and save to the TDMS.  When I only use a single FPGA target reference the lines are broken, but as soon as I switch to two targets, it now works.
    Any reason why it might be doing this?  Any ideas/suggestions at all on how to go about setting this up in general?
    Thanks!

    Hi,
    HySoR wrote:
    The issue I'm having is when I use the FPGA Read/Write control to read in from the Target and save to the TDMS.  When I only use a single FPGA target reference the lines are broken, but as soon as I switch to two targets, it now works.
    Could you take a screenshot and post this part of your code? I'm having trouble understanding what you are describing.
    Craig H. | CLA | Systems Engineer | National Instruments

  • FPGA array

    I am using PXI 7833R which has 3M gate reconfigurable I/O (RIO) FPGA with 190 kB of embedded RAM.
    Now I want to build an array with 3000000 elements, is that possible?
    My test pattern is in form of .txt file, how can I send this data to the FPGA array through the Host? It seems that I can not write an array control from the Host to the FPGA through the "Write and Read Function" . Is there any good way to do this?
    Thanks

    Using the 3M gate FPGA you can not store an array with 3,000,000 elements. The best option is to use the 192 kB of memory but that will not be enough for what you describe.
    If you try to implement an array in LV FPGA which will be implemented on the FPGA, you will only be able to allocate a few hundred elements, because implementing data storage on the FPGA is very inefficient.
    In general you can implement small arrays on the front panel of the FPGA VI and read or write them using the Read/Write node from the host VI.
    Depending on how fast you need to output your test pattern, you may be able to store the data in the host VI and stream it to the FPGA as it is being generated. You can use the 192 kB of memory on the FPGA to buffer the data between stream from the host and outputing from the FPGA.
    Can you provide more details about your applications? How fast do you need to generate the data? Digital or analog? Will this buffer be generated once or be repeated? Is your host application running in Windows or LabVIEW Real-Time?
    Christian Loew, CLA
    Principal Systems Engineer, National Instruments
    Please tip your answer providers with kudos.
    Any attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system,
    or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject
    to the Sample Code License Terms which can be found at: http://ni.com/samplecodelicense

  • Use one fpga vi to control two targets

    Hi,
    I have two fpga because I need more than 8 analogue output and analogue input.  I wonder if I can use one fpga vi to control two targets (the two FPGA boards I use are PCI-7833R) so that the outputs can be synchronized.  I think if it's possible it'll be easier to implement the synchronization between while loops,etc.  If it's not possible, how can I interface between between fpga.vi and make the synchronization possible and make two vi's talk to each other?  Thank you very much for your help!
    Thanks,
    Charles

    I have successfully ran the same code on two (2) different FPGA boards. The difference being that the host will use different Aliases to control the FPGA boards,
    Both FPGA Boards MUST be the same type ( I used PXI-7811s). 
    My program consisted of 6 individual communication portals and there was NO synchronization between boards
    Visualize the Solution
    CLA
    LabVIEW, LabVIEW FPGA

  • Array of control

    Whether we can creat array of controls.If yes how we can create.any one help me with an example vi

    Yes.
    On front panel drop an Array container.  Find whatever control you want to make an array of.  Drag and drop that control into the array container.
    This is pretty basic LabVIEW.  I would recommend looking at the online LabVIEW tutorials
    LabVIEW Introduction Course - Three Hours
    LabVIEW Introduction Course - Six Hours

  • How can i use class reference from an array effeciently?

    Hi,
    I made some test here with getting a class reference from an array and using the reference's methods or variables.
    Basically arrayEx is a container of type Array and it contains the Person's class instance in it. Num is a number extracted from the Person's instance
    Example #1----Strongly typed
    Var reference:Person;
    Var num:int;
    //Assignation
    reference=arrayEx[0];-----IT IS SLOW HERE
    //Use
    num=reference.number --- IT IS FAST HERE
    Example #2---Not typed
    Var reference:*;
    Var num:int;
    //Assignation
    reference=arrayEx[0]; ---- IT IS FAST HERE
    //Use
    num=reference.number ---IT IS SLOW HERE
    No matter what i change in both code like casting Person on arrayEx, i cant seem to make them work both fast at the same time
    If someone knows how, please tell me,
    Dominik

    Hi,
    I made some test here with getting a class reference from an array and using the reference's methods or variables.
    Basically arrayEx is a container of type Array and it contains the Person's class instance in it. Num is a number extracted from the Person's instance
    Example #1----Strongly typed
    Var reference:Person;
    Var num:int;
    //Assignation
    reference=arrayEx[0];-----IT IS SLOW HERE
    //Use
    num=reference.number --- IT IS FAST HERE
    Example #2---Not typed
    Var reference:*;
    Var num:int;
    //Assignation
    reference=arrayEx[0]; ---- IT IS FAST HERE
    //Use
    num=reference.number ---IT IS SLOW HERE
    No matter what i change in both code like casting Person on arrayEx, i cant seem to make them work both fast at the same time
    If someone knows how, please tell me,
    Dominik

  • Creating array of references to another array's elements

    I have been coached by NI support to read an array of picture files into an array of picture indicators and then in order to save memory, establish an array of references to the array of picture indicators' elements so that I can use them in a subsequent loop.    Does anyone know a quick way to create this array of references from an array of picture indicators? 
    Solved!
    Go to Solution.

    My understanding is there is only one reference to an array element.  There is no such thing as references to different array elements.
    Why wouldn't you use a reference to the array, use the value property node, then use index array to get out the picture you are interested in?

  • How to create an array with controls and indicators?

    I want to create a scrollable array of control/indicator pairs from a config file.  Something that looks like the attached image.  Of course, I can only create an array that's either either a control or indicator -- not both (the operator should not be able to edit the name or change the state of the LED).  So I guess I need to split the array and have two side-by-side and SOMEHOW link the scrollbars.  But then I have no idea how I can get the control switch states from the array.  Is there an easier way to do what I'm trying to do?
    Attachments:
    New Bitmap Image.JPG ‏11 KB

    Hello,
    Another option would be to use the custom control I built for you, see below.  You can just drop this into an array, it should look like your example (more or less).
    Cheers!
    CLA, CLED, CTD,CPI, LabVIEW Champion
    Platinum Alliance Partner
    Senior Engineer
    Using LV 2013, 2012
    Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.
    Attachments:
    Custom Switch.ctl ‏8 KB

  • How can I create multi-dimensional arrays of controls?

    I'm building a VI that will have hundreds of on/off buttons, 24 on each of 8 tabs.  I can deal with them programmatically in an array, like this:
    and then find which one was pushed with some XOR'ing:
    But what if I want two rows of 12 buttons?  Can I make a 2D array of buttons somehow?  Or a 1D array of buttons on two rows for cosmetic reasons?
    What if I want to put 24 buttons on each of 8 tabs?  Can I make a 24x8 array of controls somehow?  Or a 12x2x8?
    Thanks,
    -Jordan
    Solved!
    Go to Solution.

    jordanglassman wrote:
    and then find which one was pushed with some XOR'ing:
    I would strongly recommend to replace the XOR with a not equal. Same outcome, but less nerdy. It is also much more universal! For example if you ever need to do this on an array of numerics to see which element got changed (I often do!), the XOR will no longer work as well (with integers, you'll end up with bitwise comparisons and numeric results, and with DBLs you'll end up with coercions and unpredictable results because bits are lost).
    LabVIEW Champion . Do more with less code and in less time .

  • Creating Array of Controls

    Hello,
    I would like my VI to create an array of controls that can be operated by the Front Panel. That is, I have an integer which specifies the amount of controls I need. I then would like my VI to automatically create an array of boolean controls that I can change from the Front Panel. I can create the array for Indicators, but unfortunately the behaviour(control/indicator) of the elements inside seems to be bound to the behaviour of the array.
    Thanks in advance
    Solved!
    Go to Solution.

    Hi,
    you cannot create controls in runtime.
    But you can create an array of boolean switches in edit time and you can change the number of shown array elements in runtime. Is that all you want to have?
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Array of controls

    I need to place arrays of controls (labels, textboxes & comboboxes) on my form. I cannot yet see a way to do this with the NetBeans form designer, but have I missed a trick?

    With VB a single event handler is coded for the array and it is passed the index of the control. I guess I must accept that this is another matter that is much more complicated using Java and its tools than VB.Not so. Why don't you go through the swing tutorials on the Sun website instead of blindly assuming what's possible and what's not?
    Try this, which has a single event listener:import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.SwingUtilities;
    public class ButtonArray implements ActionListener {
        JFrame frame;
        JButton [] buttons = new JButton [16];
        public ButtonArray () {
            for (int i = 0; i < buttons.length; i++) {
                buttons = new JButton ("" + i);
    buttons [i].addActionListener (this);
    public void actionPerformed (ActionEvent e) {
    for (int i = 0; i < buttons.length; i++) {
    if (buttons [i] == e.getSource ()) {
    frame.setTitle ("Button " + i + " was clicked");
    public void createAndShowGUI () {
    frame = new JFrame ("Button Array Test");
    frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
    frame.setLayout (new GridLayout (2, 8));
    for (JButton button : buttons) {
    frame.add (button);
    frame.pack ();
    frame.setVisible (true);
    public static void main (String[] args) {
    SwingUtilities.invokeLater (new Runnable () {
    public void run () {
    ButtonArray buttonArray = new ButtonArray ();
    buttonArray.createAndShowGUI ();
    }That took all of 15 minutes to code, test and post.
    db
    edit And in future, swing questions should be posted to the swing forum at
    {color:0000ff}http://forum.java.sun.com/forum.jspa?forumID=57{color}
    Edited by: Darryl.Burke

  • Performance issues in manipulating class references in a array

    Hi,
    just to make things clear, the issue is noticed from my part because i retrieve a list of instances located in a array to manipulate them in a variable holder. Normally, the operations can be made between two instances stored in a simple variable to variable fashion and it works realy fast.
    I analysed two main operations: retrieving references in a array to a variable and get or set a value from the variable reference.
    Here are the objects used to perform the test operation:
    var v4:Vector.<Person>= new Vector.<Person>();//List of Persons instance
    var refHolder:Person; //Typed reference
    var refHolder2:*;   //Not typed reference
    Test #1: looping 200 000 times and only retrieving references from the array v4.
    Typed reference
    Not typed reference
    4ms with approx 436 893 intructions per ms
    2ms with approx 436 893 intructions per ms
    436893 * 4 / 200 000= 8.8 instructions with loop to perform the retrieval
    436893 * 2 / 200 000=4.5 instructions with loop to perform the retrieval
                         Test #2: looping 200 000 times, retrieving references from the array v4 and getting a value from the instance.
    Typed reference
    Not typed reference
    4ms with approx 436 893 intructions per ms
    11ms with approx 436 893 intructions per ms
    436 893 * 4 / 200 000= 8.8 instructions with loop to perform the retrieval
    436 893 * 11/ 200 000= 24 instructions with loop to perform the retrieval
    So my conclusion with that test is that with a typed reference you spend more time assigning a reference than manipulating a value from the reference
    With a not typed reference, the time spent is in manipulating the reference in the variable.
    Which one should i use or what should i do to have better performance with manipulating references from arrays?
    Here are the files i used to test this:
    reference.swf     //Online example
    reference.zip     //Source file
    Dominik

    Hey,
    Here's what I think the problem is:
    As long as you do not interrogate your refHolder variable for its properties or methods, Flash won't give a damn about it's type (that's why case 2 runs good when you dont't try to get .num property).
    But, if you do want to get some values from it and if Flash does not know which type, then Flash has to go and find the referenced class (going backwards through v4 array to find out that values stored in it are Person type, then finding the Person class to find out the .num property, etc...).
    As for the first test case (looping being faster with a non-typed), the few ms you are gaining there are only because Flash doesn't register the Person class because you don't tell him. But as you can see, it takes him only 2ms, which is not much.
    So, considering that Flash registers a class in just a few ms IF you tell him, it should be way more performant to do so (in the case you do want to retrieve values..) than letting him guess 200 000 times the same thing (because of course it will search for that class ref each time it goes through the loop..).
    So my advice for you is that if you are going to do something with those Person objects inside the loop, let Flash know their reference class..!

Maybe you are looking for

  • Has LC Designer been removed from Acrobat distributions?

    Hi there! I've installed Acrobat XI and could not find LC Designer in its folders. Has it been removed from Acrobat distributions? Is it only availabe as a LiveCycle module now? Thank you for any info. Marcos

  • Printing Oracle Report.

    I have a problem printing an Oracle report on a dot matrix printer. I have the report set to print in character mode with the width and height of the report set to 132,31 respectivley and the width and height of paper set to 7.25,11 each. The problem

  • Microphone probably broken but I don't know.

    So I have an IPhone 5c. My problem is Siri doesn't respond to my voice. I've tried it over and over again and nothing happens. Also when I try to record a video on my phone the sound doesn't work. In the video I will be talking but when I playback th

  • Best way to force password policy on users within 1-2 weeks?

    We have a Server 2008 R2 domain. I'd read that the password policy in GPO is only available for Computer Configuration, not User Configuration? Is that correct?  If so, that's not very flexible and will make things trickier for us.   And regarding en

  • Goods Movement Cancellation

    Dear Friends I have an RO/SO for which we have created goodsmovement in 05/2008 and want to reverse the same in current period. but while doing it I am getting error as RE Quantity moved exceeded by 1 EA : MATERIAL PLNT Storage LOC Message no. M7022