fpga module how-to - documentation.help · labview fpga module installed. communicating with fpga...
TRANSCRIPT
FPGAInterfaceJune2008,371107E-01TheFPGAInterfaceprovidesprogrammingfeaturesandfunctionstohelpyoucommunicatewithVIsorbitfilesthatrunonNationalInstrumentsFPGAtargets,suchasNationalInstrumentsReconfigurableI/O(NI-RIO)devices.TheVIthatrunsontheFPGAtargetiscalledtheFPGAVI.TheVIyouusetocommunicatewithFPGAVIsorbitfilesiscalledthehostVI.ThehostVIcanrunonPCsorRTtargets.TheFPGAInterfaceisavailablewithFPGAtargetdriversoftware.YoucanusetheFPGAInterfacefunctionsinahostVIifyouhaveanFPGAtargetandtheappropriatedriversoftware.YoudonotneedtheLabVIEWFPGAModuletousetheFPGAInterfacefunctions.YouneedtheFPGAModuleifyouwanttodevelopFPGAVIs.
Toviewrelatedtopics,clicktheLocatebutton,shownatleft,inthetoolbaratthetopofthiswindow.TheLabVIEWHelphighlightsthistopicintheContentstabsoyoucannavigatetherelatedtopics.
©2003–2008NationalInstrumentsCorporation.Allrightsreserved.
UsingLabVIEWFPGAInterfacewithouttheFPGAModule(FPGAInterface)IfyouhaveanFPGAtarget,youcanusetheLabVIEWFPGAInterfaceVIsandfunctionstointerfacewithanFPGAbitfileevenifyoudonothavetheLabVIEWFPGAModuleinstalled.UsetheOpenFPGAVIReferencefunctiontoopenareferencetotheFPGAbitfile.YouthencanuseotherFPGAInterfacefunctions,suchasRead/WriteControl,InvokeMethod,andCloseFPGAVIReference,tointerfacewiththeFPGAbitfile.
NoteYoucanuseanuncompiledFPGAVIonlyifyouhavetheLabVIEWFPGAModuleinstalled.
CommunicatingwithFPGAVIs(FPGAInterface)ThisbookprovidesfunctionsandproceduresthatenablehostVIstocommunicatewithFPGAVIs.
Toviewrelatedtopics,clicktheLocatebutton,shownatleft,inthetoolbaratthetopofthiswindow.TheLabVIEWHelphighlightsthistopicintheContentstabsoyoucannavigatetherelatedtopics.
OpeningaReferencetoanFPGAVI(FPGAInterface)YoucancommunicatewithFPGAVIsorbitfilesrunningonFPGAtargetsusinghostVIs.HostVIscanrunonPCsorRTtargets.EachhostVImustopenareferencetotheFPGAVIorbitfilethatrunsontheFPGAtarget.YoucanopenareferencetoanFPGAVIinthesameLabVIEWprojectasthehostVI,oryoucanopenareferencetoabitfile.
NoteIfyouwanttoopenreferencestodifferentFPGAVIsorbitfilesononetarget,openonlyonereferenceatatime,andclosethereferencebeforeopeninganother.YoucanhavemorethanoneFPGAVIreferencesimultaneouslyopenonatarget,aslongasallthereferencescorrespondtothesameFPGAVIorbitfileonthesametarget.
TipTomakehostVIdevelopmentfaster,keeptheFPGAVIinmemory.
OpeningaReferencetoanFPGAVICompletethefollowingstepstoopenareferencetoanFPGAVIinahostVI.YoucanopenareferencetoanFPGAVIifthehostVI,theFPGAtarget,andtheFPGAVIareinthesameproject.YoucannotopenareferencetoanFPGAVIifyoudonothavetheLabVIEWFPGAModuleinstalled.
1. Createanewprojectoropenanexistingproject.2. AddanFPGAtargettotheprojectorverifytheFPGAtarget
appearsintheProjectExplorerwindow.3. CreateanewFPGAVIorverifytheFPGAVItowhichyouwant
toopenareferenceappearsintheProjectExplorerwindowundertheFPGAtarget.
4. CreateanewhostVIoropenanexistinghostVIintheproject.ThehostVImustbeunderMyComputeroranRTtargetintheProjectExplorerwindow.
5. PlaceanOpenFPGAVIReferencefunctionontheblockdiagram.
Place Find6. DragtheFPGAVIyouwanttoopenareferencetofromthe
ProjectExplorerwindowtotheOpenFPGAVIReferencefunction.TheFPGAVIiconappearsintheOpenFPGAVIReferencefunction.IftheFPGAtargetintheprojectisassociatedwithaphysicaltarget,thetargetnameandresourceappearsundertheOpenFPGAVIReferencefunction.
7. (Optional)Right-clicktheOpenFPGAVIReferencefunctionandselectConfigureOpenFPGAVIReferencefromtheshortcutmenutodisplaytheConfigureOpenFPGAVIReferencedialogbox,whichyoucanusetoselectoptionsforopeningthereference.
8. (Optional)WireacontrolorconstanttotheresourcenameinputontheOpenFPGAVIReferencefunctiontospecifyanFPGAtargetonwhichtoruntheFPGAVI.
NoteYoumustplaceandwireaCloseFPGAVIReferencefunctionforeveryOpenFPGAVIReferencefunctioninahostVI.
OpeningaReferencetoaBitfileCompletethefollowingstepstoopenareferencetoabitfileinahostVI.ThehostVIdoesnotneedtobeinaproject.
1. CreateanewhostVIoropenanexistinghostVI.IfthehostVIisinaproject,thehostVImustbeunderMyComputeroranRTtargetintheProjectExplorerwindow.
2. PlaceanOpenFPGAVIReferencefunctionontheblockdiagram.
Place Find3. Right-clicktheOpenFPGAVIReferencefunctionandselect
ConfigureOpenFPGAVIReferencefromtheshortcutmenu.4. SelecttheBitfileoptionintheConfigureOpenFPGAVI
Referencedialogbox.5. NavigatetothebitfileyouwanttoopenonanFPGAtarget.6. (Optional)UsetheConfigureOpenFPGAVIReferencedialog
boxtoselectadditionaloptionsforopeningthereference.7. ClicktheOKbutton.TheFPGAVIiconappearsintheOpen
FPGAVIReferencefunction.AfoldericonappearsintheupperleftcorneroftheOpenFPGAVIReferencefunctiontodenotethebitfile.
8. WireacontrolorconstanttotheresourcenameinputontheOpenFPGAVIReferencefunctiontospecifyanFPGAtargetonwhichtoruntheFPGAVI.
NoteYoumustplaceandwireaCloseFPGAVIReferencefunctionforeveryOpenFPGAVIReferencefunctioninahostVI.
CommunicatingwithanFPGAVIRunningonaDevelopmentComputer(FPGAInterface)ThefollowinglistdescribesbehaviortoconsiderwhenyouuseahostVItocommunicatewithanFPGAVIthatisrunningonadevelopmentcomputerwithsimulatedI/O:
YoumustrunthehostVIonaWindowsdevelopmentcomputertocommunicatewiththeFPGAVI.YoucannotrunthehostVIonanRTtarget.ToexecutedifferentcodeonthehostVIbasedonwheretheFPGAVIexecutes,usetheInvokeMethodfunctionconfiguredfortheGetFPGAVIExecutionModemethod.TheUpCastfunctionandtheAbort,Reset,andDownloadmethodsontheInvokeMethodfunctiondonotsupportrunningtheFPGAVIonthedevelopmentcomputer.IfyouusetheUpCastfunctionorthesemethods,thehostVIreturnsarun-timeerror.DirectMemoryAccess(DMA)FIFOsarevalidwhileeitherthehostVIorFPGAVIarerunning.IfbothVIsstoprunning,DMAFIFOslosealldata.InterruptsarevalidonlywhentheFPGAVIisrunning.IftheFPGAVIstopsrunning,allinterruptdataislostandanyhostinterfacewaitsreturnimmediately.IfyouusetheInvokeMethodfunctiontoreadDMAFIFOs,thefunctionmighttimeoutmorefrequentlybecausetheFPGAVIisnotrunningasfastonthedevelopmentcomputerasitwouldonanFPGAtarget.YoumustclosethefrontpanelwindowoftheFPGAVIbeforerunningtheFPGAVIifyouwanttousetheCloseFPGAVIReferencefunctiontoclosethereference,stoptheFPGAVI,andresettheFPGAVIrunningonthedevelopmentcomputer.YoumustopenthefrontpanelwindowoftheFPGAVIbeforerunningtheFPGAVIifyouwanttousetheCloseFPGAVIReferencefunctiontoclosethehostreferencewithoutresettingtheFPGAVIrunningonthedevelopmentcomputer.
UsingMultipleFPGAVIReferencesfortheSameTarget(FPGAInterface)IfyouwanttoopenreferencestodifferentFPGAVIsorbitfilesononetarget,openonlyonereferenceatatime,andclosethereferencebeforeopeninganother.YoucanhavemorethanoneFPGAVIreferencesimultaneouslyopenonatarget,aslongasallthereferencescorrespondtothesameFPGAVIorbitfileonthesametarget.YoucantakeadvantageofthisifyouwanttostructureanapplicationsothatdifferentpartsofthehostVIcommunicatewithcertainpartsoftheFPGAVI.ThehostVIaccessescertainresourcesfromtheFPGA.Theresourcescanincludecontrolsandindicators,logicalinterrupts,andDMAchannels.ThebestwaytopartitionthehostVIistoaccessoneoftheFPGAresourcesusingoneFPGAVIreference.TheonlytypeofaccessthatyoucanalwayssafelymakeusingmultipleFPGAVIreferencesisreadingofcontrolsandindicators.
ReadingFPGAVIIndicators(FPGAInterface)CompletethefollowingstepstoreadanindicatorinanFPGAVIfromahostVI.TheFPGAVImusthavefrontpanelindicators.
1. OpenareferencetotheFPGAVIorbitfile.NoteTheFPGAtarget,FPGAVI,andhostVImustbeinthesameLabVIEWprojectifyouwanttoopenareferencetoanFPGAVI.ThehostVIdoesnotneedtobeinaprojectifyouopenareferencetoabitfile.
2. PlacetheRead/WriteControlfunctionontheblockdiagram.NoticethattheRead/WriteControlfunctioncontainsoneUnselectedinput.
Place Find3. WiretheFPGAVIReferenceOutparameteroftheOpenFPGA
VIReferencefunctiontotheFPGAVIReferenceInparameteroftheRead/WriteControlfunction.
4. ClicktheUnselectedinput.TheshortcutmenulistsallfrontpanelcontrolsandindicatorsintheFPGAVIintheControlssubmenu.
5. SelectanindicatoravailableintheFPGAVIfromtheshortcutmenu.NoticethattheUnselectedinputchangestoanoutputandreflectsthenameoftheindicatorintheFPGAVI.
ToreadmoreindicatorsintheFPGAVI,right-clicktheRead/WriteControlfunctionandselectAddElementfromtheshortcutmenuandthencustomizetheoutputasdescribedinthepreviousstep.YoualsocanclickthebottomlineoftheRead/WriteControlfunctionwiththePositioningtoolanddragthelinedowntoaddmorecontrolsandindicators.Thereadandwriteoperationsexecutesequentiallyfromtoptobottom.Also,iftheFPGAVIhassubVIsandyouwanttoaccesscontrolsandindicatorsonthesubVI,youmustwirethesubVIcontrolsandindicatorstothecontrolsandindicatorsoftheFPGAVIthatisusedintheOpenFPGAVIReferencefunction.
NoteYoualsocanreadFPGAVIcontrols.Toreadacontrol,right-clickthecontrolinputontheRead/WriteControlfunctionandselectChangetoReadfromtheshortcutmenu.
WritingtoFPGAVIControls(FPGAInterface)CompletethefollowingstepstowritetoacontrolinanFPGAVIfromahostVI.TheFPGAVImusthavefrontpanelcontrols.
1. OpenareferencetotheFPGAVIorbitfile.NoteTheFPGAtarget,FPGAVI,andhostVImustbeinthesameLabVIEWprojectifyouwanttoopenareferencetoanFPGAVI.ThehostVIdoesnotneedtobeinaprojectifyouopenareferencetoabitfile.
2. PlacetheRead/WriteControlfunctionontheblockdiagram.NoticethattheRead/WriteControlfunctioncontainsoneUnselectedinput.
Place Find3. WiretheFPGAVIReferenceOutoutputoftheOpenFPGAVI
ReferencefunctiontotheFPGAVIReferenceIninputoftheRead/WriteControlfunction.
4. ClicktheUnselectedinput.TheshortcutmenulistsallfrontpanelcontrolsandindicatorsintheFPGAVI.
5. SelectacontrolavailableintheFPGAVIfromtheshortcutmenu.NoticethattheUnselectedinputchangestoreflectthenameofthecontrolintheFPGAVI.
TowritetomorecontrolsintheFPGAVI,right-clicktheRead/WriteControlfunctionandselectAddElementfromtheshortcutmenuandthencustomizetheinputasdescribedinthepreviousstep.YoualsocanclickthebottomlineoftheRead/WriteControlfunctionwiththePositioningtoolanddragthelinedowntoaddmorecontrolsandindicators.Thereadandwriteoperationsexecutesequentiallyfromtoptobottom.Also,iftheFPGAVIhassubVIsandyouwanttoaccesscontrolsandindicatorsonthesubVI,youmustwirethesubVIcontrolsandindicatorstothecontrolsandindicatorsoftheFPGAVIthatisusedintheOpenFPGAVIReferencefunction.
NoteYoualsocanwritetoFPGAVIindicators.Towritetoanindicator,right-clicktheindicatoroutputandselectChangetoWritefromtheshortcutmenu.
ReadingDMAFIFOsfromHostVIs(FPGAInterface)YoucancreateDirectMemoryAccess(DMA)FIFOsinFPGAVIstotransferdatafromFPGAVIstohostVIs.SomeFPGAtargetsdonotsupportDMA.TheFPGAtargetsthatsupportDMAincludeafixednumberofDMAchannelsavailablefortransferringdatabetweentheFPGAVIandthehostVI.RefertothespecificFPGAtargethardwaredocumentationforinformationaboutthenumberofDMAchannelsavailable,iftheFPGAtargetsupportsDMA.CompletethefollowingstepstoreadaDMAFIFOinanFPGAVI.
1. OpenareferencetoanFPGAVIorbitfile.NoteTheFPGAtarget,FPGAVI,andhostVImustbeinthesameLabVIEWprojectifyouwanttoopenareferencetoanFPGAVI.ThehostVIdoesnotneedtobeinaprojectifyouopenareferencetoabitfile.IfyouopenareferencetoanFPGAVI,theprojectmustincludeaDMAFIFOitemundertheFPGAtargetandtheFPGAVImustincludeaFIFOWritefunctionontheblockdiagramthatwritestotheDMAFIFOitem.
2. PlaceanInvokeMethodfunctionontheblockdiagramofthehostVIinthedataflowwhereyouwantthehostVItoreadtheDMAFIFO.MakesurethehostVIrunstheFPGAVIbeforeyoureadtheDMAFIFO.WiretheFPGAVIReferenceIninput.
Place Find3. ClicktheInvokeMethodfunctionandselectFIFO»Readfromthe
shortcutmenu,whereFIFOisthenameoftheFIFOitemintheproject.Wiretheinputsandoutputsasneeded.TheReadmethodreturnsDatawhentheNumberofElementsisavailableorwhentheTimeoutperiodends.IftheTimeoutperiodendsbeforetheNumberofElementsisavailable,Datawillbeempty.TheElementsRemainingoutputcontainsthenumberofelementsremaininginthehostmemorypartoftheDMAFIFO.
4. PlacetheCloseFPGAVIReferencefunctionontheblockdiagram.
Place Find5. WiretheFPGAVIReferenceOutoutputontheInvokeNodeto
theFPGAVIReferenceIninputontheCloseFPGAVIReferencefunction.
NoteYoucanreadDMAFIFOsusingonlytheInvokeMethodfunctionwiththeReadmethod.IfyouwantmorecontrolovertheDMAFIFOfromthehostVI,youalsocanconfigure,start,andstoptheDMAFIFOusingtheoptionalConfigure,Start,andStopmethodswiththeInvokeMethodfunction.
WritingtoDMAFIFOsfromHostVIs(FPGAInterface)YoucancreateDirectMemoryAccess(DMA)FIFOstotransferdatafromhostVIstoFPGAVIs.SomeFPGAtargetsdonotsupportDMA.TheFPGAtargetsthatsupportDMAincludeafixednumberofDMAchannelsavailablefortransferringdatabetweenthehostVIandFPGAVI.RefertothespecificFPGAtargethardwaredocumentationforinformationaboutthenumberofDMAchannelsavailable,iftheFPGAtargetsupportsDMA.CompletethefollowingstepstowritetoaDMAFIFOinanFPGAVI.
1. OpenareferencetoanFPGAVIorbitfile.NoteTheFPGAtarget,FPGAVI,andhostVImustbeinthesameLabVIEWprojectifyouwanttoopenareferencetoanFPGAVI.ThehostVIdoesnotneedtobeinaprojectifyouopenareferencetoabitfile.IfyouopenareferencetoanFPGAVI,theprojectmustincludeaDMAFIFOitemundertheFPGAtargetandtheFPGAVImustincludeaFIFOReadfunctionontheblockdiagramthatreadstheDMAFIFOitem.
2. PlaceanInvokeMethodfunctionontheblockdiagramofthehostVIinthedataflowwhereyouwantthehostVItowritetotheDMAFIFO.WiretheFPGAVIReferenceIninput.
Place Find3. ClicktheInvokeMethodfunctionandselectFIFO»Writefromthe
shortcutmenu,whereFIFOisthenameoftheFIFOitemintheproject.Wiretheinputsandoutputsasneeded.TheWritemethodreturnsEmptyElementsRemainingwhenthedataiswrittenorwhentheTimeoutperiodends.
4. PlacetheCloseFPGAVIReferencefunctionontheblockdiagram.
Place Find5. WiretheFPGAVIReferenceOutoutputontheInvokeNodeto
theFPGAVIReferenceIninputontheCloseFPGAVIReferencefunction.
NoteYoucanwriteDMAFIFOsusingonlytheInvokeMethodfunctionwiththeWritemethod.IfyouwantmorecontrolovertheDMAFIFOfromthehostVI,youalsocanconfigure,start,andstoptheDMAFIFOusingtheoptionalConfigure,Start,andStopmethodswiththeInvokeMethodfunction.
UsingSubVIsinHostVIs(FPGAInterface)YoucanusesubVIsinhostVIsthatcommunicatewithFPGAVIsorbitfilesonFPGAtargets.However,ifyouchangetheconfigurationoftheOpenFPGAVIReferencefunctionortheUpCastfunction,LabVIEWdoesnotpropagatethechangestothesubsequentsubVIsinthedataflowunlessyoubindthereferenceoutputofthefunctiontoatypedefinition.CompletethefollowingstepstobindthereferenceoutputoftheOpenFPGAVIReferencefunctiontoatypedefinition.
1. Right-clicktheOpenFPGAVIReferencefunctiononthehostVIblockdiagramandselectConfigureOpenFPGAVIReferencefromtheshortcutmenu.
2. PlaceacheckmarkintheBindFPGAhostreferencetotypedefinitioncheckbox.TheSaveAsdialogboxappears.
3. TypeanameforanewtypedefinitionintheFilenametextboxornavigatetoanexistingtypedefinitionintheSaveAsdialogbox.IfyoutypeanameforthetypedefinitionintheFilenametextbox,LabVIEWcreatesthetypedefinitionforyou.
4. ClicktheSavebuttontoclosetheSaveAsdialogbox.5. ClicktheOKbuttontoclosetheConfigureOpenFPGAVI
Referencedialogbox.CompletethefollowingstepstobindthereferenceoutputoftheUpCastfunctiontoatypedefinition.
1. Right-clicktheUpCastfunctiononthehostVIblockdiagramandselectBindReferenceOutputtoTypeDefinitionfromtheshortcutmenu.TheSaveAsdialogboxappears.
2. TypeanameforanewtypedefinitionintheFilenametextboxornavigatetoanexistingtypedefinitionintheSaveAsdialogbox.IfyoutypeanameforthetypedefinitionintheFilenametextbox,LabVIEWcreatesthetypedefinitionforyou.
3. ClicktheSavebutton.LabVIEWnowautomaticallyupdatesthetypedefinitionyoucreatedwheneverchangestotheOpenFPGAVIReferencefunctionortheFPGAVInecessitatechangestothetypedefinition.LabVIEWalsopropagatesthesechangestoanysubVIsthatusethistypedefinition.This
propagationallowsthesubVIstoremainconsistentwiththeOpenFPGAVIReferencefunctionorUpCastfunction.IfyoudonotbindtheoutputoftheOpenFPGAVIReferenceorUpCastfunctionstoatypedefinitionandyoumakeachangetotheconfigurationofeitherofthesefunctions,youmustmakethesamechangeinanysubVIsthatusethereferenceoutput.UsetheConfigureFPGAVIReferencedialogboxtoupdatethereference.
SynchronizingFPGAVIsandHostVIsUsingInterrupts(FPGAInterface)SomeFPGAtargetsallowyoutogenerateinterruptsfromtheFPGAVItonotifythehostVIofevents,suchasdatabeingready,anerroroccurring,orataskfinishing.RefertothespecificFPGAtargethardwaredocumentationforinformationaboutwhethertheFPGAtargetsupportsinterrupts.
WaitingforandAcknowledgingaSingleInterruptCompletethefollowingstepstowaitforandacknowledgeasingleinterruptinahostVI.
1. OpenareferencetotheFPGAVIorbitfilethatgeneratesinterrupts.
2. PlacetheInvokeMethodfunctionontheblockdiagramofthehostVIinthedataflowwhereyouwantthehostVItowaitforinterruptsfromtheFPGAVI.BesuretowiretheFPGAVIReferenceIninput.
Place Find3. Right-clicktheInvokeMethodfunctionandselectMethod»Wait
onIRQfromtheshortcutmenu.4. Right-clicktheIRQNumber(s)inputontheInvokeMethod
functionandselectCreate»Constantfromtheshortcutmenu.Youalsocancreateacontrol.
5. EnterthevalueofthelogicalinterruptyouselectedintheFPGAVI.
6. WiretheTimeoutinputifyouwanttospecifythemaximumtimethehostVIwaitsfortheinterruptbeforecontinuingthedataflow.Bydefault,thehostVIdoesnotwaitforaninterrupttooccurandreturnsonlyinterruptsalreadysetbytheFPGAVI.Youalsocanwireaconstantwithavalueof–1towaitindefinitelyforaninterrupt.IfyouusetheTimeoutinput,youcanusetheTimedOutoutputtodeterminewhetherthehostVIcontinueddataflowduetothetimeoutoccurringortothereceiptofaninterrupt.Ifatimeoutoccurs,theTimedOutoutputreturnsTRUE.
7. Right-clicktheIRQ(s)AssertedoutputontheInvokeMethodfunctionandselectCreate»Indicatorfromtheshortcutmenu.LabVIEWcreatesanumericindicator.Avalueof–1indicatesthattheinterruptwasnotreceived.
8. PlacetheInvokeMethodfunctionontheblockdiagramofthehostVIinthedataflowwhereyouwantthehostVItoacknowledgetheinterruptfromtheFPGAVI.PlacetheInvokeMethodfunctioninaCaseStructureifyouwantthefunctiontoexecuteonlywhenthehostVIreceivesaninterrupt.Ifyouwirea
BooleanconstantofTRUEtotheWaitUntilClearedinputoftheInterruptVI,placetheInvokeMethodfunctioninthedataflowwhereyouwanttotelltheInterruptVItostopwaiting.BesuretowiretheFPGAVIReferenceIninputoftheInvokeMethodfunction.
Place Find9. Right-clicktheInvokeMethodfunctionandselect
Method»AcknowledgeIRQfromtheshortcutmenu.UsetheAcknowledgeIRQmethodtoacknowledgethelogicalinterruptreturnedbytheWaitonIRQmethod.
10. WiretheIRQ(s)AssertedoutputoftheWaitonIRQmethoddirectlytotheIRQNumber(s)inputoftheAcknowledgeIRQmethod.
WaitingforandAcknowledgingMultipleInterruptsCompletethefollowingstepstowaitforandacknowledgemultipleinterruptsinahostVI.
1. OpenareferencetotheFPGAVIorbitfilethatgeneratesinterrupts.
2. PlacetheInvokeMethodfunctionontheblockdiagramofthehostVIinthedataflowwhereyouwantthehostVItowaitforinterruptsfromtheFPGAVI.BesuretowiretheFPGAVIReferenceIninput.
Place Find3. Right-clicktheInvokeMethodfunctionandselectMethod»Wait
onIRQfromtheshortcutmenu.4. PlaceanArrayConstantontheblockdiagram.Anarrayincludes
anindexdisplayontheleft,anelementdisplayontheright,andanoptionallabel.
Place Find5. PlaceaNumericConstantinthearray.
Place Find
6. UsingthePositioningtool,expandthearrayconstanttothenumberofinterruptsneeded.
7. Enterthevaluesofthelogicalinterrupts.8. WirethearrayconstanttotheIRQNumber(s)input.9. WiretheTimeoutinputifyouwanttospecifythemaximumtime
thehostVIwaitsfortheinterruptbeforecontinuingthedataflow.Bydefault,thehostVIdoesnotwaitforaninterrupttooccurandreturnsonlyinterruptsalreadysetbytheFPGAVI.Youalsocanwireaconstantwithavalueof–1towaitindefinitelyforaninterrupt.IfyouusetheTimeoutinput,youcanusetheTimedOutoutputtodeterminewhetherthehostVIcontinueddataflowduetothetimeoutoccurringortothereceiptofaninterrupt.Ifatimeoutoccurs,theTimedOutoutputreturnsTRUE.
10. Right-clicktheIRQ(s)AssertedoutputontheInvokeMethod
functionandselectCreate»Indicatorfromtheshortcutmenu.LabVIEWcreatesanarrayindicator.TheIRQ(s)Assertedfrontpanelindicatordisplaysthenumber(s)oftheinterruptstheFPGAtargetasserts.Anemptyarrayindicatesthatnointerruptswerereceived.
11. PlacetheInvokeMethodfunctionontheblockdiagramofthehostVIinthedataflowwhereyouwantthehostVItoacknowledgetheinterruptsfromtheFPGAVI.PlacetheInvokeMethodfunctioninaCaseStructureifyouwantthefunctiontoexecuteonlywhenthehostVIreceivesaninterrupt.IfyouwireaBooleanconstantofTRUEtotheWaitUntilClearedinputoftheInterruptVI,placetheInvokeMethodfunctioninthedataflowwhereyouwanttotelltheInterruptVItostopwaiting.BesuretowiretheFPGAVIReferenceIninputoftheInvokeMethodfunction.
Place Find12. Right-clicktheInvokeMethodfunctionandselect
Method»AcknowledgeIRQfromtheshortcutmenu.UsetheAcknowledgeIRQmethodtoacknowledgethelogicalinterruptsreturnedbytheWaitonIRQmethod.
13. WiretheIRQ(s)AssertedoutputoftheWaitonIRQmethoddirectlytotheIRQNumber(s)inputoftheAcknowledgeIRQmethod.
ForcinganFPGAVItoDownloadtoanFPGATarget(FPGAInterface)LabVIEWautomaticallydownloadsacompiledFPGAVItotheFPGAtargetwhenyouinvoketheOpenFPGAVIReferencefunction.LabVIEWalsoautomaticallycompiles,downloads,andrunsanFPGAVIontheFPGAtargetwhenyouclicktheRunbuttoninanFPGAVIiftheFPGAtargetsupportsInteractiveFrontPanelCommunication.LabVIEWdoesnotdownloadtheFPGAVIiftheVIisalreadyontheFPGAtargetoriftheFPGAisreservedforotherpurposes.Youcanforceadownloadbyright-clickingtheFPGAVIintheProjectExplorerwindowandselectingDownloadfromtheshortcutmenu.FPGAtargetfunctionalityvariesdependingonthespecifictarget.RefertothespecificFPGAtargethardwaredocumentationforinformationaboutdownloadingoptionsavailableforthetarget.YoualsocanprogrammaticallyforceLabVIEWtodownloadanFPGAVIorbitfiletoanFPGAtargetfromahostVI.CompletethefollowingstepstoprogrammaticallyforceanFPGAVIorbitfiletodownload.
1. OpenareferencetotheFPGAVIorbitfile.NoteTheFPGAtarget,FPGAVI,andhostVImustbeinthesameLabVIEWprojectifyouwanttoopenareferencetoanFPGAVI.ThehostVIdoesnotneedtobeinaprojectifyouopenareferencetoabitfile.
2. PlaceanInvokeMethodfunctionontheblockdiagram.
Place Find3. WiretheFPGAVIReferenceOutparameteroftheOpenFPGA
VIReferencefunctiontotheFPGAVIReferenceInparameteroftheInvokeMethodfunction.
4. Right-clicktheInvokeMethodfunctionandselectMethod»Downloadfromtheshortcutmenu.
IfyouprogrammaticallydownloadtheFPGAVItotheFPGAtargetwiththeInvokeMethodfunction,youalsomustprogrammaticallyruntheFPGAVIontheFPGAtargetwiththeInvokeMethodfunction.PlaceanotherInvokeMethodfunctionontheblockdiagramandselect
Method»RunfromtheshortcutmenuoftheInvokeMethodfunctiontoprogrammaticallyrunanFPGAVIorbitfile.
Stopping,Aborting,andResettingFPGAVIs(FPGAInterface)IfyoucreateanFPGAVIthatyouwanttostopandrunagainfromahostVI,NationalInstrumentsrecommendsthatyoudesigntheFPGAVIsothatyoucanstopitsexecutionbysettingacontrolontheFPGAVItoacertainvalue.ThisdesignpracticeallowsyoutocontrolhowtheFPGAVIisstoppedandthevaluesontheoutputsontheFPGAtargetwhentheFPGAVIstops.YoucanstoptheFPGAVIfromthehostVIbywritingtherelevantFPGAVIcontrol.YouthencanruntheFPGAVIbyusingtheInvokeMethodfunctionwiththeRunmethod.IfyoudonotneedcontroloftheFPGAtargetoutputs,youcanusetheInvokeMethodfunctionwiththeResetmethodtoabortandrestoretheFPGAVItothedefaultstate.IfstoppingisnotdesignedaspartoftheFPGAVI,youcanresetand/oraborttheFPGAVIfromthehostVIusingtheResetmethodorAbortmethod.TheAbortmethoddoesnotresettheFPGAVItothedefaultstatewhichmightaffecthowtheFPGAVIreactstofutureexecutionsoftheRunmethodfromthehostVI.