您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 信息化管理 > LabVIEW变量类型及处理
1、DataManipulationOverviewandApplicationsAgenda•OverviewofLabVIEWdatatypes•ManipulatingLabVIEWdatatypes–Changingdatatypes–Bytelevelmanipulationofdata–Bitlevelmanipulationofdata•Applicationsinvolvingdatamanipulation–Dataencryption–InstrumentI/OByteUnsignedByteWordUnsignedWordLongUnsignedLongSinglePrecisionDoublePrecisionExtendedPrecision8bits8bits16bits16bits32bits32bits8bytesSun:16bytesWindows/Linux:10bytesPowerMac:Double/Double4bytesLabVIEWDataTypes:NumericLabVIEWDataTypes:Arrays•Storedashandles。
2、containing:–Sizeofeachdimension(inunsignedlongintegers,U32s)–Data(sizeofelementsvariesbutisconsistentthrougharray)•Toaligndatacorrectly,afewbytesofpaddingmaybeaddedbeforethefirstelementofdata•Arrayisacontinuousblockofmemory1DarrayofSGLs4DarrayofI16sLabVIEWDataTypes:Others•Booleans:8bits–Allzeros=FALSE,nonzero=TRUE•Strings:1Darrayofunsignedbytes•ArrayofStrings:arrayofU32handlestostringlocations•Paths:handlescontainingpathtypeandnumberofpathcomponentsinU16s–Byte0,1:•0(abs),1(rel),3(UNC)–Byte2,3•#o。
3、fpathcomponentsLabVIEWDataTypes:Clusters•Datastoredaccordingtoclusterorder•Scalardatastoreddirectlyincluster•Arrays,strings,andpathsstoredasahandletothememorylocationwherethedataisstored•Paddingmayneedtobeadded,dependingonOSExample:clusterofSGL,EXT,and1DarrayofU16sWindowsMacSunFlattenedData•Flatdatatakesupacontinuousblockofmemory–Scalarandarraynumericsareflat–Stringsareflat–Arraysofstringsarenotflat–Clustersmaybeflat(ifsimplenumerics,forexample)•DuringFileI/OLabVIEWautomaticallyflattensalldatato。
4、easestoragetodisk•Flatten/Unflattento/fromStringfunctionsperformthesameoperationsinmemoryFlattenedData•Flatteneddatanormalizedtostandardformforplatformindependence–Numericdatainbigendianform(MSBfirst)•Windowsappsmayneedtobelittleendian–swapbytes–Sunformatforextendedprecisionnumbers•Flattenedformdoesnothavedataencoding–Whenunflattening,datatypeneedstobeknown–Typedescriptorusedtodefinedatatype*demoTypeDescriptors•SequenceofwordintegersthatcandescribeanydatatypeinLabVIEW.•lengthtypecode–lengthI16si。
5、zeinbytes(includinglengthword)–typecodedescriptionofdata–Someadditionalinfomayfollowtypecode–Arraysandclustersstructured(sincethereareotherdatatypes)–Canquicklygetcomplicatedtodecipher*demoChangingLabVIEWDataTypes•Typecast–Changedatatypeofinformation–Workswithflatdata,1Darraysofflatdata,andstrings–Defaulttypeisstring•Flatten/Unflattento/fromString–Workwithalldata–BehaveslikeLabVIEWinternalflattenfunction*demoByteLevelDataManipulation•Split/Joinnumericvaluesintonewdata•SwapBytes/Wordstoreorderexi。
6、stingdata•Convertdatatounsignedbytes/words/longwordstomanipulateatthebytelevel•Convertdatatostringstousestringfunctionsformanipulation*demoBitLevelManipulation•RotateLeft/RightwithCarrytomovebitsandeffectothervalues•Rotatetomovebitswithinavalue•Logicalshiftmovesbits,putting0sintheirplace•Turndataintounsignedbytestousethesefunctionseasily•ForcustombitmanipulationturndataintoBooleanarrays*demos(2)ApplicationsofDataManipulation-Encryption•Standardsexistforprocess(NIST,privatecorporation,etc)–Scramb。
7、leddataiscalledciphertext,unscrambleddataplaintext–Dataoftenencryptedusingakey–usuallyaspecificnumberofrandombitsanderrorcheckingbits•Ex:64bitkey:56databits,8paritybits(oneperbyteofkeydata)•Symmetric-key(PrivateKey):eachuserhasaccesstothesamekey–Pro:canbeveryfast–Con:easiertocompromise(onekeytocompromise)•Public-key:eachuserhasapublicandprivatekey•Allsortsofalgorithmsexisttoencryptdata(DES,IDEA,Blowfish,etc)•Webhasagoodsourceofintropages–•Hooka3rdpartyDLL(orActiveXcontrol)intoLabVIEWusingtheCall。
8、LibraryNode(complexities,speed,usability,etc)•Growyourown–Probablynotassecure(butgoodenough?)–Probablyeasiertoimplement/understand–Someoptions:•Simplebitshifting•Keycipheringwithyourownalgorithm(ex:passwords)•ImplementationofknownalgorithminnativeG-code*demos(3)Applications–InstrumentI/O•Instruments(GPIB,ethernet,RS-232,etc)canoftentransferdatatoahostPCinavarietyofformats–ASCII:easiesttoreadbutlargestbytetransfer–Binary:moredifficulttousebutmuchmorecompact•Willprobablyneedtotypecastdataafteritis。
9、received•Myneedtobyteswapdata•Usebinarytransfersforfasterdatatransfers•Whenpossible,pickthesmallestdatatypefortransferApplications-WaveformTransfers•ASCIIWaveforms•BinaryWaveforms–1-byteintegers–2-byteintegersQuestions?。
本文标题:LabVIEW变量类型及处理
链接地址:https://www.777doc.com/doc-3309234 .html