GithubHelp home page GithubHelp logo

lvscriptfpgaioaccess's Introduction

Creating FPGA I/O nodes accessors by scripting

A limitation of LabVIEW FPGA coding is that FPGA I/O nodes assigments must be declared in the IDE at edit time. The functionality of reading from or writing to an I/O node, whose assigment is known only at runtime, is not supported. The question has been asked for instance here and here.

The only way to work around the limitation, and to achieve a sort of dynamical assigmnent at runtime, which I have found, would be to create gigantic case structures, in which the desired I/O terminal is picked up among all possible with the aid of an input selector.

AO FP AO BD AO FP AO FP AO FP

Creating such case structures is obviously tedious in the IDE by clicking and dragging, and VI scripting is called for. Unfortunately FPGA scripting is essentially unsupported and undocumented, and Elementary I/O nodes scripting (what is called here for), even less.

By mining and a lot of trial attempt, I managed to do it, though. This small project exemplifies how generic I/O accessor VIs can be created by means of undocumented LabVIEW scripting VIs (and a few tricks, like cutting and repasting an incomplete diagram in order to auto-fix what I haven't found other way to set correctly).

Instructions:

In the project scriptFPGAioSelectors.lvproj, I have added an FPGA target, in my case a PCIe-7852R. YMMV depending on LabVIEW version and its hardware support. You may have to ditch it and create it anew. If so, take care to create, inside the Target, virtual folders for all the I/O connectors you intend to use (right click New/FPGA I/O, and add Resources, checking Place new I/O in folders). I assumed that the default names (like Connector0/AI0 etc.) are left unchanged.

Now run MainScriptCreateAllIOselectors.vi. This will create four new VIS (or update them), and three enum typedefs. The generated VIS are the read and write case accessors for respectively all AI, all AO, all DI and all DO; the typedef'd enum controls allow to select the right case.

To use the generated VIs in real FPGA code, you'd want to duplicate them inside the FPGA target virtual folder.

Further comments are written on the BD of the various subVIs where relevant.

In the project I've also included a broken NoDynamicIOref.vi which exemplifies why things, unfortunately, cannot be coded the easy way.

The project has been created and tested on LabVIEW 2014 being the latest one supporting the legacy FPGA card of interest.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.