LabVIEW FPGA and CompactRIO Getting Started Tutorial

LabVIEW FPGA and CompactRIO Getting Started Tutorial

-

Documents
30 pages
Lire
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres

Description

LabVIEW FPGA and CompactRIO Getting Started Tutorial This hands-on session is an introduction to basic concepts and methods of setting up an NI CompactRIO system and programming with NI LabVIEW FPGA version 8.2 and higher. You will configure your CompactRIO system, create a new LabVIEW Project, and create a LabVIEW FPGA application from scratch that introduces basic programming concepts and basic features. In the field programmable gate array (FPGA) application, you will perform analog I/O and design custom trigger logic to control a digital output. Hands-On Summary • Introduce CompactRIO, LabVIEW Real Time, and LabVIEW FPGA • Learn how to setup and configure a CompactRIO system using the Measurement & Automation Explorer (MAX) • Create a LabVIEW Project to manage your FPGA, real-time processor and Windows host application code • Use shared variable Ethernet networking technology to easily communicate with your CompactRIO system • Create and compile an FPGA application to perform I/O and implement a custom trigger For more information on LabVIEW FPGA and CompactRIO, visit these pages: http://www.ni.com/fpga com/compactrio LabVIEW FPGA and CompactRIO Getting Started Tutorial Page 1 of 30 Table of Contents Recommended Hardware and Software.................................................................................................................................................................3 Using the Target Control ...

Sujets

Informations

Publié par
Nombre de visites sur la page 1 418
Langue English
Signaler un problème
LabVIEW FPGA and CompactRIO Getting Started Tutorial    This hands-on session is an introduction to basic concepts and methods of setting up an NI CompactRIO system and programming with NI LabVIEW FPGA version 8.2 and higher. You will configure your CompactRIO system, create a new LabVIEW Project, and create a LabVIEW FPGA application from scratch that introduces basic programming concepts and basic features. In the field programmable gate array (FPGA) application, you will perform analog I/O and design custom trigger logic to control a digital output.  Hands-On Summary   Introduce CompactRIO, LabVIEW Real Time, and LabVIEW FPGA   Learn how to setup and configure a CompactRIO system using the Measurement & Automation Explorer (MAX)  a LabVIEW Project to manage your FPGA, real-time processor and Windows host application codeCreate    shared variable Ethernet networking technology to easily communicate with your CompactRIO system Use    Create and compile an FPGA application to perform I/O and implement a custom trigger  For more information on LabVIEW FPGA and CompactRIO, visit these pages:  http://www.ni.com/fpga http://www.ni.com/compactrio   
 LabVIEW FPGA and CompactRIO Getting Started Tutorial
 
 
Page 1 of 30
Table of Contents 
  Recommended Hardware and Software.................................................................................................................................................................3 Using the Target Control Application to Turn on Power to the System..............................................................................................................4 Creating a New LabVIEW Project and Adding I/O..............................................................................................................................................5 Developing the LabVIEW FPGA Application ..................................................................................................................................................... 17 Compiling the FPGA Application ......................................................................................................................................................................... 26 Running the LabVIEW FPGA Application ......................................................................................................................................................... 29  
 LabVIEW FPGA and CompactRIO Getting Started Tutorial
 
 
Page 2 of 30
      Recommended Hardware and Software   Software   LabVIEW 8.2 Developer Suite Core  Deployment Option for NI Developer SuiteReal-Time and FPGA    NI-RIO Version 2.1 (or later) for R Series and CompactRIO Embedded Targets  Hardware   NI cRIO-9004 Real-Time Controller with 64 MB DRAM, 512 MB CompactFlash   NI cRIO-9104 8-Slot, 3 M Gate CompactRIO Reconfigurable Embedded Chassis   NI 9215 4-Channel, 100 kS/s, 16-bit, ±10 V Simultaneous Sampling Analog Input Module(Install in Slot 1)  kS/s, 16-bit, ±10 V, Analog Output ModuleNI 9263 4-Channel, 100 (Install in Slot 2)  NI 9401 8-Channel, 5 V/TTL High-Speed Bidirectional Digital I/O Module(Install in Slot 6) Or  NI cRIO-9004 Real-Time Controller with 64 MB DRAM, 512 MB CompactFlash   NI cRIO-9103 4-Slot, 3 M Gate CompactRIO Reconfigurable Embedded Chassis   NI 9215 4-Channel, 100 kS/s, 16-bit, ±10 V Simultaneous Sampling Analog Input Module(Install in Slot 1)  NI 9263 4-Channel, 100 kS/s, 16-bit, ±10 V, Analog Output Module(Install in Slot 2)  30 V, 1 µs, Sourcing Digital Output ModuleNI 9474 8-Channel 5 to (Install in Slot 4)  For help configuring your CompactRIO system and selecting accessories, use theCompactRIO Advisor.  Hardware Setup  Wire analog output channel 0 and COM from the cRIO-9263 in slot 2 to the AI0+ and AI0- terminals of the cRIO-9215 in slot 1 respectively (terminal 0 to terminal 0, terminal 1 to terminal 1).  See Also: Learn more about the NI CompactRIO reconfigurable embedded control and acquisition system Learn more about LabVIEW FPGA software  
 LabVIEW FPGA and CompactRIO Getting Started Tutorial
 Page 3 of 30
     Using the Target Control Application to Turn on Power to the System  Follow the instructions below to make sure your National Instruments CompactRIO and CompactDAQ systems are powered up.  
1. Double click theTarget Controlpower is turned on, confirm that the green on the desktop. To verify that system  )icon ( light is on. If the light is not on, click on thePower Controlbutton.  
 
 LabVIEW FPGA and CompactRIO Getting Started Tutorial
 
 
 
Page 4 of 30
     Creating a New LabVIEW Project and Adding I/O   In this section you will learn the following:  How to configure a CompactRIO embedded application in the LabVIEW Project Explorer  Auto-detection of the C Series I/O modules  How to develop, target, download, and run an application on the reconfigurable FPGA  1. LaunchNI LabVIEWby clicking on the desktop icon. click on the ThenReal-Time Projectlink to start a new LabVIEW project for your NI CompactRIO system.  
   LabVIEW 8.20 has a Real-Time Project Wizard that makes creating and configuring real-time applications easy. To help you get started, the wizard enables you to choose an appropriate programming architecture and automatically generates a software template application.   
2. To select the working folder for your project, click the folder ( ) icon, navigate toH:\VirtuaLab\CompactRIO and LabVIEW FPGA Getting Started Tutorial\Exercises, and then click theCurrent Folderbutton. Name your projectCustom Trigger. Keep all of the project defaults as shown below and click theNextbutton.
 LabVIEW FPGA and CompactRIO Getting Started Tutorial
 Page 5 of 30
   3. Change yourTarget ConfigurationtoTwo loops. Under theHost Configurationsection, check theInclude user interface box. Then clickNext.  
   The LabVIEW 8.20 Real-Time Project Wizard makes it easy to create a complete CompactRIO embedded system that includes an FPGA application, real-time processor application, and networked Windows host computer application. After this exercise is complete, you could use the template applications created by the wizard to create a complete networked system, including a deterministic loop running on the real-time controller to communicate with the FPGA and a lower-priority loop to performed network communication, file logging, or additional analysis.    LabVIEW FPGA and CompactRIO Getting Started Tutorial
 Page 6 of 30
  4. Click theBrowsenetworked target you configured in MAX. Expandbutton to find the Real-Time CompactRIOfolder and wait until your CompactRIO system is detected. Highlight your CompactRIO system and clickOK. Then clickNextto continue creating the real-time project.  
   5. Notice that the project wizard displays a preview of the project you configured. ClickFinishfinalize the creation of the newto real-time project and generate the application template code.  
 LabVIEW FPGA and CompactRIO Getting Started Tutorial
 Page 7 of 30
 
  When code generation is complete, two pre-built template applications will automatically open. The Windows host application (host - network - RT (separate).viCompactRIO system over the network, and a) includes a chart to plot the data sent by the stop -networkshared variable that is used to halt execution of the real-time embedded application running on the CompactRIO system.   
 LabVIEW FPGA and CompactRIO Getting Started Tutorial
 
 
Page 8 of 30
 
 
6. In thetarget - multi rate - variables.vireal-time processor application, navigate toWindow>>Show Block Diagram.
 LabVIEW FPGA and CompactRIO Getting Started Tutorial
 
 
Page 9 of 30
 
 This embedded processor application produces a simulated I/O signal and sends the data to the Windows host computer using network-published shared variables. You would place any time critical routines, such as code to interface with your FPGA application within the top deterministic loop. Any lower priority non-deterministic tasks such as data logging or additional analysis would be placed in the bottom lower priority loop.   7. Click theRun )button ( on the real-time processor application (target - multi rate - variables.vi). While the embedded application is being deployed, click the box next toClose on successful completionif it is not already checked.  
 LabVIEW FPGA and CompactRIO Getting Started Tutorial
 Page 10 of 30
 
  8. Click theRunbutton (on the Windows host application ( ) host - network - RT (separate).vi). View the sinusoidal waveform displayed on host application chart. Click theSTOPbutton on the host application and notice that the application stops running on both the host and real-time target.  
 
 As you can see, the shared variable networking technology introduced with LabVIEW 8 makes it very easy to communicate with your CompactRIO system over Ethernet. In this case, you are using the default NI Publish-Subscribe Protocol (NI-PSP). In addition to NI-PSP, CompactRIO natively supports a wide array of additional networking protocols such asModbus SerialandModbus Ethernet. You can also communicate with your CompactRIO system using TCP/IP, UDP, SMTP Email, CAN, RS-232 and more. To learn more, see theUsing the LabVIEW Shared Variable Tutorial.  LabVIEW FPGA and CompactRIO Getting Started Tutorial
 Page 11 of 30