您的当前位置:首页正文

labview touch panel 2010

来源:个人技术集锦
GettingStartedwiththeLabVIEW™TouchPanelModule

TheLabVIEWTouchPanelModuleextendstheLabVIEWgraphicaldevelopmentenvironmenttoTouchPaneldevicessoyoucancreatehuman-machineinterface(HMI)applicationsforTouchPaneldevicesrunningWindowsCEorWindowsXPEmbedded.YoucancreatecustomtouchpaneldisplaystocommunicatewithNationalInstrumentsembeddedreal-timeplatforms,suchasCompactFieldPoint,CompactRIO,andCompactVisionSystem.

ThismanualcontainsinstallationinstructionsforadditionaltoolsyoumightneedtousewiththeTouchPanelModuleandatutorialthatshowsyouhowtocreateaLabVIEWprojectandbuild,run,deploy,anddebugaTouchPanelapplication.RefertotheLabVIEWTouchPanelModuleReadme,availablebyselectingStart»AllPrograms»NationalInstruments»LabVIEW»Readmeandopening

readme_TouchPanel.html,forsystemrequirementsandinstructionsaboutinstallingtheTouchPanelModule.

Contents

InstallingAdditionalTools...................................................................................................................1

NI-DAQmxBase..........................................................................................................................2NITPCServiceSupport...............................................................................................................2SharedVariableSupport(WindowsCE)......................................................................................2PNGImageSupport(WindowsCE).............................................................................................3NI-VISASupport(WindowsCE).................................................................................................4x86TargetSupportforThirdParties(WindowsCE)...................................................................4WindowsCETutorial...........................................................................................................................4

ConfiguringtheWindowsCEDevicetoUsetheNITPCService...............................................4CreatingtheLabVIEWProject.....................................................................................................5CreatingtheBuildSpecification...................................................................................................9BuildingtheVIintoanApplicationandDeploying...................................................................12ClosingtheApplication..............................................................................................................13DebuggingtheApplication.........................................................................................................13XPEmbeddedTutorial........................................................................................................................17

CreatingtheLabVIEWProject...................................................................................................17CreatingtheBuildSpecification.................................................................................................21BuildingtheVIintoanApplicationandDeploying...................................................................24DebuggingtheTouchPanelApplication....................................................................................25RelatedDocumentation.......................................................................................................................29

InstallingAdditionalTools

AfterinstallingtheTouchPanelModule,youmightneedtoinstalladditionaltoolsonthetargetdependingonthefunctionalityyouneed.

NI-DAQmxBase

YoucandownloadthelatestversionofNI-DAQmxBaseforusewithTouchPaneldevicesfromtheNationalInstrumentsWebsite.AfteryoucompletetheNI-DAQmxBaseinstallation,youmustcopythedriverfilestothedevice.

CompletethefollowingstepstoinstallNI-DAQmxBaseontheTouchPaneldevice.1.SelectStart»Programs»NationalInstruments»NI-DAQmxBase»Utilities.2.LaunchtheDriverInstallationutilitythatcorrespondstotheTouchPaneldevice.

3.Checkthedevicescreentoseeifanyadditionalstepsarerequested,suchasreplacinganolder

driver.RefertotheNI-DAQmxBaseReadmeandtheNI-DAQmxBase3.xGettingStartedGuideformoreinformationaboutNI-DAQmxBase.

NITPCServiceSupport

TheNITPCServiceisanEthernet-basedservicethatyoucanusetodeploy,run,anddebugTouchPanelapplications.UsetheNITPCServiceinsteadofActiveSyncifyouareusingEthernetandneedtodeployaTouchPanelapplicationtomultipleTouchPaneltargets.Ifyouareusingthird-partydevicesoryourNITouchPaneldevicedoesnothavetheNITPCServiceinstalled,youmustinstalltheNITPCServiceonthedevicebeforeyoucanusetheNITPCService.MostNITouchPaneldevicesincludetheNITPCServicebydefault.

WindowsCETargets

CompletethefollowingstepstoinstallsupportfortheNITPCServiceonaTouchPaneltarget.

1.Dependingonwhichtypeoftargetyouareusing,useFTPoranexternalstoragedevicetocopy

NITPCService.CABfromthelabview\\PDA\\Utilities\\NITPCService\\ARMdirectoryorlabview\\PDA\\Utilities\\NITPCService\\x86directorytoanylocationontheTouchPaneldevice.

2.Runthe.CABfileontheTouchPaneldevicetoinstalltheNITPCService.

3.ForNITPCdevices,usethedefaultinstallationlocation.Tapthekeytoacceptthedefault

installationlocation.Forthird-partydevices,installtheserviceinanon-volatiledirectoryonthedevice.

Third-PartyXPEmbeddedTargets

YoumustinstalltheLabVIEWRun-TimeEngineontheTouchPaneltargetbeforeyoucaninstalltheNITPCService.AninstallerfortheLabVIEWRun-TimeEngineislocatedontheLabVIEWDVDorCD.RefertotheNationalInstrumentsWebsitetodownloadthelatestversionandotherversionsoftheLabVIEWRun-TimeEngine.

AfteryouinstalltheLabVIEWRun-TimeEngineontheTouchPaneltarget,installtheNITPCServicefromNI_TP_Service\\NITPCService.msi,whichislocatedinthesamedirectoryasthesetup.exeyouusedtoinstalltheTouchPanelModule.

SharedVariableSupport(WindowsCE)

Ifyouareusingthird-partydevicesoryourNITouchPaneldevicedoesnothavesharedvariablesupport,youmustinstallthelatestversionofsharedvariablesupportonthedevicebeforeyoucanusefrontpaneldatabindingandSharedVariablenodesinTouchPanelapplications.

NoteMostNITouchPaneldevicesincludethelatestversionofsharedvariablesupport,soyoudonotneedtocompletethefollowingsteps.IfyouhaveanNITPC-2006deviceandyou

GettingStartedwiththeLabVIEWTouchPanelModule

2ni.com

downloadedtheimproveddisplaydriverfromtheNationalInstrumentsKnowledgeBaseatni.com,youalsodonotneedtocompletethefollowingsteps.

NoteSharedvariablesarenotsupportedonWindowsCE4.xx86TouchPaneltargets.SharedvariablesaresupportedonWindowsCE5.0andlaterx86targets.

UsingActiveSync/FTP

CompletethefollowingstepstoinstalloruninstallsupportforsharedvariablesonaTouchPaneltargetusingActiveSync/FTP.

1.ConnectthedevicetothehostcomputerusingActiveSync/FTP.

2.Navigatetoandrunlabview\\PDA\\Utilities\\Variables\\ARM\\Setup.exeor

labview\\PDA\\Utilities\\Variables\\x86\\Setup.exe,dependingonwhichtypeoftargetyouareusing.

3.ForNITPCdevices,usethedefaultinstallationlocation.Forthird-partydevices,installtheservice

inanon-volatiledirectoryonthedevice.

UsingtheNITPCService

CompletethefollowingstepstoinstalloruninstallsupportforsharedvariablesonaTouchPaneltargetusingtheNITPCService.

1.InLabVIEW,right-clicktheTouchPaneltargetintheProjectExplorerwindowandselect

Install»SupportforSharedVariables(ARM)fromtheshortcutmenu.

2.ForNITPCdevices,usethedefaultinstallationlocation.Forthird-partydevices,installtheservice

inanon-volatiledirectoryonthedevice.

PNGImageSupport(WindowsCE)

Ifyouareusingthird-partydevicesoryourNITouchPaneldevicedoesnotsupportPNGimages,youmustinstallsupportforPNGimagesonthedeviceiftheVIcontainsPNGimagesintheuserinterface.

NoteMostNITouchPaneldevicesincludesupportforPNGimages,soyoudonotneedtocompletethefollowingsteps.IfyouhaveanNITPC-2006deviceandyoudownloadedtheimproveddisplaydriverfromtheNationalInstrumentsKnowledgeBaseatni.com,youalsodonotneedtocompletethefollowingsteps.

UsingActiveSync/FTP

CompletethefollowingstepstoinstalloruninstallsupportforPNGimagesonaTouchPaneldeviceusingActiveSync/FTP.

1.ConnectthedevicetothehostcomputerusingActiveSync/FTP.

2.Navigatetoandrunlabview\\PDA\\Utilities\\LVPNG\\ARM\\Setup.exeor

labview\\PDA\\Utilities\\LVPNG\\x86\\Setup.exe,dependingonwhichtypeoftargetyouareusing.

©NationalInstrumentsCorporation3

GettingStartedwiththeLabVIEWTouchPanel

Module

3.

ForNITPCdevices,usethedefaultinstallationlocation.Forthird-partydevices,installtheserviceinanon-volatiledirectoryonthedevice.

TipYoualsocanright-clickthetargetintheProjectExplorerwindowinLabVIEWandselectInstall»SupportforPNGImages(ARM)fromtheshortcutmenu.

UsingtheNITPCService

CompletethefollowingstepstoinstalloruninstallsupportforPNGimagesonaTouchPaneltargetusingtheNITPCService.

1.InLabVIEW,right-clicktheTouchPaneltargetintheProjectExplorerwindowandselect

Install»SupportforPNGImages(ARM)fromtheshortcutmenu.

2.ForNITPCdevices,usethedefaultinstallationlocation.Forthird-partydevices,installtheservice

inanon-volatiledirectoryonthedevice.

NI-VISASupport(WindowsCE)

YoumustinstallNI-VISAonthetargettouseVISAinTouchPanelapplications.IfyoudidnotinstallNI-VISAwhenyouinstalledtheTouchPanelModule,selectStart»AllPrograms»National

Instruments»VISAandselectWindowsCEforARMDriverInstallationorWindowsCEforx86DriverInstallation,dependingonwhichtypeoftargetyouareusing.

TipYoualsocanright-clickthetargetintheProjectExplorerwindowinLabVIEWandselectInstall»SupportforNI-VISA(ARM)fromtheshortcutmenu.

x86TargetSupportforThirdParties(WindowsCE)

TheTouchPanelModuleinstallssupportforARMTouchPaneltargetsandWindowsCE5.0x86TouchPaneltargets.Ifyouneedsupportforx86TouchPaneltargetsrunningWindowsCE4.2,installthefollowingMicrosofteMbeddedVisualTools:•MicrosofteMbeddedVisualC++4.0•MicrosofteMbeddedVisualC++SP4orlater•SDKforWindowsMobile2003-basedPocketPCsRefertotheNationalInstrumentsKnowledgeBaseatni.com/infoandentertheInfoCodetpcevcforthemostrecentinformationaboutdownloadingandinstallingtheMicrosofteMbeddedVisualTools.

WindowsCETutorial

UsethistutorialtolearnhowtoconfigureaTouchPanelWindowsCEdevicetousetheNITPCService;howtousetheTouchPanelProjectWizardtocreateaproject;andhowtobuild,deploy,run,anddebugaTouchPanelapplication.

TheVIinthistutorialsimulatessettingatemperature,displayingthecurrenttemperatureinagraphandonathermometer,andindicatingifthetemperatureisnotinrange.

ConfiguringtheWindowsCEDevicetoUsetheNITPCService

NoteIfyouwanttouseActiveSyncinsteadoftheNITPCService,youmustuseaUSBorserialconnectiontoconnecttheTouchPaneldevicetothehostcomputer.Ifyouuseaserialcable,connectiontimeislonger.

CompletethefollowingstepstoconfiguretheTouchPaneldevicetousetheNITPCService.1.Ensurethehostandtargetareonthesamesubnet.

GettingStartedwiththeLabVIEWTouchPanelModule

4ni.com

2.

3.4.

EnableFTPontheTouchPaneldevice.RefertotheNationalInstrumentsWebsiteatni.com/infoandentertheInfoCodeex6pwqforthemostrecentinformationaboutconfiguringNITPCdevicestouseFTP.Forthird-partydevices,refertoyourdevicedocumentation.

InstalltheNITPCServiceontheTouchPaneltarget.RefertotheNITPCServiceSupportsectionformoreinformationaboutinstallingtheNITPCServiceonTouchPaneltargets.

UsetheNITPCServiceManagertoconfiguretheservicetorunontheTouchPaneltarget.a.SelectStart»AllPrograms»NationalInstruments»NITPCService»NITPCService

ManagertolaunchtheNITPCServiceManager.ThemanagerchecksthestatusoftheNITPCServiceanddisplaysthestatusinformation.

b.TaptheStartbuttontostarttheNITPCServiceiftheNITPCServiceisnotrunning.

CreatingtheLabVIEWProject

UseLabVIEWprojectstogrouptogetherLabVIEWfilesandnon-LabVIEWfiles,createbuild

specificationsforbuildingaTouchPanelVIintoanapplication,anddeploytheapplicationtothetarget.YoumustuseaprojecttobuildaTouchPanelVIintoanapplication.

UsingtheTouchPanelProjectWizard,completethefollowingstepstocreateaLabVIEWproject,addthetarget,andaddanexistingVItotheproject.

1.LaunchLabVIEW.IntheGettingStartedwindow,selectTouchPanelProjectfromtheTargets

pull-downmenu.ClicktheGobuttontolaunchtheTouchPanelProjectWizard.2.DefinetheprojectinformationasshowninFigure1.

a.SelectNewTouchPanelproject,importVIfromtheProjecttypepull-downmenutocreate

theLabVIEWprojectusinganexistingVI.

TipTheblankVIprojecttypecreatesaprojectwithanewTouchPaneltemplateVIratherthanimportinganexistingVI.

b.

SpecifyaprojectnameandthelocationwhereyouwanttosavetheprojectandtheVIintheProjectlocationtextbox.Savetheprojecttoalocationotherthanthedefaultlocationsoyoudonotoverwritetheshippingexamplewithyourchanges.ThedefaultprojectnameisUntitledproject.lvproj.Forthistutorial,nametheprojectTouchPanelTutorial.lvprojintheProjectlocationtextbox.

ClicktheBrowsebuttonnexttotheVIpathtextboxandnavigateto

labview\\examples\\TouchPanel\utorial\\TouchPanelTutorial.vitoselecttheVItoimport.ClicktheOKbuttontoaddtheVItotheprojectyouarecreating.

c.

©NationalInstrumentsCorporation5

GettingStartedwiththeLabVIEWTouchPanel

Module

Figure1.DefiningtheProjectInformation

3.4.

ClicktheNextbutton.

SelecttheTouchPaneldeviceyouareusingfromtheDevicetypepull-downmenu,asshowninFigure2.

GettingStartedwiththeLabVIEWTouchPanelModule

6ni.com

Figure2.SelectingtheTarget

5.6.

ClicktheNextbutton.

ConfigureconnectioninformationforthedeviceasshowninFigure3.

a.SelectNITPCService(TCP/IP)fromtheConnectionpull-downmenuifyouconfigured

thedevicetousetheNITPCService.

b.EntertheIPaddressforthedeviceintheTouchPaneldeviceIPaddresstextbox.

©NationalInstrumentsCorporation7

GettingStartedwiththeLabVIEWTouchPanel

Module

Figure3.ConfiguringtheDevice

7.8.

ClicktheNextbutton.

ClicktheFinishbutton.BecausetheCreateabuildspecificationcheckboxcontainsacheckmark,asshowninFigure4,theTouchPanelBuildSpecificationPropertiesdialogboxopens.RefertotheCreatingtheBuildSpecificationsectionformoreinformationaboutcreatingabuildspecification.

GettingStartedwiththeLabVIEWTouchPanelModule

8ni.com

Figure4.PreviewingtheProject

CreatingtheBuildSpecification

BuildspecificationscontainthebuildsettingsandcodegenerationoptionstousewhenyoubuildaTouchPanelVIintoanapplication.Youcancreatethebuildspecificationwhenyoucreateaprojectorwaituntilyouarereadytobuildtheapplication.YoumustcreateabuildspecificationbeforeyoucanbuildaTouchPanelVIintoanapplication.

Youcanhavemultiplebuildspecificationsforthesametarget.Forexample,youmightwantonebuildspecificationthatgeneratesdebugginginformationandanotherbuildspecificationthatdoesnotgeneratethisextrainformation.

NoteThistutorialcreatesthebuildspecificationthroughtheTouchPanelProjectWizard.Youalsocancreateabuildspecificationatanytimebyright-clickingBuildSpecificationsunderthetargetintheProjectExplorerwindowandselectingNew»TouchPanelApplication(EXE)fromtheshortcutmenu.

CompletethefollowingstepstocreateaTouchPanelbuildspecification.

1.DefinethesettingsfortheTouchPanelapplication,asshowninFigure5.

a.EnterTouchPanelTutorialintheBuildspecificationnametextbox.Thisisthename

thatappearsunderBuildSpecificationsintheProjectExplorerwindow.

©NationalInstrumentsCorporation9

GettingStartedwiththeLabVIEWTouchPanel

Module

b.

c.d.

(Optional)Bydefault,thenameoftheapplicationisthesameasthetop-levelVI.Ifyoudonotwanttousethetop-levelVInamefortheapplicationname,removethecheckmarkfromtheSameastop-levelVIcheckboxandenteranameintheTargetfilenametextbox.

Browsetoandselectthedestinationdirectoryfortheapplicationonthehostcomputer,whichiswhereLabVIEWsavesthe.exe,intheDestinationdirectorytextbox.

EnterthedestinationdirectoryfortheapplicationonthetargetintheRemotepathfortargetapplicationtextbox.

Figure5.DefiningtheApplicationInformation

2.3.4.

(Optional)ClicktheHelpbuttontoopentheLabVIEWHelpandreadadescriptionofeachbuildsetting.

SelecttheDeviceInformationcategorytoviewwhichtargetandprocessorthisbuildspecificationappliesto.

SelecttheSourceFilescategorytoselectthesourcefilestoincludewhenyoubuildtheVIintoanapplication.WhenyouusetheTouchPanelProjectWizardtocreateabuildspecification,LabVIEWautomaticallyusestheVIyouimportasthetop-levelVI.Whenyoucreatebuildspecificationsoutsideofthewizard,youmustmanuallyselectthetop-levelVIandclickthebluearrowbuttontomovetheVItotheTop-levelVItextbox,asshowninFigure6.TouchPanelapplicationscanhaveonlyonetop-levelVI.

GettingStartedwiththeLabVIEWTouchPanelModule

10ni.com

Figure6.SelectingtheSourceFiles

5.6.

SelecttheGeneratedFilescategorytoviewthefilenamesandpathstothefilestheTouchPanelModulegenerateswhenyoubuildtheVIintoanapplication.

ClicktheOKbutton.ThebuildspecificationyoujustcreatedappearsintheProjectExplorerwindowundertheTouchPaneltarget,asshowninFigure7.

©NationalInstrumentsCorporation11

GettingStartedwiththeLabVIEWTouchPanel

Module

Figure7.ProjectExplorerWindow

7.8.

SelectFile»SaveProjectintheProjectExplorerwindowtosavetheproject.LabVIEWsavesanybuildspecificationswiththeproject.

IfyouconfiguredtheTouchPaneldevicetousetheNITPCService,ensurethattheNITPCServiceisrunningonthedevice.

a.Right-clicktheTouchPaneltargetintheProjectExplorerwindowandselectProperties

fromtheshortcutmenutodisplaytheTouchPanelTargetPropertiesdialogbox.

b.OntheGeneralpage,clicktheTestbuttontoconfirmthattheNITPCServiceisrunningon

thetarget.

BuildingtheVIintoanApplicationandDeploying

AfteryoudeveloptheVIonthehostcomputer,youbuildtheVIintoanexecutableapplicationthatyoucanrunonatarget.PickoneoftheoptionsintheUsingtheShortcutMenusectionortheUsingtheRunButtonsectionofthismanualtobuild,deploy,andruntheapplication.

UsingtheShortcutMenu

Right-clickthebuildspecificationintheProjectExplorerwindowandselectoneofthefollowingoptionsfromtheshortcutmenu:•Deploy—BuildstheVIintoanapplication,ifnecessary,anddeploystheapplicationtothetarget.

Thisoptiondoesnotruntheapplicationautomatically.•Run—BuildstheVIintoanapplication,ifnecessary;deploystheapplicationtothetarget;and

runstheapplicationautomatically.•Build—BuildstheVIintoanapplication.Thisoptiondoesnotdeployorruntheapplication

automatically.

GettingStartedwiththeLabVIEWTouchPanelModule

12ni.com

UsingtheRunButton

WhenyourunaVIundertheTouchPaneltargetintheProjectExplorerwindow,theRunbuttonbehavesdifferentlyfromwhenyourunaVIunderMyComputerintheProjectExplorerwindow:•Ifyouwanttobuild,deploy,andrun—ClicktheRunbuttoninaVItobuildtheVIintoan

application,deploytheapplicationtothetarget,andruntheapplicationonthetarget.LabVIEWpromptsyoutocreateabuildspecificationifyoudonothaveanexistingbuildspecificationfortheVI.Ifyouhavemultiplebuildspecifications,LabVIEWpromptsyoutoselectabuild

specificationintheSelectaBuildSpecificationdialogbox.Alternatively,youcanspecifyadefaultbuildspecificationbyright-clickingabuildspecificationintheProjectExplorerwindowandselectingSetasDefaultfromtheshortcutmenu.LabVIEWindicatesthedefaultbuildspecificationwithagreensquarearoundthebuildspecificationglyphintheProjectExplorerwindow.•Ifyouwanttobuildwithoutdeployingorrunning—Pressthekeywhileyouclickthe

RunbuttoninaVItobuildtheVIintoanapplicationwithoutdeployingorrunningtheapplication.LabVIEWpromptsyoutocreateabuildspecificationifyoudonothaveanexistingbuild

specificationfortheTouchPanelVI.Ifyouhavemultiplebuildspecifications,LabVIEWpromptsyoutoselectabuildspecificationintheSelectaBuildSpecificationdialogbox.Alternatively,youcanspecifyadefaultbuildspecificationbyright-clickingabuildspecificationintheProjectExplorerwindowandselectingSetasDefaultfromtheshortcutmenu.LabVIEWindicatesthedefaultbuildspecificationwithagreensquarearoundthebuildspecificationglyphintheProjectExplorerwindow.

ClosingtheApplication

TaptheExitbuttonintheapplicationontheTouchPaneltargettoclosetheapplication.

DebuggingtheApplication

YoumustcreateabuildspecificationthatenablesdebuggingbeforeyoucandebugaTouchPanelapplication.Enablingdebugginggeneratesextradebugginginformationandcansignificantlyincreasethesizeoftheapplication.

WhenLabVIEWonthehostcomputerconnectstotheTouchPaneltarget,theapplicationrunsonthetarget.Thefrontpanelisfullyfunctionalonthetarget.However,thefrontpanelcontrolshavenoeffectontheapplication,andtheindicatorsintheVIonthehostcomputerdonotreflecttheexecutionoftheapplicationonthetarget.

TheblockdiagramactsasaconduitbetweentheapplicationrunningonthetargetandtheVIrunningonthehostcomputer,whereyoucanprobesignals,setbreakpoints,andstepthroughcodeasyoudoinanyotherVI.

TipYoucanmodifyanexistingbuildspecificationbydouble-clickingthebuildspecificationintheProjectExplorerwindoworright-clickingthebuildspecificationandselectingPropertiesfromtheshortcutmenu.Thistutorialcreatesasecondbuildspecificationfordebugging.

CreatingaDebuggingBuildSpecification

Completethefollowingstepstocreateadebuggingbuildspecification.

1.Right-clickBuildSpecificationsundertheTouchPaneltargetandselectNew»TouchPanel

Application(EXE)fromtheshortcutmenutoopentheTouchPanelBuildSpecificationPropertiesdialogbox.

2.Enter(Debug)TouchPanelTutorialintheBuildspecificationnametextbox.

3.RemovethecheckmarkfromtheSameastop-levelVIcheckboxsoyoucanchangetheapplication

name.

4.Enter(Debug)TouchPanelTutorial.exeintheTargetfilenametextbox.

©NationalInstrumentsCorporation13

GettingStartedwiththeLabVIEWTouchPanel

Module

5.

PlaceacheckmarkintheEnabledebuggingcheckboxtogeneratedebugginginformationwhenyoubuildtheVIintoanapplication,asshowninFigure8.

Figure8.CreatingtheDebuggingBuildSpecification

6.

7.

SelectSourceFilesfromtheCategorylistandselectTouchPanelTutorial.viintheProjectFileslist.ClickthebluerightarrowbuttontomovetheVIfromtheProjectFileslisttotheTop-levelVItextbox.

ClicktheOKbutton.ThebuildspecificationyoujustcreatedappearsintheProjectExplorerwindow,asshowninFigure9.

GettingStartedwiththeLabVIEWTouchPanelModule

14ni.com

Figure9.TwoBuildSpecificationsintheProjectExplorerWindow

AddingaProbetotheVI

Probesdisplayinformationaboutthedatathatpassesthroughawire.Asyouinteractwiththeapplicationonthetarget,youcanseethedatapassingthroughthewireinthecorrespondingVIonthehostcomputer.CompletethefollowingstepstoaddaprobetotheTouchPanelTutorialVI.

1.SelectWindow»ShowBlockDiagramintheVItoopentheblockdiagramifitisnotvisible.

TipDouble-clicktheVIintheProjectExplorerwindowtoopentheVIiftheVIisnotalreadyopen.

2.

Right-clickthewireflowingfromtheSetTemperaturecontrolandselectProbefromtheshortcutmenu.

AfloatingProbeWatchWindowappearswhenyoucreateaprobe.LabVIEWnumberstheprobesautomaticallyanddisplaysthesamenumberinaglyphonthewireyouprobe,asshowninFigure10.

©NationalInstrumentsCorporation15

GettingStartedwiththeLabVIEWTouchPanel

Module

Figure10.AddingaProbetotheBlockDiagram

DeployingandDebuggingaTouchPanelApplication

Youmustusethedebuggingbuildspecificationtodeploytheapplication,whichcontainsdebugginginformation,tothetargetbeforetheprobeintheVIonthehostcomputercanupdatethevaluespassingthroughthewire.

CompletethefollowingstepstodeployanddebugtheTouchPanelapplication.

1.Right-clickthedebuggingbuildspecificationyouwanttobuildanddeployandselectDebugfrom

theshortcutmenu.SaveanyVIsifprompted.

LabVIEWbuildstheVIintoanapplication,deploystheapplicationtothetarget,andrunstheapplicationonthetarget.2.

ChangethevalueoftheSetTemperatureknobintheapplicationrunningonthetarget.ThevalueintheProbeWatchWindowontheblockdiagramonthehostcomputerupdatesasyouchangethevalueoftheknobintheapplication.

NoteAnychangesyoumakeonthefrontpaneloftheVIonthehostcomputerhavenoeffectontheapplicationrunningonthetarget.

3.

TaptheExitbuttonintheapplicationonthetargettostoptheapplicationandendthedebuggingsession.

GettingStartedwiththeLabVIEWTouchPanelModule

16ni.com

XPEmbeddedTutorial

UsethistutorialtolearnhowtoconfigureaTouchPanelXPEmbeddeddevicetousetheNITPCService;howtousetheTouchPanelProjectWizardtocreateaproject;andhowtobuild,deploy,run,anddebugaTouchPanelapplication.

TheVIinthistutorialsimulatessettingatemperature,displayingthecurrenttemperatureinagraphandonathermometer,andindicatingifthetemperatureisnotinrange.

CreatingtheLabVIEWProject

UseLabVIEWprojectstogrouptogetherLabVIEWfilesandnon-LabVIEWfiles,createbuild

specificationsforbuildingaTouchPanelVIintoanapplication,anddeploytheapplicationtothetarget.YoumustuseaprojecttobuildaTouchPanelVIintoanapplication.

UsingtheTouchPanelProjectWizard,completethefollowingstepstocreateaLabVIEWproject,addthetarget,andaddanexistingVItotheproject.

1.LaunchLabVIEW.IntheGettingStartedwindow,selectTouchPanelProjectfromtheTargets

pull-downmenu.ClicktheGobuttontolaunchtheTouchPanelProjectWizard.2.Definetheprojectinformation,asshowninFigure11.

a.SelectNewTouchPanelproject,importVIfromtheProjecttypepull-downmenutocreate

theLabVIEWprojectusinganexistingVI.

TipTheblankVIprojecttypecreatesaprojectwithanewTouchPaneltemplateVIratherthanimportinganexistingVI.

b.

SpecifyaprojectnameandthelocationwhereyouwanttosavetheprojectandtheVIintheProjectlocationtextbox.Savetheprojecttoalocationotherthanthedefaultlocationsoyoudonotoverwritetheshippingexamplewithyourchanges.ThedefaultprojectnameisUntitledproject.lvproj.Forthistutorial,nametheprojectTouchPanelTutorial.lvprojintheProjectlocationtextbox.

ClicktheBrowsebuttonnexttotheVIpathtextboxandnavigateto

labview\\examples\\TouchPanel\utorial\\TouchPanelTutorial.vitoselecttheVItoimport.ClicktheOKbuttontoaddtheVItotheprojectyouarecreating.

c.

©NationalInstrumentsCorporation17

GettingStartedwiththeLabVIEWTouchPanel

Module

Figure11.DefiningtheProjectInformation

3.4.ClicktheNextbutton.

SelectNITPC-2512DevicefromtheDevicetypepull-downmenu,asshowninFigure12.

GettingStartedwiththeLabVIEWTouchPanelModule

18ni.com

Figure12.SelectingtheTarget

NoteIfyouareusingathird-partyXPEmbeddeddevice,selectWindowsXPEmbeddedDevicefromtheDevicetypepull-downmenuinstead.

5.6.

ClicktheNextbutton.

Configureconnectioninformationforthedevice.EntertheIPaddressforthedeviceintheTouchPaneldeviceIPaddresstextbox,asshowninFigure13.

©NationalInstrumentsCorporation19

GettingStartedwiththeLabVIEWTouchPanel

Module

Figure13.ConfiguringtheDevice

7.8.

ClicktheNextbutton.

TheSystempreviewpage,showninFigure14,showsapreviewoftheprojectthewizardcreateswhenyouclicktheFinishbutton.NoticethecheckmarkintheCreateabuildspecification

checkbox.Thischeckmarkindicatesyouwanttocreateabuildspecificationimmediatelyafteryoucreatetheproject.RefertotheCreatingtheBuildSpecificationsectionformoreinformationaboutcreatingabuildspecification.

GettingStartedwiththeLabVIEWTouchPanelModule

20ni.com

Figure14.PreviewingtheProject

9.ClicktheFinishbutton.

BecausetheCreateabuildspecificationcheckboxcontainsacheckmarkasshowninFigure14,theApplicationPropertiesdialogboxopenswhenyouclicktheFinishbutton.

CreatingtheBuildSpecification

BuildspecificationscontainthebuildsettingsandcodegenerationoptionstousewhenyoubuildaTouchPanelVIintoanapplication.Youcancreatethebuildspecificationwhenyoucreateaprojectorwaituntilyouarereadytobuildtheapplication.YoumustcreateabuildspecificationbeforeyoucanbuildaTouchPanelVIintoanapplication.

Youcanhavemultiplebuildspecificationsforthesametarget.Forexample,youmightwantonebuildspecificationthatgeneratesdebugginginformationandanotherbuildspecificationthatdoesnotgeneratethisextrainformation.

NoteThistutorialcreatesthebuildspecificationthroughtheTouchPanelProjectWizard.Youalsocancreateabuildspecificationatanytimebyright-clickingBuildSpecificationsunderthetargetintheProjectExplorerwindowandselectingNew»TouchPanelApplication(EXE)fromtheshortcutmenu.

©NationalInstrumentsCorporation21

GettingStartedwiththeLabVIEWTouchPanel

Module

CompletethefollowingstepstocreateaTouchPanelbuildspecification.

1.DefinethesettingsfortheTouchPanelapplication,asshowninFigure15.

a.EnteranameforthebuildspecificationintheBuildspecificationnametextbox.Thisisthe

namethatappearsunderBuildSpecificationsintheProjectExplorerwindow.

b.EnternamefortheapplicationintheTargetfilenametextbox.Forthistutorial,namethe

applicationTouchPanelTutorial.exe.

c.BrowsetoandselectthedestinationdirectoryfortheTouchPanelapplicationonthehost

computer,whichiswhereLabVIEWsavesthe.exe,intheLocaldestinationdirectorytextbox.

d.EnterthedestinationdirectoryfortheTouchPanelapplicationontheTouchPaneltargetin

theTargetdestinationdirectorytextbox.

Figure15.DefiningtheApplicationInformation

2.3.

(Optional)ClicktheHelpbuttontoopentheLabVIEWHelpandreadadescriptionofeachbuildsetting.

SelecttheSourceFilescategorytoselectthesourcefilestoincludewhenyoubuildtheTouchPanelVIintoaTouchPanelapplication.WhenyouusetheTouchPanelProjectWizardtocreateabuildspecification,LabVIEWautomaticallyusestheVIyouimportasthestartupVI.Whenyoucreatebuildspecificationsoutsideofthewizard,youmustselectthestartupVImanuallyandclickthebluearrowbuttontomovetheVItotheStartupVIslistbox,asshowninFigure16.YoumustdefineatleastoneVIasthestartupVIfortheapplication.

GettingStartedwiththeLabVIEWTouchPanelModule

22ni.com

Figure16.SelectingtheSourceFiles

4.

Inthistutorial,youcanusethedefaultsettingsforthefollowingcategories:•Destinations—Specifiesdestinationsettings,addsdestinationdirectoriesfortheapplication,

andindicateswhetherLabVIEWaddsthefilestoanewprojectlibrary.•SourceFileSettings—Specifiesdestinationsandpropertiesforindividualfilesandfolders

intheapplication.•Icon—Specifiestheiconfiletoassociatewiththeapplication.•Advanced—Configuresadvancedsettingsfortheapplication.•AdditionalExclusions—Configuressettingstodisconnecttypedefinitions,removesunused

polymorphicVIinstances,andremovesunusedmembersofprojectlibrariestoreducethesizeoftheapplication.•VersionInformation—Specifiestheversionnumberandotherapplicationinformation.•Run-TimeLanguages—Setsthelanguagepreferencesfortheapplication.SelectthePreviewcategoryandclicktheGeneratePreviewbuttontoviewthefilenamesandpathstothefilestheTouchPanelModulegenerateswhenyoubuildtheTouchPanelVIintoaTouchPanelapplication.

ClicktheOKbutton.ThebuildspecificationyoucreatedappearsintheProjectExplorerwindowundertheTouchPaneltarget,asshowninFigure17.

5.

6.

©NationalInstrumentsCorporation23

GettingStartedwiththeLabVIEWTouchPanel

Module

Figure17.ProjectExplorerWindow

7.8.

SelectFile»SaveProjectintheProjectExplorerwindowtosavetheproject.LabVIEWsavesanybuildspecificationswiththeproject.

EnsurethattheNITPCServiceisrunningonthedevice.

a.Right-clicktheTouchPaneltargetintheProjectExplorerwindowandselectProperties

fromtheshortcutmenutodisplaytheTouchPanelTargetPropertiesdialogbox.

b.OntheGeneralpage,clicktheTestbuttontoconfirmthattheNITPCServiceisrunningon

thetarget.

BuildingtheVIintoanApplicationandDeploying

AfteryoudeveloptheVIonthehostcomputer,youbuildtheVIintoanexecutableapplicationthatyoucanrunonatarget.PickoneoftheoptionsintheUsingtheShortcutMenusectionortheUsingtheRunButtonsectionofthismanualtobuild,deploy,andruntheapplication.

UsingtheShortcutMenu

Right-clickthebuildspecificationintheProjectExplorerwindowandselectoneofthefollowingoptionsfromtheshortcutmenu:•Deploy—BuildstheVIintoanapplication,ifnecessary,anddeploystheapplicationtothetarget.

Thisoptiondoesnotruntheapplicationautomatically.•Run—BuildstheVIintoanapplication,ifnecessary;deploystheapplicationtothetarget;and

runstheapplicationautomatically.•Build—BuildstheVIintoanapplication.Thisoptiondoesnotdeployorruntheapplication

automatically.

GettingStartedwiththeLabVIEWTouchPanelModule

24

ni.com

UsingtheRunButton

WhenyourunaVIundertheTouchPaneltargetintheProjectExplorerwindow,theRunbuttonbehavesdifferentlyfromwhenyourunaVIunderMyComputerintheProjectExplorerwindow:•Ifyouwanttobuild,deploy,andrun—ClicktheRunbuttoninaVItobuildtheVIintoan

application,deploytheapplicationtothetarget,andruntheapplicationonthetarget.LabVIEWpromptsyoutocreateabuildspecificationifyoudonothaveanexistingbuildspecificationfortheVI.Ifyouhavemultiplebuildspecifications,LabVIEWpromptsyoutoselectabuild

specificationintheSelectaBuildSpecificationdialogbox.Alternatively,youcanspecifyadefaultbuildspecificationbyright-clickingabuildspecificationintheProjectExplorerwindowandselectingSetasDefaultfromtheshortcutmenu.LabVIEWindicatesthedefaultbuildspecificationwithagreensquarearoundthebuildspecificationglyphintheProjectExplorerwindow.•Ifyouwanttobuildwithoutdeployingorrunning—Pressthekeywhileyouclickthe

RunbuttoninaVItobuildtheVIintoanapplicationwithoutdeployingorrunningtheapplication.LabVIEWpromptsyoutocreateabuildspecificationifyoudonothaveanexistingbuild

specificationfortheTouchPanelVI.Ifyouhavemultiplebuildspecifications,LabVIEWpromptsyoutoselectabuildspecificationintheSelectaBuildSpecificationdialogbox.Alternatively,youcanspecifyadefaultbuildspecificationbyright-clickingabuildspecificationintheProjectExplorerwindowandselectingSetasDefaultfromtheshortcutmenu.LabVIEWindicatesthedefaultbuildspecificationwithagreensquarearoundthebuildspecificationglyphintheProjectExplorerwindow.

DebuggingtheTouchPanelApplication

YoumustcreateabuildspecificationthatenablesdebuggingbeforeyoucandebugaTouchPanelapplication.

WhenLabVIEWonthehostcomputerconnectstotheTouchPaneltarget,theapplicationrunsontheTouchPaneltarget.ThefrontpanelisfullyfunctionalontheTouchPaneltarget.ThefrontpanelcontrolsaffecttheTouchPanelapplication,andtheindicatorsintheTouchPanelVIonthehostcomputerreflecttheexecutionoftheapplicationontheTouchPaneltarget.

TheblockdiagramactsasaconduitbetweentheTouchPanelapplicationrunningonthetargetandtheTouchPanelVIrunningonthehostcomputer,whereyoucanprobesignals,setbreakpoints,andstepthroughcodeasyoudoinanyotherVI.

DebuggingTouchPanelapplicationsforXPEmbeddedtargetsissimilartodebuggingstand-aloneapplicationsthatyoucreatewiththeApplicationBuilder.Formoreinformationaboutdebugging

stand-aloneapplications,refertotheDebuggingApplicationsandSharedLibrariestopicintheLabVIEWHelp.

TipYoucanmodifyanexistingbuildspecificationbydouble-clickingthebuildspecificationintheProjectExplorerwindoworright-clickingthebuildspecificationandselectingPropertiesfromtheshortcutmenu.Thistutorialcreatesasecondbuildspecificationfordebugging.

CreatingaDebuggingBuildSpecification

Completethefollowingstepstocreateadebuggingbuildspecification.

1.Right-clickBuildSpecificationsundertheTouchPaneltargetandselectNew»TouchPanel

Application(EXE)fromtheshortcutmenutoopentheApplicationPropertiesdialogbox.2.Enter(Debug)TouchPanelTutorialintheBuildspecificationnametextbox.

3.Enter(Debug)TouchPanelTutorial.exeintheTargetfilenametextbox,asshownin

Figure18.

©NationalInstrumentsCorporation25

GettingStartedwiththeLabVIEWTouchPanel

Module

Figure18.CreatingtheDebuggingBuildSpecification

4.

5.6.7.

SelectSourceFilesfromtheCategorylistandselectTouchPanelTutorial.viintheProjectFileslist.ClickthebluerightarrowbuttontomovetheVIfromtheProjectFileslisttotheStartupVIslistbox.

SelectAdvancedfromtheCategorylist.

PlaceacheckmarkintheEnabledebuggingcheckboxtogeneratedebugginginformationwhenyoubuildtheTouchPanelVIintoanapplication.

ClicktheOKbutton.ThebuildspecificationyoucreatedappearsintheProjectExplorerwindow,asshowninFigure19.

GettingStartedwiththeLabVIEWTouchPanelModule

26ni.com

Figure19.TwoBuildSpecificationsintheProjectExplorerWindow

AddingaProbetotheTouchPanelVI

Probesdisplayinformationaboutthedatathatpassesthroughawire.AsyouinteractwiththeTouchPanelapplicationontheTouchPaneltarget,youcanseethedatapassingthroughthewireintheTouchPanelVIonthehostcomputer.

CompletethefollowingstepstoaddaprobetotheTouchPanelTutorialVI.

1.SelectWindow»ShowBlockDiagramintheVItoopentheblockdiagramifitisnotvisible.

TipDouble-clicktheVIintheProjectExplorerwindowtoopentheVIiftheVIisnotalreadyopen.

2.

Right-clickthewireflowingfromtheSetTemperaturecontrolandselectProbefromtheshortcutmenu.

AfloatingProbeWatchWindowappearswhenyoucreateaprobe.LabVIEWnumberstheprobesautomaticallyanddisplaysthesamenumberinaglyphonthewireyouprobe,asshowninFigure20.

©NationalInstrumentsCorporation27

GettingStartedwiththeLabVIEWTouchPanel

Module

Figure20.AddingaProbetotheBlockDiagram

DeployingandDebuggingaTouchPanelApplication

YoumustusethedebuggingbuildspecificationtodeploytheTouchPanelVI,whichcontainsdebugginginformation,totheTouchPaneltargetbeforetheprobeintheTouchPanelVIonthehostcomputercanupdatethevaluespassingthroughthewire.

CompletethefollowingstepstodeployanddebugtheTouchPanelapplication.

1.Right-clickthebuildspecificationfortheVIyouwanttobuildanddeployandselectDebugfrom

theshortcutmenu.SaveanyVIsifprompted.

LabVIEWbuildstheVIintoanapplication,deploystheapplicationtotheTouchPaneltarget,andrunstheapplicationonthetarget.2.

ChangethevalueoftheSetTemperatureknobintheTouchPanelapplicationrunningontheTouchPaneltarget.ThevalueintheProbeWatchWindowontheblockdiagramonthehostcomputerupdatesasyouchangethevalueoftheknobintheTouchPanelapplication.

TaptheExitbuttonintheapplicationontheTouchPaneltargettostoptheapplicationandendthedebuggingsession.

3.

GettingStartedwiththeLabVIEWTouchPanelModule

28ni.com

RelatedDocumentation

LabVIEWincludesdocumentationfornewandexperiencedLabVIEWusers.ThefollowingdocumentscontaininformationthatyoumightfindhelpfulasyouusetheTouchPanelModule:•LabVIEWHelp—RefertotheLabVIEWHelp,availablebyselectingHelp»LabVIEWHelpin

LabVIEW,forinformationaboutLabVIEWprogrammingconcepts,step-by-stepinstructionsforusingLabVIEW,andreferenceinformationaboutLabVIEWVIs,functions,palettes,menus,andtools.RefertotheTouchPanelModulebookontheContentstaboftheLabVIEWHelpforinformationspecifictotheTouchPanelModuleandTouchPanelapplications.TheLabVIEWHelpuses(TPC)intheindextoindicateTouchPanel-specifictopics.•LabVIEWTouchPanelModuleReadme—RefertotheLabVIEWTouchPanelModuleReadme,

availablebyselectingStart»AllPrograms»NationalInstruments»LabVIEW»Readmeandopeningreadme_TouchPanel.html,forlast-minuteinformationandknownissues.•TouchPanelModuleExamples—UsetheTouchPanelModuleexamplestolearnhowtousecertain

VIsandfunctionsaswellasastartingpointfordevelopingyourownTouchPanelVIsand

applications.Youcanmodifyanexampletofitanapplication,oryoucancopyandpastefromoneormoreexamplesintoaVIthatyoucreate.BrowseorsearchtheexampleVIswiththeNIExampleFinderbyselectingHelp»FindExamples.•NI-DAQmxBase3.xGettingStartedGuide•NI-DAQmxBaseReadme•Documentationforyourdevice.•LabVIEWPDFs—Inadditiontothisdocument,theGettingStartedwithLabVIEWmanual,LabVIEW

QuickReferenceCard,LabVIEWReleaseNotes,andLabVIEWUpgradeNotesareavailableasPDFsbyselectingStart»AllPrograms»NationalInstruments»LabVIEW»LabVIEWManuals.

NoteYoumusthaveAdobeReaderinstalledtoviewthePDFs.RefertotheAdobeSystemsIncorporatedWebsiteatwww.adobe.comtodownloadAdobeReader.RefertotheNationalInstrumentsProductManualsLibraryatni.com/manualsforupdateddocumentationresources.

©NationalInstrumentsCorporation29

GettingStartedwiththeLabVIEWTouchPanel

Module

LabVIEW,NationalInstruments,NI,ni.com,theNationalInstrumentscorporatelogo,andtheEaglelogoaretrademarksofNationalInstrumentsCorporation.RefertotheTrademarkInformationsectionatni.com/trademarksforotherNationalInstrumentstrademarks.Otherproductandcompanynamesmentionedhereinaretrademarksortradenamesoftheirrespectivecompanies.ForpatentscoveringNationalInstrumentsproducts/technology,refertotheappropriatelocation:Help»Patentsinyoursoftware,thepatents.txtfileonyourmedia,ortheNationalInstrumentsPatentNoticeatni.com/patents.

©

2006–2010NationalInstrumentsCorporation.Allrightsreserved.371940E-01Jun10

因篇幅问题不能全部显示,请点此查看更多更全内容