FPGA in Data Acquisition Using cRIO and LabVIEW
FPGA in Data Acquisition Using cRIO and LabVIEW
User Manual
Joanne Sirois and Joe Voelmle
Dr. Zalewski CDA 4104
May 2, 2009
Table of Contents
1.
Introduction...........................................................................................................................................3
2.
3.
4.
5.
2.1
Introduction...................................................................................................................................4
2.2
Introduction.................................................................................................................................10
3.2
Introduction.................................................................................................................................14
4.2
Conclusion..........................................................................................................................................20
References...................................................................................................................................................22
Appendix A.................................................................................................................................................23
Data Acquisition using the cRIO-9074 FPGA Modules.........................................................................23
Creating a VI for NI 9401...................................................................................................................23
Creating a VI using NI 9263...............................................................................................................32
Creating a VI using NI 9205...............................................................................................................34
Appendix B.................................................................................................................................................36
1. Introduction
The NI cRIO-9074 integrated system, shown in Figure 1, combines a real-time processor
and a reconfigurable field-programmable gate array (FPGA) within the same chassis for
embedded machine control and monitoring applications. It integrates a 400 MHz industrial
real-time processor with a 2M gate FPGA and has eight slots for NI C Series I/O modules.
This system features 128 MB of DRAM for embedded operation and 256 MB of nonvolatile
memory for data logging. [1]
The cRIO-9074 features two 10/100 Mb/s Ethernet ports that you can use to conduct
programmatic communication over the network and built-in Web (HTTP) and file (FTP)
servers as well as to add expansion and distributed I/O to the system. [1]
4. Expand RT CompactRIO Target, and expand FPGA Target. You will see the screen
show in Figure 5.
10
11
12
13
14
16
17
19
5. Conclusion
There were several difficulties that were encountered in the course of this project. The
most serious was the lack of availability of resources to use LabVIEW with cRIO and its
FPGA. There seems to be an abundance of information available on the Internet, but no clear
starting point at which a novice can begin. The problem was finally resolved by a phone call
to technical support at National Instruments to walk us through how to create simple VIs in
LabVIEW. However, much time was spent setting up this phone conversation. Days were
spent emailing back and forth to get answers to questions. The authors feel that a more timely
resolution would have been to have a field engineer on sight to conduct a tutorial in creating
LabVIEW VIs using cRIO. Appendix B lists an email detailing how National Instrument
support was used.
As the initial learning curve is overcome, many more substantial VIs can be developed
using CRIO. The rudimentary VIs developed in this report were to gain experience in using
cRIO within the LabVIEW environment. Basic signal acquisition was demonstrated, using
simple voltage sources. As confidence and knowledge is gained in using cRIO, more
substantial data acquisition using sophisticated VIs and advanced transducers should be
possible. Once cRIO and LabVIEW are mastered, it is the authors opinion that the design of
advanced data acquisition systems should possible in a much shorter period of time and with
less cost than traditional methods.
LabVIEW provides the user with the ability to integrate applications written in VHDL
code into a LabVIEW FPGA without having to recreate the application in LabVIEW. The
20
user can enter the code in LabVIEWs HDL Interface Node. This utility creates a LabVIEW
VI or function from the users code so that it can be used in the graphical programming
environment of a LabVIEW Block Diagram just like any other VI or function. This saves
development time by allowing the user to the user use proven VHDL code in their
application. More details are given in Importing HDL Code into FPGA VIs Using the HDL
Interface Node [7].
21
References
[1] NI cRIO-9074- Products and Services - National Instruments, National Instruments Corp,
Austin, TX, http://sine.ni.com/nips/cds/view/p/lang/en/nid/203964
[2] NI 9401 - Products and Services - National Instruments, National Instruments Corp, Austin,
TX, http://sine.ni.com/nips/cds/view/p/lang/en/nid/205926
[3] NI 9263 - Products and Services - National Instruments, National Instruments Corp, Austin,
TX, http://sine.ni.com/nips/cds/view/p/lang/en/nid/205923
[4] NI 9205 - Products and Services - National Instruments, National Instruments Corp, Austin,
TX, http://sine.ni.com/nips/cds/view/p/lang/en/nid/202571
[5] LabVIEW FPGA and CompactRIO Getting Started Tutorial, National Instruments Corp,
Austin, TX, http://www.ni.com/pdf/labview/us/fpga_compactrio_getting_started.pdf
[6] Getting Results with CompactRIO and LabVIEW, National Instruments Corp, Austin, TX,
2006, http://ftp.uniroma2.it/Natinst/support/ind_comm/manuals/371012c.pdf
[7] Importing HDL Code into FPGA VIs Using the HDL Interface Node, National Instruments
Corp, Austin, TX, 2008, http://zone.ni.com/devzone/cda/tut/p/id/3483
22
Appendix A
Data Acquisition using the cRIO-9074 FPGA Modules
Objective: Three basic programs will be developed to output 5V from the NI 9401,
output Frequency from NI 9263 and read an input voltage from NI 9205.
Background: The student is required to know:
Chapters 1 & 2 from LabVIEW Getting Started, as listed in Module #4 Student Activities.
23
24
3. In the next window (Figure A3), select either Discover existing system or Create
new system. We will pursue further with the former choice, Discover existing
system (It refers to the existing hardware). If you are sure that the cRIO device is
connected and has an IP address, then also select Device is connected to a remote
Subset and enter the devices IP address.
Figure A3 Create New CompactRIO FPGA Project Window- Discover existing system
25
4. When LabVIEW discovers cRIO, click Next on the next screen as shown in Figure
A4.
26
5. As a result, the screen in Figure A5 appears with the cRIO IP address. Click Finish
27
6. On the next screen, close the FPGA Wizard and expand the FPGA Target menu. A
screen shown in Figure A6 appears.
28
7. Right click on FPGA Target (Figure A6), select New and VI. A new VI Front Panel
appears (Figure A7).
29
30
10. In this node, right click Mod3/ DIO0 Change to Write and repeat it for DIO1,
DIO2, and DIO3
11. Now you need to use a While Loop. Right click in the Block Diagram, select
Structures, and then select While Loop, and drop into the Block Diagram, and expand
it to include the Mods node.
12. Inside while loop - Right Click Boolean - true constant, drop four of these in
while loop
13. Wire one true constant to one DIO input (See Figure A10)
14. Hover over step sign and right click Create Control, a Stop Button will appear and
the entire Block Diagram will look like Figure A10.
31
15. In Project Explorer (Figure A6), right click on Mod3 (Slot 3, NI 9401) and select
properties. Make sure that DIO 3:0 has Output in the drop down menu (Figure A11).
33
34
35
Appendix B
Date:Wed,1Apr200915:45:550500
From:[email protected]
Replyto:[email protected]
To:[email protected]
Subject:RE:(Reference#1348229)Fw:ProblemswithcRIOandFPGA
Note:Yourreferencenumberisincludedinthesubjectfieldofthis
message.Itisveryimportantnottoremoveormodifythisreference
number,oryourmessagemaybereturnedtoyou.
HiJoe,
Asdiscussedoverthephonetoday,wewillplantogooverthesettingof
thecRIOonthephoneonFriday,April3rdat1pmEST,12pmCST.
Pleaseletmeknowifyouwillberunninglateorcannotmakeitbyeither
emailingmebackorcallingin.
Thanks!
KarunyaRavindran
ApplicationsEngineer
NationalInstruments
http://www.ni.com/support
HelloKarunya,
Thankyouforwillingtoworkwithusonthisproblemoverthephone.
Weareavailabletomorrow,Friday,03/27,beginning9:30EST,till
around1:00pm.
Pleaseletusknowyourbesttimetocall,maybetwowindows,since
36
Allheaders
we'llbebusywiththeclassduringthistime.Thenwe'lldecideonthe
timingwhocallswhom.(Wedon'thaveatelephoneinthisroom,but
canuseoneofourcellphones.)
KindRegards,
Janusz
________________________________________
From:[email protected][[email protected]]
Sent:Wednesday,March25,20095:27PM
To:Zalewski,Janusz
Cc:[email protected];[email protected];Zalewski,Janusz;
JoanneSirois
Subject:RE:(Reference#1348229)Fw:ProblemswithcRIOandFPGA
Note:Yourreferencenumberisincludedinthesubjectfieldofthis
message.Itisveryimportantnottoremoveormodifythisreference
number,oryourmessagemaybereturnedtoyou.
HiJansuz,
Itmightbeeasiertotroubleshootthisoverthephonethanoveremail.If
thereisaphonenumberwhereIcangetintouchwithyoutotroubleshoot
overthephone,pleaseletmeknow.Oryoucangetintouchwithmeat
18662756964andreferenceyourservicerequestnumber.Thephonecall
willgetroutedtomeandmoveaheadwiththis.
37
Thanks!
KarunyaRavindran
ApplicationsEngineer
NationalInstruments
http://www.ni.com/support
HelloKarunya,
IwilltrytoansweryourquestionsasmuchasIcan:
>Thesofwareonthehostsystemisn'tasbigasaconcernasthesoftware
on
>thecRIOitself.WasthecRIOeverworkingproperly.
WenevertriedtouseitforaccessingtheFPGAorthemodulesplugged
intothechassis,soitthissenseitwasnevertested.Thisisthefirst
attempt.
>HowareyouconnectedtothecRIO?Areyouusingacrossovercableora
>networkswitch?Ifyouaren'tusingacrossovercable,pleaseconnectto
>thecRIOusingthatmethod.
ThecRIOboxisconnectedtothehostviatheEthernet,andIdon't
thinkwehavethecrossovercable.Thisishowwewanttouseit:
accessibleviatheIPaddress.
>Areyouabletoinstalloruninstallanysoftwareatall?
38
Ithinkwedid.Joanne,couldyouprovidemoredetails?
>HaveyoutriedformattingthecRIOonce?Pleaseensurethatyouhave
access
>tothesoftwareonthecRIObeforeyoudecidetoformatthecRIO.
NotsurewhatyoumeanbyformattingcRIO?Neverdonethat,Ithink.
Overall,I'dsaythatwearenotgoinganywherewiththis,since
thereistoomanyunknownstoushere.Isthereachancesome
NationalInstrumentstechnicianorsupportpersoncancomehere
tocheckonit?
ThanksandKindRegards,
JanuszZalewski
________________________________________
From:[email protected][[email protected]]
Sent:Friday,March20,20092:02PM
To:JoanneSirois
Cc:[email protected];Zalewski,Janusz
Subject:Re:(Reference#1348229)Fw:ProblemswithcRIOandFPGA
Note:Yourreferencenumberisincludedinthesubjectfieldofthis
message.Itisveryimportantnottoremoveormodifythisreference
number,oryourmessagemaybereturnedtoyou.
39
HiJoanne,
IjusthaveafewquestionsontheworkingsonyourcRIO.
Thesofwareonthehostsystemisn'tasbigasaconcernasthesoftwareon
thecRIOitself.WasthecRIOeverworkingproperly.
HowareyouconnectedtothecRIO?Areyouusingacrossovercableora
networkswitch?Ifyouaren'tusingacrossovercable,pleaseconnectto
thecRIOusingthatmethod.
Areyouabletoinstalloruninstallanysoftwareatall?
Forexample,whenyouselectthecRIOinMAX,Rightclickonsoftware,
selectAdd/Removesoftware,andselectcustominsall,doesitinstantly
disconnect?DoestheSystemStatesaydisconnectedwhenyouexitofthethe
softwarewindow.
Iwouldliketoknowwhenexactlythedisconnecthappens.Usingacross
overcabletoconnectthecRIOtothehostsystemshouldeliminatethis
problem.
HaveyoutriedformattingthecRIOonce?Pleaseensurethatyouhaveaccess
tothesoftwareonthecRIObeforeyoudecidetoformatthecRIO.
Pleaseletmeknowtheresultsofthis.
KarunyaRavindran
ApplicationsEngineer
NationalInstruments
40
http://www.ni.com/support
Hello,
WhenIselectaddandremovesoftwarecRIOdisconnects.SoInevergetthe
optionfor
custominstallation.
Ididaprintscreenofthesoftwarethatisinstalledandversionnumbers
ofthehost
computer.(Attached)
JoanneSirois
OnWed,18Mar200912:40:020500,supportwrote
>Note:Yourreferencenumberisincludedinthesubjectfieldofthis
>message.Itisveryimportantnottoremoveormodifythisreference
>number,oryourmessagemaybereturnedtoyou.
>
>HelloJoanne,
>
>SinceKarunyaisleadingacustomertrainingtoday,Iwantedtoreplyto
>youonherbehalf.
>
41
>TheVariableClientsupportdoesneedtobeinstalledonthecontroller,
>andtheversionsometimesdoesmatter.Iamnotsurewhichversionof
>LabVIEWandLVRealTimethatyouhave,soIcannotanswerthisquestion
>forsureyet.WhatIsuggestthatyoudo,iswhenyouareconnectedto
>yourhostcomputer,openMAXandrightclickSoftwareunderneathyour
>RemoteSystemstarget,andselectAdd/RemoveSoftware.Selecttheoption
>forcustomisntallation,andensurethatthelatestversionoftheNIRIO
>driverandtheRTcomponentsfromyourhostcomputer(suchasVariable
>ClientSupport&VariableEngine)areselectedforisntallationonthe
>CompactRIO.
>
>Incaseyourunintoanyissues,pleaseletusknow,andalsotellus
what
>theversionsofsoftwareonyourhostcomputerandtargetare.
>(Screenshotsmaybehelpfulhere).
>
>Thanks.
>
>Regards
>
>KamalinaSrikant
42
>ApplicationsEngineer
>NationalInstruments
>
http://www.ni.com/support
>
>
>
>Karunya,
>
>BothVariableClientSupportandNetworkvariableareinstalledalthough
>theyare
>
>version1.4.0insteadof1.5.0
>
>Wouldthatcauseaproblem?
>
>Thankyou,
>
>JoanneSirois
43
>
>OnThu,12Mar200915:00:550500,supportwrote
>
>>Note:Yourreferencenumberisincludedinthesubjectfieldofthis
>
>>message.Itisveryimportantnottoremoveormodifythisreference
>
>>number,oryourmessagemaybereturnedtoyou.
>
>>
>
>>HiJanusz,
>
>>
>
>>Thankyouforgettingintouchwithsupport.MynameisKarunya
Ravindran
>
>>andIwillbehelpingyouwiththisissue.
44