Threshold and interpolate array in LabVIEW FPGA

Hi,
It's a classical one, but I don't find an answer that fit my problem :
I want to threshold an array with a 4-20 mA analog input then interpolate an other array with the result of the threshold.
The result of the interpolation is then sent to an 4-20 mA analog output.
Very simple ! Just like that :
But I want to do that in LabVIEW FPGA on a cRIO 9074....and these functions don't exist in LabVIEW FPGA.
I failed to use LUT, so I need some help...
The 4-20 mA modules give/need a single-precision floating point format.
Thanks,

I have already told you the solution: use the lookup table Express VI (which is implemented as a memory block). Why does this not work for you?
The lookup table express VI includes interpolation. There is no need for thresholding. In fact, in your original example, there is also no need for thresholding. You can combine the two arrays into an array of 2-element clusters, which makes it effectively a lookup table, and wire that to the interpolate function alone.
If you have enough RAM available on the FPGA, you can also avoid interpolation by creating a lookup table large enough to hold every possible input value (and corresponding output). Since you are dealing with a 16-bit input, there are only 65536 possible values. I realized I provided the wrong numbers in my earlier post (I was off by a factor of 2). The address is the input and the table contains the corresponding outputs, so your lookup table will consume only 65536 * 2 = 131072 bytes or 128kb of RAM (each output value is 16 bits or 2 bytes).
I don't have the LabVIEW 2013 FPGA module available right now, and I can't find any documentation suggesting that the inputs and outputs are single-precision floating point values. Everything I see says that they are fixed-point values. Are you sure that the inputs and outputs are floating point? Can you provide a screenshot? In any case, regardless of the numeric format, you are limited by the 16-bit precision of the inputs and outputs, so you'll never have more than those 65536 possible values. If you do have to do the conversion, you can use the To Fixed Point and Fixed Point to Integer Cast functions (and the equivalents in the reverse direction). That will give you an integer with the same bit pattern as the fixed-point equivalent which you can use as an integer input to the lookup table.

Similar Messages

  • Decimate and interpolate blocks for labview dsp module

    Somebody have developped decimate and interpolate blocks for labview DSP ( sppedy and DSK6713)? could send me for a teaching laboratory ?

    Hi aif,
    The following link is excellent for using LabVIEW DSP with the NI- SPEEDY or the TI's supported DSP's
    http://cnx.org/content/search?target=&words=labview+dsp&allterms=weakAND&search%3Amethod=Go
    You can choose the lab that is the closest to your application.
    I hope that helped.
    Cheers,
    KostasB
    Applications Engineer
    National Instruments UK

  • Subtle trap I fell into with arrays in LabVIEW FPGA

    Hi
    Just reporting a problem I made for myself, where the LabVIEW IDE would allow me start FPGA compilation, but the Xilinx compiler would return an error.
    I had created a FOR loop with 2 auto-indexed input arrays. One was a fixed length - no problem. The other was an output array from the FOR loop looped back through a feedback node as an input to the same FOR loop. Inspecting the wire it was not of fixed length. From the Xilinx error message, I think the array was being used before being instantiated - no default value.
    The error had the phrase "formal <array_in> has no actual or default value".
    The solution was to explicitly index the second array inside the FOR loop with 'index array'. Defining the number of iterations of the FOR may also have worked, and would save on FPGA resources.
    Hopefully this helps someone in the future,
    Cheers

    LV 2013 Full dev system v13.0, Win XP SP3, FPGA 2013
    That diagram is almost exactly right. Sorry I can neither extract nor publish a clip.
    Only differences are:
    - the input array is fixed size, 2 elements, FXP <+/-, 16, 2>
    - the output and feedback arrays are FXP <+/-, 18, 4>
    - the input array sits within the while loop
    Almost certainly not important but:
    - In place of the increment & decrement blocks there are subVIs.
    - these also have boolean controls on/off controls via a loop tunnel.
    - the feedback node points the other way
    - the feedback node implementation was set to 'auto'
    Attachments:
    LV FPGA array problem.PNG ‏46 KB

  • LabVIEW FPGA driver for Xilinx SPARTAN 3E Starter Board

    i need drivers for spartan 3E .

    If you are at a university that has a site license for the FPGA module, the following might be of interest to you:
    Using LabVIEW FPGA with the Xilinx SPARTAN-3E XUP Starter Kit
    See also this discussion.
    Quote from the license agreement:
    ...INSTALLATION AND USE OF THE LABVIEW FPGA TARGET MODULE FOR THE XILINX SPARTAN-3E STARTER BOARD (THE “TARGET MODULE”) IS LIMITED TO ACADEMIC INSTITUTIONS THAT HAVE A VALID, CURRENT “ACADEMIC TEACHING LICENSE” FROM NATIONAL INSTRUMENTS FOR THE LABVIEW FPGA MODULE. THIS TARGET MODULE MAY ONLY BE USED FOR INSTRUCTIONAL PURPOSES, SUBJECT TO THE TERMS AND CONDITIONS OF THE NATIONAL INSTRUMENTS SOFTWARE LICENSE AGREEMENT THAT ACCOMPANIES THE SOFTWARE...
    LabVIEW Champion . Do more with less code and in less time .

  • Pass 2D array from LabVIEW to C# problem

    Hi , I have made a dll using .net assembly to use my labview code in c# . I can easily pass string , numerical and 1D arrays from labview to c# and vice versa, but when I want to read back 2D U16 array from Labview in c# I get the following exception although they have exactly the same type (ushort)
    Cannot widen from source type to target type either because the source type is a not a primitive type or the conversion cannot be accomplished.
    Could you please let me know how should I pass 2d array from labview to c#
    Thanks

    If all else fails, you could pass n 1D arrays across and then put the original 2D array back together. That's probably how the computer would do it behind the scenes, anyway.
    Cameron
    To err is human, but to really foul it up requires a computer.
    The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
    Profanity is the one language all programmers know best.
    An expert is someone who has made all the possible mistakes.
    To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):
    LabVIEW Unit 1 - Getting Started
    Learn to Use LabVIEW with MyDAQ

  • Why should I adopt LABVIEW FPGA as a tool for developing my FPGA projects?

    Dear Friends, 
    Since I have started using LABVIEW FPGA, I got too many questions in my mind looking for answers! 
    1-      Does anybody can tell me “why should I adopt LABVIEW FPGA as a tool for developing my FPGA projects?”
    I mean there are many great tools in this field (e.g. Xilinx ISE, ….); what makes LABVIEW FPGA the perfect tools that can save my time and my money? 
    I’m looking for a comparison can show the following points:
    ·         The Code size and speed optimization.
    ·         Developing time.
    ·         Compiling time.
    ·         Verifying time.
    ·         Ability to developing in future.
    ·         …etc.. 2-     
    I’ve Spartan-3E kit, I’m so glad that LABVIEW support this kit; I do enjoyed programming the kit using LABVIEW FPGA, but there are too many obstacles!
    The examples come with Spartan-3E driver don't cover all peripherals on board (e.g. LAN port is not covered)! There is a declaration at NI website which is "LabVIEW FPGA drivers and examples for all on-board resources" Located at: http://digital.ni.com/express.nsf/bycode/spartan3eI don’t think that is true!
    Anyway, I will try to develop examples for the unsupported peripherals, but if the Pins of these peripherals are not defined in the UCF file, the effort is worthless! The only solution in this case is to develop VHDL code in ISE and use it in Labview FPGA using HDL node!?
    3-      I wonder if NI has any plan to add support for Processor setup in Labview FPGA (Like we do in EDK)?
    4-      I wonder if NI has any plan to develop a driver for Virtex-5 OpenSPARC Evaluation Platform ?http://www.digilentinc.com/Products/Detail.cfm?Nav​Path=2,400,599&Prod=XUPV5 
    Thnaks & regards,Walid
    Solved!
    Go to Solution.

    Thanks for your questions and I hope I can answer them appropriately
    1. LabVIEW FPGA utilizes the intuitive graphical dataflow language of LabVIEW to target FPGA technology. LabVIEW is particularly nice for FPGA programming because of its ability to represent parallelism inherent to FPGAs. It also serves as a software-like programming experience with loops and structures which has become a focus of industry lately with C-to-gates and other abstraction efforts. Here are some general comparison along the vectors you mentioned
    Code Size and speed optimization - LabVIEW FPGA is a programming language. As such, one can program badly and create designs that are too big to fit on a chip and too slow to meet timing. However, there are two main programming paradigms which you can use. The normal LabVIEW dataflow programming (meaning outside a single-cycle loop) adds registers in order to enforce dataflow and synchronization in parity with the LabVIEW model of computation. As with any abstraction, this use of registers is logic necessary to enforce LabVIEW dataflow and might not be what an expert HDL programmer would create. You trade off the simplicity of LabVIEW dataflow in this case. On the other hand, when you program inside a Single-Cycle timed loop you can achieve size and speed efficiencies comparable to many VHDL implementations. We have had many users that understand that way LabVIEW is transformed to hardware and program in such a way to create very efficient and complex systems.
    Development Time - Compared to VHDL many of our users get near infinite improvements in development time due to the fact that they do not know (nor do they have to know) VHDL or Verilog. Someone who knows LabVIEW can now reach the speeds and parallelism afforded by FPGAs without learning a new language. For harware engineers (that might actually have an alternative to LabVIEW) there are still extreme time saving aspects of LabVIEW including ready-made I/O interfaces, Simple FIFO DMA transfers, stichable IP blocks, and visualizable parallism.  I talk to many hardware engineers that are able to drastically improve development time with LabVIEW, especially since they are more knowledgable about the target hardware.
    Compilation Time - Comparable to slightly longer to due to the extra step of generating intermediate files from the LabVIEW diagram, and the increased level of hierarchy in the design to handle abstraction.
    Verification Time - One of our key development initiatives moving forward is increased debugging capabilities. Today we have the abilities to functionally simulate anything included in LabVIEW FPGA, and we recently added simluation capabilities for Imported IP through the IP Integration node on NI Labs and the ability to excite your design with simulated I/O. This functional simualation is very fast and is great for verification and quick-turn design iteration. However, we still want to provide more debugging from the timing prespective with better cycle-accurate simulation. Although significantly slower than functional simulation. Cycle-accuracy give us the next level of verification before compilation. The single cycle loop running in emulation mode is cycle accurate simluation, but we want more system level simulation moving forwrad. Finally, we have worked to import things like Xilinx chipscope (soon to be on NI Labs) for on-chip debugging, which is the final step in the verification process. In terms of verification time there are aspects (like functional simulation) that are faster than traditional methods and others that are comparable, and still other that we are continuing to refine.
    Ability to develop in the future - I am not sure what you mean here but we are certainly continuing to activiely develop on the RIO platform which includes FPGA as the key diffentiating technolgoy.  If you take a look at the NI Week keynote videos (ni.com/niweek) there is no doubt from both Day 1 and Day 2 that FPGA will be an important well maintained platform for many years to come.
    2. Apologies for the statement in the document. The sentence should read that there are example for most board resources.
    3. We do have plans to support a processor on the FPGA through LabVIEW FPGA. In fact, you will see technology on NI Labs soon that addresses this with MicroBlaze.
    4. We do not currently have plans to support any other evaluation platforms. This support was created for our counterparts in the academic space to have a platform to learn the basics of digital design on a board that many schools already have in house. We are currently foccussing on rounding out more of our off-the-shelf platform with new PCI Express R Series boards, FlexRIO with new adapter modules, cRIO with new Virtex 5 backplanes, and more.
     I hope this has anwered some of the questions you have.
    Regards 
    Rick Kuhlman | LabVIEW FPGA Product Manager | National Instruments | ni.com/fpga
    Check out the FPGA IPNet for browsing, downloading, and learning about LabVIEW FPGA IP Cores

  • What are the differences between LabVIEW, LabVIEW RT and LabVIEW FPGA

    I need a comparison of LabVIEW, LabVIEW RT and LabVIEW FPGA
    Solved!
    Go to Solution.

    NI LabVIEW is a platform and development environment for a visual programming language from National Instruments.
    NI LabVIEW Run-Time Engine includes the libraries and other files necessary to run applications and shared libraries built in LabVIEW.
    NI LabVIEW FPGA Module uses LabVIEW embedded technology to extend LabVIEW graphical development and target field-programmable gate arrays (FPGAs) on NI reconfigurable I/O (RIO) hardware.
    Message Edited by My NI on 08-13-2009 10:07 AM
    Regards
    MY

  • Labview FPGA compile stuck at "Place and Routing"

    I am using LabVIEW 2010 SP1 32-bit FPGA module.  I've built a very large program that was first done back using LabVIEW 8.6, so I have several years experience on LabVIEW FPGA.
    When I say it's a large program, I mean that a several times over the last couple years I've tried to add more functionality that has failed to compile do to not enough space on the target or timing restraints.  My target has mostly been the PCI/PXI NI-7813R.  Due to the nature of our product, a lot has to be done on one FPGA board.
    When I do go "over the limit" the compile (after a couple hours) fails and tells me that there's just not enough room on the 7813.
    Recently, however, I added some more code, thinking the odds were good that it might push me over the edge.  However, the compile never fails.  Unfortunately, it never stops either.  It gets to the "Placing and routing" portion of the compile and just stays there.  When I say stays there, I mean I've run it over night, and when I check it the next morning, the "Elapsed time" is over 10 hours, and still counting up.  The device utilization and estimated timing numbers are all under max.  And I see no errors in the report so far that I'm used to seeing.  Like I said, it just keeps compiling.
    I've attached the Xilinx log.  It looks much like the log before I added the extra code, except it just stops logging with reporting any useful error.
    Anyone have an idea what I could be doing wrong?
    Thanks,
    Rick
    Attachments:
    XilinxLog.txt ‏3936 KB

    tannerite,
    Thanks for your response.
    I added code that measures the "on time" of incoming DIO pulses.  If the pulses are HIGH for one given amount of time (eg. 60[+/- 5] usecs) it means one thing, if HIGH for a different amount of time (eg. 120[+/- 5] usecs) it means something else.  Generally speaking, I just keep a tick count between the rising and falling edge of the pulse, and use the "In Range and Coerce" from the Comparison Functions palette to check where the count lies.
    When it compiled successfully, I duplicated the above code for 10 seperate DIOs.  Then I realized I needed to monitor 20 DIOs.  It was when I added the code for these extra 10 DIOs that I got the "forever" compile.  The compile problem occurs everytime I try to compile with the extra 10 DIO code in place.  As an experiment, I just added 4 extra DIOs, i.e. code to monitor a total of 14 DIOs.  This causes the same compile problem.
    And yes, the compile seems to hang in the same place every time it hangs.  Like I said, I wouldn't be surprised if I'm just beyond the available resources available.  But when I've done this in the past, the compile does finally fail, and I get a useful error message.  I've never seen it go "forever".
    Thanks ahead of time for any insight you might have.
    - Rick

  • Labview 2010 Student Edition, will it work with the Labview FPGA module and Xilinx Spartan 3E??

    Just as the title states.
    I did a search here on compatibility, but I am coming up short with not much to show for it.
    I have Labview 2010 student edition, 32bit and 64 bit. I am trying to do a Senior Design project for my undergrad, and I am having some issues.
    I was able to download the Support for the Xilinx Spartan 3E and Labview FPGA.
    I install it, it runs through the unzipping process, installs, and then mysteriously I cannot find it. I have looked through my programs list and it is not listed. I open both editions of LabView and I find ABSOLUTELY NOTHING indicating that either one has ANYTHING to do with FPGA.
    Did I install it wrong? Or is it just not supported in the studend version of Labview???
    Can someone help me, please?

    M Boat wrote:
    What about the trial version? Any chance of it being on there?
    I think everything is available for download, and without activation it will be in trial mode and you have about a month (?) before the trial expires.
    A trial version of the FPGA module is available for download here. I have no idea if it would work with the student version.
    I would recommend to talk to your local NI sales representative for advice. Good luck.
    LabVIEW Champion . Do more with less code and in less time .

  • LabView fpga VHDL code and compiler

    Hello,
    I'm in the project where we would like to use NI hardware (more likely cRIO system). With NI hardware we will read/wright several AI/AO and DIO and perform some math and controls on the result of readings. We are planning to design FPGA code for project, but we are thinking about implement all data processing and control logic in VHDL and link it with AI, AO and DIO with help CLIP or IP Integration Node as explained in this : "white-paper": http://www.ni.com/white-paper/7444/en/
    Mentioned above paper explain how to implement VHDL code in LabVIEW FPGA VI using CLIP or IP Integration Node, but the topic that is not highlight explicitly is how these construction CLIP and IP Integration Node will be handled by Compiler. The main reason for such approach (VHDL linked with part that read/write into hardware AI AO and DIO) we expect that our VHDL code will be handled by LabVIEW compiler without modification and passed to Xilinx Compiler synthesis as is (path for Compile process I've taken from here: http://www.ni.com/white-paper/9381/en/ ), so we will be able at some level bypass the intermediate process of compilation and get almost the same result as if we design pure VHDL code and use Xilinx ISE for Synthesis Mapping and Bit File generation.
    Will this approach work? I was not able to find any documents that explain the Compiler behavior and confirm that VHDL code handled untouched or will modified, does such document exist?
    Note. I've requested official  assistance from NI support on topic above, but I would like to post this question on forum hoping get more feedback.

    Hello RangerOne,
    There won't be any modications to the internal logic of the VHDL that you implement in the IP integration node. Though I've seen developers unfamiliar with LabVIEW FPGA get tripped up on the synchronization registers that LabVIEW FPGA inserts into the code around the integration node. Learning where and why these syncrhonization registers are inserted has in my experience always resolved this issue. These two help documents do a good job of explaining the 'where and why' of synch registers when the enable chain is present, or when working with IO inside of a SCTL.  
    With regards to the stability of LabVIEW FPGA, I would second Daniel's sentiments. What about the known issues list conveys instability and risk? As a point of comparison, here are the known issues for ISE 14.x. 
    If you are looking to minimize risk, I would recommend developing the critical logic in the development enviroment in which you are comfortable setting up a comprehensive test bench since testing the code is the only way to truly verify its functionality. For me this would be LabVIEW FPGA as it has excellent trouble shooting tools and I've been developing in it for quite some time. Perhaps you're more familiar with ISE than LabVIEW FPGA and that is the source of your trepidation? If that is the case then you may find the High Performance FPGA Developers Guide a good read.  You may also find a few of the case studies on our website reassuring since they demonstrate other teams successfully implementing a solution using LabVIEW FPGA. Here's one that used LabVIEW FPGA in conjnction with VHDL IP similiar to what you are doing.
    National Instruments
    FlexRIO Product Support Engineer

  • Error in NI's 'Threshold 1-D array'?

    I was using this VI to find zero crossings and when I use one in my VI it seems to work fine. If I add a second only one of them works. It switches between which one actually works. I looked at the old version of the program that I am rewriting, it was written in LabVIEW 6i, and found a VI someone created that said it fixxed an error in teh Threshold 1-D array. My question is if this was known in 6i why wouldnt it be fixxed by now? Maybe other people havent came across this or I am just wrong. Just curious either way. I will attach the VI that claims to fix this problem
    Attachments:
    Threshold.vi ‏27 KB

    OK, the only known problem for "threshold array" is documented in the online help: "... and it might return incorrect data if threshold y is less than the value at start index". Does this apply to your data?
    I don't think it has anything to do with the number of calls on the diagram, but is an inherent limitation. The array must start with values below the desired threshold.
    Your "fixed" VI basically searches the array until the data goes from negative to positive, then starts the "threshold array" at the index of the last found negative value, ensuring that the limitation does not apply. For some reason it jumps through quite a few uneccessary hoops doing so. All the stuff with bundling is not needed, it does not make sense. I have included
    a cleaned-up version below. See if this works for you. (llb contains both VIs, I also did a few minor changes to the main vi for simplicity).
    As a more general comment, I think there might be better ways to determine a phase shift. How does your data typically look like? (e.g. amount of noise, presence of other frequencies, DC offsets, etc. all will cause serious problems with this simplistic approach).
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Not_NotWorking.llb ‏32 KB

  • Acquiring data in LabVIEW FPGA

    Hello,
    I am working on LabVIEW FPGA where I have to acquire data from a source and take its average. One way to do that is to keep adding every new signal to the sum f the older ones and then average.
    However, I wish to store all the incoming values into a file and save it. But when I tried doing so, it gives an error saying "array size cannot be changed". With this constraint, I am unable to write the data into an array.
    Please suggest.
    Thank you. 
    Dheeraj Bharadwaj
    IIT-Madras
    Solved!
    Go to Solution.

    You need to acquire data, pass it to the RT, then log there. You cannot use build array on the FPGA because FPGA will not allow for dynamically allocating memory like this. You must preallocate the array then use replace array subset. A better way is to use DMA FIFOs. Have a look at the FPGA examples in LabVIEW for streaming data. Then, on the RT, you can just add in your file logging functions.
    CLA, LabVIEW Versions 2010-2013

  • 1D Boolean Array to 1D Integer Array conversion for FPGA FIFO

    Hello, I am using a PXI7813R card. I would like to pass some data between the target (FPGA) vi and the host vi using the FIFO. I have a FIFO setup to 1023 "32 bit integer" samples. I have a boolean array of 32000 samples which would be the same as 1000 32 bit integers, that I acquired using the PXI7813R card.  I would like to convert the 1D boolean array to a 1D "32 bit intger" array. This seems like a more a difficult problem than I first thought as the labview functions are reduced when targetting a FPGA device. I have attached a jpg of how I would like to do it. I am getting a "Arrays must be fixed size in current target" error for the output from the array subset function. I know this is because one of the inputs is not exactly a constant, i.e. the index input  for array subset, but regardless of the index, I will only ever be taking 32 bits from the boolean array at any time to convert to a 32 bit integer to then place in the FIFO. Any suggestions of how I may get around this problem would be gratefully recieved. Regards, Michael.
    Message Edited by Michael_Limerick on 02-08-2008 04:54 AM
    Attachments:
    fifo_out1.JPG ‏52 KB

    Hi Daniel,
    Thanks for your reply.
    I had a look at the thread that you suggested and I'm not sure if that would solve the problem I was having, the option box was checked as default. I think my issue has to do with the limitations of the different LV functions when targeting a FPGA device.
    I have decided to take another route anyway, it seems that trying to compile a large array (even a 1D boolean array) for a FPGA target both takes a long time and also a lot of FPGA resources.
    Thanks again for your reply,
    Regards,
    Michael.

  • Split Int into bits in LabVIEW FPGA

    Is there a clever way of splitting an Uint32 into 32 directly accessable bits (not an aray) in LabVIEW FPGA?
    The only way I could come up with is the following, which is a pain write for 32bits, and seems kind of a waste og resources to store all these indexes.
    Regards, mola
    Solved!
    Go to Solution.

    I figured it out. I could use clusters by right-clicking the Array to Cluster block and increase the cluster size to 32.

  • How do I find out the exact path of each and every file that LabVIEW finds and loads into memory for a given top level vi?

    How do I find out the exact path of each and every file that LabVIEW finds and loads into memory for a given top level vi? There is probably a trivial, easy way to get this info, but I have not yet found it!  Thanks..

    Or if you want to grab all the paths programatically, try the attached VI.
    Open the top level that you want all the paths from and close all others, then open the
    attached and run it. It will return an array of all the VIs that the VI
    in question uses, including vi.lib VIs. You can filter these as well if
    you like.
    Ed
    Message Edited by Ed Dickens on 08-01-2005 07:01 PM
    Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
    Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
    Attachments:
    Get all paths.vi ‏29 KB

Maybe you are looking for