labview编程技巧-----labview与INI文件

2015-08-21 11:07:02   来源:eefocus   

关键字: labview  编程技巧  INI文件

在WIN95以前,WINDOWS还没有引入注册表的概念,WINDOWS是利用INI文件来存储计算机相关配置的,在API里,WINDOWS提供了丰富的API函数来操作INI文件,LV里也专门有个子类别封装了这些API函数,使用非常方便。


LV使用INI文件来存储配置,应用非常广泛,生成执行文档后也自动生成一个INI文件。

LV主要在下列情况下使用INI文件:

存储前面板或者前面板特定控件的默认值和当前值

存储本次应用的运行结果供下一次启动是调用

存储硬件配置文件

存储硬件配置是非常重要的,比如一般的板卡都有16个数字输出,外部接继电器来控制外部设备,继电器是比较容易损坏的,而通常16个继电器中是有备用的,如何在不改变软件和硬件的情况下把输出更改到另外的继电器上,这样,只需要简单地改动一下外部接线就可以了那,使用配置文件可以轻松实现。

INI文件结构很简单,装了多操作系统的人都知道,WINDOWS本身有个BOOT.INI

[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect



我们看一下LV软件本身也利用了INI文件来保存配置。

[LabVIEW]
server.tcp.port=3363
server.tcp.enabled=TRUE
server.tcp.access="+127.0.0.1"
IsFirstLaunch=False
PaletteHidddenControlCategories_LocalHost="Modern;System;Classic;Control Design & Simulation;.NET & ActiveX;Addons;"
PaletteHidddenFunctionlCategories_LocalHost="Programming;Measurement I/O;Instrument I/O;Vision and Motion;Mathematics;Signal Processing;Data Communication;Connectivity;Control Design & Simulation;SignalExpress;Addons;"
menuSetup="default"
saveFloaterLocations=True
find.viListFlags=4
LastErrorListSize=0,0,379,486
paletteStyle="NamedIcons"
NoAdvice070=",CleanUpWire,FlatSequence"
SaveChanges_ApplyToAll=True
PropPageBounds="398;181;884;636"
RecentFiles.pathList="C:\Program Files\National Instruments\LabVIEW 8.5\examples\DAQmx\Analog In\Measure Voltage.llb\Acq&Graph Voltage-Int Clk.vi;C:\Program Files\National Instruments\LabVIEW 8.5\examples\DAQmx\Analog In\Measure Voltage.llb\Acq&Graph Voltage-Ext Clk-Analog Ref.vi;C:\Documents and Settings\Administrator\Local Settings\Temporary Internet Files\Content.IE5\7M9NS8HF\chart%20right%20to%20left[1].vi;C:\Documents and Settings\Administrator\My Documents\windows_environment_variable_reader_writer\Windows Environment Variable Reader Writer.vi;C:\Documents and Settings\Administrator\My Documents\MDI.llb\Simple MDI Demo.vi;D:\Control 1.ctl;C:\Program Files\National Instruments\LabVIEW 8.5\vi.lib\tree\Tree Sorter.llb\Join.vi;C:\Program Files\National Instruments\LabVIEW 8.5\vi.lib\Utility\notifier.llb\Create Notifier.vi;C:\Program Files\National Instruments\LabVIEW 8.5\vi.lib\Utility\notifier.llb\Wait On Notification.vi;C:\Program Files\National Instruments\LabVIEW 8.5\vi.lib\Utility\inputDevices.llb\Acquire Input Data.vi"
ShowBufferAllocationsArrays=True
ShowBufferAllocationsClusters=True
ShowBufferAllocationsStrings=False
ShowBufferAllocationsPaths=False
ShowBufferAllocationsScalars=False
ShowBufferAllocationsVariants=False
ShowBufferAllocationsOther=False
NewDlgRecentMainTemplates.pathList="C:\Program Files\National Instruments\LabVIEW 8.5\templates\Frameworks\DesignPatterns\ProducerConsumerEvents.vit"
NewDlgBounds="700;480"
NewDlgRecentTemplates.pathList=""
NewDlgLastSelected="8E4D36AD-F776-4C48-97C6-C1D85EFE889F"
NewDlgSmall=False
NewDlgCollapsed="77E350A8-F9AA-43FF-85E2-454279EBB9A7/Frameworks 3F7CF7A8-5E4D-4EDC-AA25-FA4A326988EF 8E4D36AD-F776-4C48-97C6-C1D85EFE889F"
SuperSecretPrivateSpecialStuff=True
colorHistoryItemA=00000BFF
RecentFiles.projectPathList="C:\Documents and Settings\Administrator\My Documents\xcontrol events\xcontrol events\XControl Events Project.lvproj;C:\Program Files\National Instruments\LabVIEW 8.5\examples\general\xcontrols\Dual Mode Thermometer\Simple Dual Mode Thermometer XControl.lvproj;C:\Program Files\National Instruments\LabVIEW 8.5\examples\lvdsc\XControls\Spinner\Spinner.lvproj;C:\Documents and Settings\Administrator\My Documents\Linked_List_Project\Linked List\Linked_List_Project.lvproj;D:\TEST\Untitled Project 1.lvproj;C:\Documents and Settings\Administrator\My Documents\Scripting_Tools_0.16.02\Scripting Tools\Scripting Tools.lvproj;C:\Documents and Settings\Administrator\My Documents\IconEditor_85_V2.2\IconEditor.lvproj;C:\Documents and Settings\Administrator\My Documents\第一名_何凌_公司问题\第一名 何凌 公司问题\Src\VI company.lvproj"
ProjectExplorer.ClassicPosition=143,53,543,415
colorHistoryItemB=009A8574
editRecentPaths="C:\Program Files\National Instruments\LabVIEW 8.5\vi.lib\Utility\sysinfo.llb;C:\Program Files\National Instruments\LabVIEW 8.5\vi.lib\Utility\semaphor.llb;C:\Program Files\National Instruments\LabVIEW 8.5\vi.lib\Utility\miscctls.llb;C:\Program Files\National Instruments\LabVIEW 8.5\vi.lib\Utility\GetType.llb;C:\Program Files\National Instruments\LabVIEW 8.5\vi.lib\Utility\inputDevices.llb;C:\Program Files\National Instruments\LabVIEW 8.5\vi.lib\Utility\notifier.llb;C:\Program Files\National Instruments\LabVIEW 8.5\vi.lib\tree\Tree Sorter.llb"
LLBMgr_ActivePlugins=""
LLBMgr_RecentPath="C:\Documents and Settings\Administrator\My Documents\MDI.llb"
colorHistoryItemC=00FF8242
autoerr=2
colorHistoryItemD=00000FDC
colorHistoryItemE=003100DC
colorHistoryItemF=00FFFFFF
colorHistoryItemG=00FF3D00
colorHistoryItemH=000F00DC
colorHistoryItemI=004AFF42
colorHistoryItemJ=00C88E00
colorHistoryItemK=000025FF
exoticControls=TRUE
NoAdvice080=",ClassBrowser"
SuperPrivateScriptingFeatureVisible=True 
SuperSecretPrivateSpecialStuff=True
superPrivateScriptingFeatureSichtbar=True

FPFont="0" 18
BDFont="0" 18
toolPaletteLoc=494,22,645,100
LVLibraryThemeColor=006699FF

[1] [2]
本网站转载的所有的文章、图片、音频视频文件等资料的版权归版权所有人所有,本站采用的非本站原创文章及图片等内容无法一一联系确认版权者。如果本网所选内容的文章作者及编辑认为其作品不宜公开自由传播,或不应无偿使用,请及时通过电子邮件或电话通知我们,以迅速采取适当措施,避免给双方造成不必要的经济损失。

推荐阅读

编辑:什么鱼
本文引用地址: http://www.eeworld.com.cn/Test_and_measurement/2015/0821/article_12874.html
[发表评论]
[加入收藏]
[打印本页]
[关闭窗口]
[返回顶部]
[RSS订阅]
小广播
每日新闻
最热点击
本周热门资源推荐
EEWORLD独家
论坛精华
精选博文