LabVIEW变量类型及处理

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

DataManipulationOverviewandApplicationsAgenda•OverviewofLabVIEWdatatypes•ManipulatingLabVIEWdatatypes–Changingdatatypes–Bytelevelmanipulationofdata–Bitlevelmanipulationofdata•Applicationsinvolvingdatamanipulation–Dataencryption–InstrumentI/OByteUnsignedByteWordUnsignedWordLongUnsignedLongSinglePrecisionDoublePrecisionExtendedPrecision8bits8bits16bits16bits32bits32bits8bytesSun:16bytesWindows/Linux:10bytesPowerMac:Double/Double4bytesLabVIEWDataTypes:NumericLabVIEWDataTypes:Arrays•Storedashandlescontaining:–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•#ofpathcomponentsLabVIEWDataTypes:Clusters•Datastoredaccordingtoclusterorder•Scalardatastoreddirectlyincluster•Arrays,strings,andpathsstoredasahandletothememorylocationwherethedataisstored•Paddingmayneedtobeadded,dependingonOSExample:clusterofSGL,EXT,and1DarrayofU16sWindowsMacSunFlattenedData•Flatdatatakesupacontinuousblockofmemory–Scalarandarraynumericsareflat–Stringsareflat–Arraysofstringsarenotflat–Clustersmaybeflat(ifsimplenumerics,forexample)•DuringFileI/OLabVIEWautomaticallyflattensalldatatoeasestoragetodisk•Flatten/Unflattento/fromStringfunctionsperformthesameoperationsinmemoryFlattenedData•Flatteneddatanormalizedtostandardformforplatformindependence–Numericdatainbigendianform(MSBfirst)•Windowsappsmayneedtobelittleendian–swapbytes–Sunformatforextendedprecisionnumbers•Flattenedformdoesnothavedataencoding–Whenunflattening,datatypeneedstobeknown–Typedescriptorusedtodefinedatatype*demoTypeDescriptors•SequenceofwordintegersthatcandescribeanydatatypeinLabVIEW.•lengthtypecode–lengthI16sizeinbytes(includinglengthword)–typecodedescriptionofdata–Someadditionalinfomayfollowtypecode–Arraysandclustersstructured(sincethereareotherdatatypes)–Canquicklygetcomplicatedtodecipher*demoChangingLabVIEWDataTypes•Typecast–Changedatatypeofinformation–Workswithflatdata,1Darraysofflatdata,andstrings–Defaulttypeisstring•Flatten/Unflattento/fromString–Workwithalldata–BehaveslikeLabVIEWinternalflattenfunction*demoByteLevelDataManipulation•Split/Joinnumericvaluesintonewdata•SwapBytes/Wordstoreorderexistingdata•Convertdatatounsignedbytes/words/longwordstomanipulateatthebytelevel•Convertdatatostringstousestringfunctionsformanipulation*demoBitLevelManipulation•RotateLeft/RightwithCarrytomovebitsandeffectothervalues•Rotatetomovebitswithinavalue•Logicalshiftmovesbits,putting0sintheirplace•Turndataintounsignedbytestousethesefunctionseasily•ForcustombitmanipulationturndataintoBooleanarrays*demos(2)ApplicationsofDataManipulation-Encryption•Standardsexistforprocess(NIST,privatecorporation,etc)–Scrambleddataiscalledciphertext,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)intoLabVIEWusingtheCallLibraryNode(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•Willprobablyneedtotypecastdataafteritisreceived•Myneedtobyteswapdata•Usebinarytransfersforfasterdatatransfers•Whenpossible,pickthesmallestdatatypefortransferApplications-WaveformTransfers•ASCIIWaveforms•BinaryWaveforms–1-byteintegers–2-byteintegersQuestions?

1 / 17
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功