labviewforRaspi edited this page Feb 7, 2017 · 40 revisions

Raspberry Pi Compatible Compiler for LabVIEW

Introduction

The Raspberry Pi Compatible Compiler for LabVIEW is a product based on LabVIEW (Laboratory Virtual Instrument Engineering Workbench) by National Instruments. LabVIEW is a graphical programming language that uses icons instead of lines of text to create applications. In contrast to text-based programming languages that use instructions to determine the order of program execution, LabVIEW uses dataflow programming. In data flow programming, the flow of data through the nodes on the block diagram determines the execution order of the VIs and functions. VIs, or virtual instruments, are LabVIEW programs that imitate physical instruments. This document assumes basic familiarity with LabVIEW. For more information about LabVIEW, visit www.ni.com/labVIEW.

The Raspberry Pi Compatible Compiler for LabVIEW is a true compiler product that allows one to compile, deploy and run stand alone, full fledge LabVIEW applications embedded in Raspberry Pi targets. All flavors of official Raspberry Pi (or RasPi for short) single board computer boards released by the Raspberry Pi organization are supported. However, performance differences may be noticed based on which version of Pi is selected and the complexity of the LabVIEW VI downloaded. The Raspberry Pi is a single board computer; therefore, the same performance considerations are valid in the selection of regular computers to run LabVIEW applications. The Raspberry Pi boards that have higher horse power CPUs and more RAM memory will outperform their counterparts with lower end CPUs and less RAM memory. As an example, the Raspberry Pi 2 Model B will outperform its older brother, the Raspberry Pi 1 Model B+. The former includes a 900MHz quad-core Arm Cortex-A7 CPU and 1GB of RAM memory while the latter is powered by a 700MHz single-core ARM11 CPU and 512M of RAM memory. Another point that is fundamental to highlight is that the Raspberry Pi Compatible Compiler for LabVIEW requires the RasPi target to have an Ethernet/Wifi port and an IP address for communication with the host development computer for initial download of the compiled VI. Once the download is complete, the RasPi can operate standalone and disconnected from the network. Furthermore, the setup of the RasPi, as it will be seen in a future section, requires the RasPi to have Internet access, so all the correct packages can be installed upon execution of the setup script. This requirement doesn’t constraint the use of the compiler with RasPi boards that include an Ethernet port as part of the board. The user is free to elect using any Raspberry Pi, as long as it has Ethernet connectivity. As an example, the user can setup a Raspberry Pi Zero with an Ethernet to USB dongle.

The Raspberry Pi Compatible Compiler for LabVIEW product works in combination with any of the available editions of LabVIEW for Windows; Base, Full, Professional and Home. The oldest version of LabVIEW supported will be LabVIEW 2014. One doesn’t need to have the LabVIEW Application Builder installed on the machine, which allows the use of both the LabVIEW Base and Home editions. The compiler also allows the compilation of full GUIs or Console Application. Refer to the section named Supported Compilation Types for more information on the differences between the two compilation types.

Refer to the bottom of this document for a list of known Exceptions/Issues with the Compiler

What you Need to Get Started

The list below shows everything you will need in order to get started:

  • A Raspberry Pi board with Ethernet/Wifi connectivity resources
  • A SD Card (minimum 8GB) loaded with the image made available at the Code area of this repository (refer to the section named How to Setup the SD Card for more information about this step)
  • The power supply required by your specific RasPi board. A 5V/2A power supply is a safe bet for all flavors of RasPi
  • Either a SD Card USB Adapter or some other way to download the image to the SD Card
  • A Windows development computer running any edition of LabVIEW as described by the previous section
  • HDMI cable to connect your RasPi to a monitor. One of the cable connectors must be HDMI to be connected to the RasPi, the other connector end can be of a matching type of the monitor input connector.
  • A regular computer monitor with input connector matching the side of the HDMI cable that is not to be connected to the RasPi
  • USB keyboard and USB Mouse

How to Setup the SD Card

The first step in getting your RasPi target ready for the compiler is to get the correct Operating System to the SD Card. This section describes the steps you will need to follow.

  1. Download the latest Raspberry Pi image from this Google Drive link. Even though the official Raspberry Pi PIXEL Operating System is maintained untouched in that image, all the necessary support packages have been installed and properly configured so your Raspberry Pi is ready to receive compiled LabVIEW code. We will not provide support if you decide to update your Pi's operating system via sudo update. We will do our best to release updated images as the Raspberry Pi organization updates the released OS.

  2. Unzip the file to a directory in your computer

  3. The next step is to install the Operating System Image to the SD Card. Follow the instructions shown on this link: https://www.raspberrypi.org/documentation/installation/installing-images/windows.md

  4. Once the Win32DiskImager utility completes its process, the SD card is ready to be connected to the RasPi board

Setting up The RasPi

Now that the SD Card contains the Operating System, it is time to connect the RasPi. The below shows the steps to be followed to make sure the RasPi target is setup.

  1. Connect the SD Card to the RasPi board’ SD Card slot

  2. Connect the RasPi to the monitor via the HDMI cable

  3. Connect USB keyboard and USB mouse to two USB ports in your RasPi

  4. Plugin the Power Supply to the RasPi connector and to the electrical outlet

  5. Turn on the monitor

  6. Once the RasPi finishes booting, you will be directed to the graphical portion of the Operating System. The first thing to make sure is that an IP address was assigned to your RasPi. The easiest way to do that is by hovering over (not clicking) the network connection icon on the top right corner of the screen. The IP address assigned to your RasPi will popup. Write down the IP address as you will need it to configure your RasPi target on the compiler application

  7. Make sure the file system has been expanded on your Pi. In order to extend the file system, open a command terminal and type the following command: sudo raspi-config This will open the Raspberry Pi Software Configuration Tool. Select option 1. Expand Filesystem. Reboot the Pi when prompted

  8. Once your Pi finishes rebooting; try to ping your Pi's IP from your development machine to make sure the network connectivity is correctly setup

  9. That's it! Your Pi is all setup at this point and ready for your first LabVIEW deployment from the Raspberry Pi Compatible Compiler for LabVIEW

IMPORTANT 1: WE HAVE MADE SURE A GIVEN LINUX DISTRIBUTION AND CORRESPONDING SUPPORT PACKAGES WORKS WITH THE COMPILER. THAT'S WHY WE HAVE MADE AVAILABLE THE FULL IMAGE FOR DOWNLOAD. THEREFORE, WE WILL NOT SUPPORT ISSUES THAT MAY ARISE IN CASE YOU DECIDE TO UPDATE YOUR PI'S OPERATING SYSTEM.

IMPORTANT 2: PLEASE MAKE SURE YOU CHANGE THE PASSWORD OF YOUR PI ONCE YOU FINISH THIS PORTION OF THE SETUP. THIS OBVIOUSLY WON'T AFFECT THE FUNCTIONALITY OF THE COMPILER, HOWEVER, YOU WANT TO MAKE SURE YOU DON'T MAKE YOUR NETWORK VULNERABLE TO A POTENTIAL CYBER THREAT BY LEAVING THE KNOWN PUBLIC PI ACCOUNT PASSWORD ON YOUR PI.

Installing the Raspberry Pi Compatible Compiler for LabVIEW

A NOTE TO LABVIEW 2016 USERS: MAKE SURE YOU ARE USING THE LATEST VERSION OF VI PACKAGE MANAGER (2016 SP1), OTHERWISE THE COMPILER WILL NOT PROPERLY INSTALL ON YOUR LABVIEW 2016.

You will see two VI Package Manager (VIPM) files on the same Code section of this repository where you downloaded the Raspberry Pi image. One with a Home suffix and the other with a Standard suffix; the former includes is the Home edition and the latter the Standard Edition. The two editions have no functionality differences, however, the Compiler License Agreement states the Home edition is to be used only for Home/Academic projects. If a project is for profit, or any sort of commercial application, the Standard edition is required. Make sure to review the details of the Compiler License Agreement to familiarize yourself with the complete terms and conditions for use. The License File is installed along with the Raspberry Pi Compatible Compiler for LabVIEW VIPM package and can also be downloaded from the Code section of this repository.

Once you downloaded the appropriate edition of the Compiler, simply double click on the VIPM file to launch VIPM and start the LabVIEW installation process. IT IS IMPORTANT THAT YOU SELECT THE CORRECT EDITION FILE, OTHERWISE YOUR LICENSE ACTIVATION WILL FAIL.

Once VIPM completes the installation, a new item on the LabVIEW Tool Menu named Raspberry Pi Compatible Compiler for LabVIEW will be available. This is the main compiler application you will use to compile and download VIs to your Raspberry Pi. More information on all available features of the Raspberry Pi Compatible Compiler GUI is available on the document named Raspberry Pi Compatible Compiler GUI.pdf included in the Code section of this repository. Make sure to go through that document prior to start your own development. The goal for this page is to get your system setup and running, making sure your environment will be ready for development.

AT THIS POINT, IF YOU HAVEN'T ALREADY DONE SO, PLEASE MAKE SURE TO GO THROUGH THE DOCUMENT NAMED RASPBERRY PI COMPATIBLE COMPILER FOR LABVIEW.PDF LOCATED ON THE SOURCE SECTION OF THIS REPOSITORY

As a reminder, as listed in the License Agreement document, each license is single user. What that means is that it is good for a single developer. However, the same developer can activate the Compiler in three machines, as long as it is for this same user.

Deploying your First LabVIEW VI to the Raspberry Pi

Once you click on the item named Raspberry Pi Compatible Compiler for LabVIEW on the LabVIEW Tools menu, the Raspberry Pi Compatible Compiler for LabVIEW GUI will launch. Click on its File Menu, then select Examples->Hello World menu items. Under Hello World there will be a single example VI named HelloWorldGUI.vi. Open that example VI and inspect the VI. It is a very simple example VI with the only objective of testing your environment. Once you are comfortable with the example VI functionality, select your Raspberry Pi target from the list of targets and click on the Compile and Download icon to deploy that example VI. Note the message displayed on the Status indicator. If successful, you can switch to your Pi target and run that VI.

At the Raspberry Pi target, navigate to the directory /usr/local/RPiCCLV/. On that directory, you should see a file named HelloWorldGUI.pyzw. To run the VI type the command: sudo ./HelloWorldGUI.pywz &

Don't forget the "&" character on the command line. This will open the deployed VI's front panel. Click on its run button and you will be able to interact with the deployed VI.

Important: If you plan on running your deployed LabVIEW on the Pi using a SSH connection from a remote machine, make sure to setup X11 forwarding from your Pi to your development machine. This link is a good one if you are using Putty for your SSH, but this is a fairly easy to find Google topic for other SSH clients. If you fail to do that, you may see an error that will look like "_tkinter.TclError: no display name and no $DISPLAY environment variable". This link has a good explanation as to why you need to do that.

That's it! If you came this far without a hiccup, your environment is all setup and ready for your creativity. However, make sure to continue on reading through this document to make sure you understand all supported LabVIEW primitives included on this release, as well as the documented exceptions of regular LabVIEW behavior that we weren't able to replicate on the Pi. Also, it is extremely important you also ready through the document named Raspberry Pi Compatible Compiler GUI.pdf included in the Code section of this repository in order to become familiar with all features available on this release of the compiler.

Configuring Properties of the Deployed VI Front Panel

Once the LabVIEW has been successfully compiled and downloaded to the Raspberry Pi target, it is possible to tweak a few properties of the LabVIEW front panel. By clicking at File->Save menu item on the deployed LabVIEW front panel VI, a configuration file of the same name as the deployed VI and extension .cfg is created in the same directory where the deployed VI resides.

One can edit the currently supported parameters from that file to change the look at feel of the deployed front panel. Currently, the only supported parameters are the front panel size and position. By typing sudo nano VIname.cfg, where VIName is the name of your deployed VI, the Nano text editor will open and show the following general format:

[front panel] size = Y x Z position = X

One can freely change these parameters and notice the front panel changes as a result of such modifications.

Supported Functions Version 1.0.0.10

Block Diagram Functions

  • Array

    • Build Array
    • Index Array
    • Array Size
    • Initialize Array
    • Array Subset
    • Array Max & Min
    • Reshape Array
    • Sort Array
    • Search Array
    • Split Array
    • Reverse Array
    • Rotate Array
    • Interleave Arrays
    • Decimate Array
    • Transpose Array
    • Delete From Array
    • Replace Array Subset
    • Add Array Elements
    • Multiply Array Elements
    • Threshold 1D Array
    • Interpolate 1D Array
  • Boolean

    • And
    • Or
    • Xor
    • Not
    • Nand
    • Nor
    • Nxor
    • Implies
    • And array elements
    • Or array elements
    • Number to Boolean array
    • Boolean to 0,1
  • Cluster

    • Unbundle By Name
    • Unbundle
    • Bundle By Name
    • Bundle
  • Comparison

    • Equals
    • Not Equals
    • Greater Than
    • Greater Than Or Equal
    • Less Than
    • Less Than Or Equal
    • Equal to Zero
    • Not Equal to Zero
    • Greater Than Zero
    • Greater Than Or Equal To Zero
    • Less Than Zero
    • Less Than Or Equal To Zero
    • Max & Min
    • Select
    • Empty Array
    • Empty String
    • Not A Number
    • In Range And Coerce
    • Lexical Class
  • Dialog & User Interface

    • One Button Dialog
    • Two Button Dialog
    • Clear Errors
    • Merge Errors
    • Simple Error Handler
    • Wait For Front Panel Activity
  • Math Functions

    • Hyperbolic Functions
      • Hyperbolic sine
      • Hyperbolic cosine
      • Hyperbolic tangent
      • Arc Hyperbolic sine
      • Arc Hyperbolic cosine
      • Arc Hyperbolic tangent
      • Hyperbolic secant
      • Arc Hyperbolic_secant
      • Hyperbolic cosecant
      • Arc Hyperbolic_cosecant
      • Hyperbolic cotangent
      • Arc Hyperbolic cotangent
    • Exponential Functions
      • Exp
      • Exp minus 1
      • Power of 2
      • Power of X
      • Ln
      • Log10
      • Log2
    • Probability & Statistics
      • Mean
      • Std Deviation and Variance
      • Median
      • RMS
    • Trigonometric Functions
      • Sine
      • Cosine
      • Tangent
      • Arcsine
      • Arccosine
      • Arctangent
      • Arctangent2
      • Secant
      • Arcsecant
      • Cosecant
      • Arccosecant
      • Cotangent
      • Arccotangent
      • Sinc
      • Sine and cosine
  • Queue Functions

    • Obtain Queue
    • Enqueue Element
    • Enqueue Element At Opposite End
    • Lossy Enqueue Element
    • Dequeue Element
    • Flush Queue
    • Release Queue
  • Networking

    • IP to String
    • String To IP
    • UDP Functions
      • UDP Open
      • UDP Multicast Open (this will only work for the Pi 2 for this release)
      • UDP Multicast Read Open (this will only work for the Pi 2 for this release)
      • UDP Multicast Write Open (this will only work for the Pi 2 for this release)
      • UDP Multicast ReadWrite Open (this will only work for the Pi 2 for this release)
      • UDP Read
      • UDP Write
      • UDP Close
    • TCP Functions
      • TCP Open
      • TCP Close
      • TCP Read
      • TCP Write
      • TCP Create Listener
      • TCP Wait On Listener
  • Numeric

    • Add
    • Subtract
    • Multiply
    • Divide
    • Abs
    • Round
    • Round plus infinity
    • Round minus infinity
    • SquareRoot
    • Square
    • Negate
    • Reciprocal
    • Sign
    • Random
    • Quotient & Remainder
    • Increment
    • Decrement
    • Conversion
      • To Extended Precision Float
      • To Double Precision Float
      • To Single Precision Float
      • To Quad Integer
      • To Long Integer
      • To Word Integer
      • To Byte Integer
      • To Unsigned Quad Integer
      • To Unsigned Long Integer
      • To Unsigned Word Integer
      • To Unsigned Byte Integer
      • String to Byte Array
      • Byte Array to String
      • To Time Stamp
    • Data Manipulation
      • Type Cast
      • Flatten to String (this primitive is not showing on the Compiler custom palette due to a VIP bug, however you can pull it from the regular LabVIEW Data Manipulation palette)
      • Unflatten from String (this primitive is not showing on the Compiler custom palette due to a VIP bug, however you can pull it from the regular LabVIEW Data Manipulation palette)
      • Mantissa and Expoent
      • Rotate Left with Carry
      • Rotate Right with Carry
      • Logical Shift
      • Rotate
      • Split Number
      • Join Numbers
      • Swap Bytes
      • Swap Words
  • String Functions

    • String Length
    • Concatenate Strings
    • String Subset
    • Replace Substring
    • Trim Whitespace
    • To Upper Case
    • To Lower Case
    • Array To Spreadsheet String
    • Spreadsheet String To Array
    • Match Pattern
    • Search And Replace String
    • Format Into String
    • Scan From String
    • Path/Array/String Conversion
      • String To Byte Array
      • Byte Array To String
      • Path To Array Of Strings
      • Array Of Strings To Path
      • Path To String
      • String To Path
    • Number/String Conversion
      • Number To Decimal String
      • Number To Hex String
      • Number To Octal String
      • Number To Fractional String
      • Number To Exp String
      • Format Value
      • Decimal String To Number
      • Hexadecimal String To Number
      • Octal String To Number
      • Fractional String To Number
  • File I/O

    • Build Path
    • Strip Path
    • Read From Text File
    • Write To Text File
    • Open File
    • Close File
    • Advanced File Functions
      • Get File Position
      • Get File Size
      • Set File Size
      • Set Fil ePosition
      • Move File
      • Copy File
      • Delete File
      • Create Folder
      • List Folder
      • Refnum To Path
      • Path Type
  • Synchronization

    • First Call?
  • Timing

    • Tick Count
    • Wait
    • Wait Until Next Ms Multiple
    • Get Date Time String
    • Get Date Time in Seconds
    • Date Time to Seconds
    • Format Date Time String
    • Seconds To Date Time
  • VISA Functions

    • Configure Serial Port
    • VISA Read
    • VISA Write
    • VISA Close
    • VISA Serial Break
  • Raspberry Pi API Functions

    • GPIO Functions
      • Add Event Detect
      • Configure Channel
      • Configure Channels
      • Event Detected
      • Get Pin Numbering
      • Read Channel
      • Remove Event Detect
      • Set Pin Numbering
      • Wait For Edge Single
      • Wait For Edge Multiple
      • Write Channel
      • Write Channels Multiple
      • Write Channels Single
      • Configure PWM
      • Start PWM
      • Stop PWM
      • Change Frequency
      • Change Duty Cycle
    • I2C Functions
      • I2C Open
      • I2C Close
      • I2C Busses
      • I2C Detect
      • I2C Read Block Data
      • I2C Read Byte
      • I2C Read Byte Data
      • I2C Read Word Data
      • I2C Write Byte
      • I2C Write Block Data
      • I2C Write Byte Data
      • I2C Write Word Data
      • I2C Write Quick
    • SPI Functions
      • SPI Open
      • SPI Close
      • SPI Get Chip Select Active State
      • SPI Get Max Speed
      • SPI Get Mode
      • SPI Get Three Wire
      • SPI Read Bytes
      • SPI Set Chip Select Active State
      • SPI Set Max Speed
      • SPI Set Mode
      • SPI Set Three Wire
      • SPI Transaction
      • SPI Transaction2
      • SPI Write Bytes
    • Console Functions
      • Console Print
      • Console Input

Front Panel Controls

Modern Controls

   - Numeric 
       - Numeric control
       - Numeric indicator
       - Knob
       - Dial
       - Vertical Progress Bar
       - Vertical Graduated Bar
       - Horizontal Progress Bar
       - Horizontal Graduated Bar

   - Boolean
       - Push Button
       - Rocker
       - Vert Rocker
       - Round LED
       - Square LED
       - Horizontal Toggle Switch
       - Vertical Toggle Switch
       - Slide Switch
       - Vertical Slide Switch
       - Ok Button
       - Cancel Button
       - Stop Button

   - String & Path
       - String Control
       - String Indicator
       - Combo Box
       - File Path Control
       - File Path Indicator

    - Array & Cluster
       - Array
       - Cluster

    - Graph
       - Waveform Graph
       - Waveform Chart

    - Containers
       - Tab Control

System Controls

    - Numeric
       - System Numeric
       - System Spin Control
       - System Vertical Slide
       - System Horizontal Slide
       - System Vertical Pointer Slide
       - System Vertical Horizontal Slide

    - Boolean
       - System Button
       - System Cancel Button
       - System Check Box
       - System Radio Button

    - String & Path
       - System String
       - System Combo Box

    - Ring & Enum
       - System Ring
       - System Enum

    - Container
       - System Tab Control

Classic Controls

    - Boolean
       - Square Button
       - Flat Square Button
       - Classic Square LED
       - Square Light
       - Classic Checkbox
       - Round Button
       - Classic Round LED
       - Round Light
       - Square Radio Button
       - Round Radio Button
       - Vertical Switch
       - Horizontal Switch
       - Classic Vertical Toggle Switch
       - Classic Horizontal Toggle Switch
       - Labeled Square Button
       - Labeled Round Button
       - Labeled Rectangular Button
       - Labeled Oblong Button
       - Rectangular Stop Button
       - Round Stop Button
       - LED Button
       - Square Push Button
       - Round Push Button
       - Classic Vertical Slide Switch

   - String & Path
       - Classic String Control
       - Classic String Indicator
       - Simple String
       - Classic Combo Box

   - Array & Cluster
       - Classic Array
       - Classic Cluster

   - Container
       - Classic Tab Control
  • Free Labels

Current List of Exceptions Between Regular LabVIEW and the RasPi Compiler

  • If deployed Cluster on a VI Front Panel is cuttoff, make sure to turn Autosizing off on the source VI Cluster Control
  • The Multicast LabVIEW primitives included in this release only work for the Raspberry Pi 2
  • Waveform Graph and Chart currently supports a single plot. Including support for multiple plots is part of the roadmap and will become available at a later release
  • Build Array and Shift Registers: There is currently an issue with um-branched output of the build array function if routed to a SR. The temporary workaround is to branch the output. Either to an indicator or another innocuous array function like an Index Array.
  • No front panel custom controls
  • Decimal Number to String Function doesn't currently work with input arrays. As a workaround, wrap it around with a FOR loop so the input of the function is back as a scalar number. Index the input array and the output string so it creates the output string array
  • The front panel objects have limited properties that can be changed at the moment. Stay away from enabling extra visible items, especially the ones that draw new pictures (scrollbar, numeric display, etc) on the front panel
  • Graphs/Charts are single plot for the time being

Support

Support inquiries can be made at our support forum https://www.tsxperts.com/forums/forum/raspberrypiforlabviewforum/raspberry-pi-compatible-compiler-for-labview-support-forum/ (recommended) or through the following e-mail address: lvforpisupport@tsxperts.com.

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.