ni-motion vi helpthis help file provides a comprehensive reference of all ni-motion virtual...

549

Upload: others

Post on 17-Mar-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems
Page 2: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

NI-Motion™VIHelpJuly2007,370537H-01

ThishelpfileprovidesacomprehensivereferenceofallNI-MotionVirtualInstruments(VIs).ThisdocumentisintendedforusebydevelopersofNI-MotionsystemswithaworkingknowledgeofLabVIEW.

Formoreinformationaboutthishelpfile,refertothefollowingtopics:

UsingHelp

RelatedDocumentation

Glossary

ImportantInformation

TechnicalSupportandProfessionalServices

TocommentonNationalInstrumentsdocumentation,refertotheNationalInstrumentsWebsite.

©1999–2007NationalInstrumentsCorporation.Allrightsreserved.

Page 3: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingHelpConventions

NavigatingHelp

SearchingHelp

PrintingHelpFileTopics

Page 4: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ConventionsThishelpfileusesthefollowingformattingandtypographicalconventions:

<>Anglebracketsthatcontainnumbersseparatedbyanellipsisrepresentarangeofvaluesassociatedwithabitorsignalname—forexample,AO<0..3>.

[] Squarebracketsencloseoptionalitems—forexample,[response].

»

The»symbolleadsyouthroughnestedmenuitemsanddialogboxoptionstoafinalaction.ThesequenceFile»PageSetup»OptionsdirectsyoutopulldowntheFilemenu,selectthePageSetupitem,andselectOptionsfromthelastdialogbox.Thisicondenotesatip,whichalertsyoutoadvisoryinformation.Thisicondenotesanote,whichalertsyoutoimportantinformation.Thisicondenotesacaution,whichadvisesyouofprecautionstotaketoavoidinjury,dataloss,orasystemcrash.

boldBoldtextdenotesitemsthatyoumustselectorclickinthesoftware,suchasmenuitemsanddialogboxoptions.Boldtextalsodenotesparameternames.

darkred Textinthiscolordenotesacaution.

green Underlinedtextinthiscolordenotesalinktoahelptopic,helpfile,orWebaddress.

italicItalictextdenotesvariables,emphasis,cross-references,oranintroductiontoakeyconcept.Italictextalsodenotestextthatisaplaceholderforawordorvaluethatyoumustsupply.

monospace

Textinthisfontdenotestextorcharactersthatyoushouldenterfromthekeyboard,sectionsofcode,programmingexamples,andsyntaxexamples.Thisfontisalsousedforthepropernamesofdiskdrives,paths,directories,programs,subprograms,subroutines,devicenames,functions,operations,variables,filenames,andextensions.

Page 5: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

NavigatingHelp(WindowsOnly)Tonavigatethishelpfile,usetheContents,Index,andSearchtabstotheleftofthiswindoworusethefollowingtoolbarbuttonslocatedabovethetabs:

Hide—Hidesthenavigationpanefromview.Locate—LocatesthecurrentlydisplayedtopicintheContentstab,allowingyoutoviewrelatedtopics.Back—Displaysthepreviouslyviewedtopic.Forward—DisplaysthetopicyouviewedbeforeclickingtheBackbutton.Options—Displaysalistofcommandsandviewingoptionsforthehelpfile.

Page 6: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

SearchingHelp(WindowsOnly)UsetheSearchtabtotheleftofthiswindowtolocatecontentinthishelpfile.Ifyouwanttosearchforwordsinacertainorder,suchas"relateddocumentation,"addquotationmarksaroundthesearchwordsasshownintheexample.SearchingfortermsontheSearchtaballowsyoutoquicklylocatespecificinformationandinformationintopicsthatarenotincludedontheContentstab.

Page 7: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Wildcards

Youalsocansearchusingasterisk(*)orquestionmark(?)wildcards.Usetheasteriskwildcardtoreturntopicsthatcontainacertainstring.Forexample,asearchfor"prog*"liststopicsthatcontainthewords"program,""programmatically,""progress,"andsoon.

Usethequestionmarkwildcardasasubstituteforasinglecharacterinasearchterm.Forexample,"?ext"liststopicsthatcontainthewords"next,""text,"andsoon.

NoteWildcardsearchingwillnotworkonSimplifiedChinese,TraditionalChinese,Japanese,andKoreansystems.

Page 8: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

NestedExpressions

Usenestedexpressionstocombinesearchestofurtherrefineasearch.YoucanuseBooleanexpressionsandwildcardsinanestedexpression.Forexample,"exampleAND(programORVI)"liststopicsthatcontain"exampleprogram"or"exampleVI."Youcannotnestexpressionsmorethanfivelevels.

Page 9: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

BooleanExpressions

Clickthe buttontoaddBooleanexpressionstoasearch.ThefollowingBooleanoperatorsareavailable:

AND(default)—Returnstopicsthatcontainbothsearchterms.Youdonotneedtospecifythisoperatorunlessyouareusingnestedexpressions.OR—Returnstopicsthatcontaineitherthefirstorsecondterm.NOT—Returnstopicsthatcontainthefirsttermwithoutthesecondterm.NEAR—Returnstopicsthatcontainbothtermswithineightwordsofeachother.

Page 10: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

SearchOptions

UsethefollowingcheckboxesontheSearchtabtocustomizeasearch:

Searchpreviousresults—Narrowstheresultsfromasearchthatreturnedtoomanytopics.Youmustremovethecheckmarkfromthischeckboxtosearchalltopics.Matchsimilarwords—Broadensasearchtoreturntopicsthatcontainwordssimilartothesearchterms.Forexample,asearchfor"program"liststopicsthatincludethewords"programs,""programming,"andsoon.Searchtitlesonly—Searchesonlyinthetitlesoftopics.

Page 11: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

PrintingHelpFileTopics(WindowsOnly)CompletethefollowingstepstoprintanentirebookfromtheContentstab:

1. Right-clickthebook.2. SelectPrintfromtheshortcutmenutodisplaythePrintTopicsdialogbox.3. SelectthePrinttheselectedheadingandallsubtopicsoption.

NoteSelectPrinttheselectedtopicifyouwanttoprintthesingletopicyouhaveselectedintheContentstab.

4. ClicktheOKbutton.

Page 12: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

PrintingPDFDocuments

ThishelpfilemaycontainlinkstoPDFdocuments.ToprintPDFdocuments,clicktheprintbuttonlocatedontheAdobeAcrobatViewertoolbar.

Page 13: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

AxesAnaxisconsistsofatrajectorygenerator,PIDorsteppercontrolblock,andsomesortofoutputresource,eitheradigital-to-analogconverter(DAC)outputorastepperpulsegeneratoroutput.Servoaxesmustalsohavesomesortoffeedbackresource,eitheranencoderorADCchannel.Closed-loopstepperaxesalsorequireafeedbackresource,andcanuseeitherencoderorADCinputs.Open-loopstepperaxesdonotrequirefeedbackforcorrectoperation.ThefollowingtableliststheresourceIDsforaxes:

ResourceName ResourceIDAxisControl 0x00(0)Axis1 0x01(1)Axis2 0x02(2)Axis3 0x03(3)Axis4 0x04(4)Axis5 0x05(5)Axis6 0x06(6)Axis7 0x07(7)Axis8 0x08(8)Axis9 0x09(9)Axis10 0x0A(10)Axis11 0x0B(11)Axis12 0x0C(12)Axis13 0x0D(13)Axis14 0x0E(14)Axis15 0x0F(15)

VIsthatcanoperateonmultipleaxessimultaneously(forexample,ReadBlendStatusandStartMotion)cantaketheaxiscontrol(0)astheirresourceparameter.

Page 14: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingAxesNineThroughFifteen

Completethefollowingstepstouseaxesninethroughfifteen:

1. OpenthedesiredVIinLabVIEW.2. Viewtheblockdiagram.3. Right-clicktheappropriateterminalandselectCreate»Constant.4. Clickthedrop-downarrowontheconstantandselectOther.5. Typetheselectedaxisnumber(indecimal)foraxesninethroughfifteen.

Page 15: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

VectorSpacesVectorspacesarelogical,multidimensionalgroupsofaxes.Theycanbeeitherone-dimensional,two-dimensionalwithxandyaxes,orthree-dimensionalwithx,y,andzaxes.ThetotalnumberofvectorspacesNI-Motionsupportsinyourmotioncontrolsystemcanbecalculatedusingthefollowingformula:

totalvectorspaces= .

Vectorspacesfacilitate2Dand3Dinterpolatedmoves:linear,circular,helical,andspherical.YoucansendavectorspacetomanyNI-MotionVIstodefinevectorposition,vectorvelocity,vectoracceleration,andsoon.

Vectorspacesarestarted,stopped,andcontrolledasiftheywereasingleaxis,greatlysimplifyingthecontrolofcoordinatedvectoraxes.Allaxesinavectorspacestartandstopatthesametime,completingthevectormotionprofilesprogrammed.ThefollowingtableliststheresourceIDsforvectorspacecontrol.

ResourceName ResourceIDVectorSpaceControl 0x10(16)VectorSpace1 0x11(17)VectorSpace2 0x12(18)VectorSpace3 0x13(19)VectorSpace4 0x14(20)VectorSpace5 0x15(21)VectorSpace6 0x16(22)VectorSpace7 0x17(23)VectorSpace8 0x18(24)

VIsthatcanoperateonmultiplevectorspacessimultaneously(forexample,StartMotion)cantakethevectorspacecontrol(0x10)astheirresourceparameter.

VectorspacesareconfiguredbymappingaxestothevectorspacewiththeConfigureVectorSpaceVI.Vectorspacesarelogical,notphysical,anddonot

Page 16: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

requiremotionresourcesotherthanthoseusedbytheaxesthemselves.

Page 17: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingVectorSpacesFiveThroughEight

Completethefollowingstepstousevectorspacesfivethrougheight:

1. OpenthedesiredVIinLabVIEW.2. Viewtheblockdiagram.3. Right-clicktheappropriateterminalandselectCreate»Constant.4. Clickthedrop-downarrowontheconstantandselectOther.5. Typetheselectedvectorspacenumber(indecimal)forvectorspacesfive

througheight.

Page 18: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

MotionResourcesTherearefourtypesofmotionresourcesontheNI-Motioncontroller:encoders,ADCchannels,DACoutputs,andstepperoutputs.Ingeneral,VIsrelatingtomotionresources(forexample,ReadDACandReadStepsGenerated)canbesenttotheresourceortheaxistheresourceismappedto.

NoteAftertheyaremappedtoanaxis,allfeaturesandfunctionsofamotionresourceareavailableaspartoftheaxis.Itisnotnecessarytorememberorusetheresourcenumberdirectlywhenaccessingthesefeaturesaspartoftheaxis.Resourcesarereferencedbyaxisnumberaftertheyareassignedtothataxis.

Page 19: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

NI73xxControllerConsiderations

Thefollowinglistincludesconsiderationsyoumustmakewhenyouareusingtheseresourceswitha73xxcontroller:

7330controllersdonotsupportDACoutputsorsecondaryADCs.7340controllersdonotsupportsecondaryADCs.7350controllerssupportasecondaryfeedbackdeviceoneachaxis.7390controllersdonotsupportADCchannels,DACoutputs,secondaryADCs,orsecondaryencoders.

Page 20: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

NISoftMotionControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingtheseresourceswiththeNISoftMotionController:

TheNISoftMotionControllersupportsasecondaryfeedbackdeviceoneachaxis.

SecondaryEncodersUsesecondaryencodersinadual-loopfeedbacksystemtoprovideamoreaccuratevelocityfeedbackestimation.

ResourceName ResourceIDSecondaryEncoder1 0X71(113)SecondaryEncoder2 0X72(114)

.

.

.SecondaryEncoder15 0X7F(127)SecondaryADCs

UsesecondaryADCsinadual-loopfeedbacksystemtoprovideamoreaccuratevelocityfeedbackestimation.

ResourceName ResourceIDSecondaryADC1 0X91(145)SecondaryADC2 0X92(146)

.

.

.SecondaryADC15 0X9F(159)

Page 21: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

EncodersEncoderresourcesareprimarilyusedforpositionfeedbackonservoandclosed-loopstepperaxes.Whenencoderresourcesarenotmappedtoanaxisforuseasaxisfeedback,youcanusethemforanynumberofotherfunctionsincludingpositionorvelocitymonitoring,asdigitalpotentiometerencoderinputs,orasmasterencodersformaster/slaveandgearingapplications.ThefollowingtableliststheresourceIDsforencoders:

ResourceName ResourceIDEncoderControl 0x20(32)Encoder1 0x21(33)Encoder2 0x22(34)Encoder3 0x23(35)Encoder4 0x24(36)Encoder5 0x25(37)Encoder6 0x26(38)Encoder7 0x27(39)Encoder8 0x28(40)Encoder9 0x29(41)Encoder10 0x2A(42)Encoder11 0x2B(43)Encoder12 0x2C(44)Encoder13 0x2D(45)Encoder14 0x2E(46)Encoder15 0x2F(47)

VIsthatcanoperateonmultipleencoderssimultaneously(forexample,ReadHigh-SpeedCaptureStatus)cantaketheencodercontrol(0x20)astheirresourceparameter.

Allencodersfeaturehigh-speedcaptureinputsandbreakpointoutputs.ThesefeaturesareimplementedintheencoderprocessorFPGAandarefullyfunctionalwhenanencoderisusedasanindependentresourceorasfeedbackforanaxis.

Page 22: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingEncodersNineThroughFifteen

Completethefollowingstepstouseencodersninethroughfifteen:

1. OpenthedesiredVIinLabVIEW.2. Viewtheblockdiagram.3. Right-clicktheappropriateterminalandselectCreate»Constant.4. Clickthedrop-downarrowontheconstantandselectOther.5. Typetheselectedencodernumber(indecimal)forencodersninethrough

fifteen.

Page 23: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ADCChannelsYoucanuseADCchannelsasanalogfeedbackforaxesorasgeneral-purposeanaloginputstomeasuresensorsorpotentiometers.

AllADCchannelsaremultiplexedandautomaticallyscannedtokeeptheconvertedADCregistervaluescurrent.ThefollowingtableliststheresourceIDsforADCs:

ResourceName ResourceIDADC1 0x51(81)ADC2 0x52(82)ADC3 0x53(83)ADC4 0x54(84)ADC5 0x55(85)ADC6 0x56(86)ADC7 0x57(87)ADC8 0x58(88)ADC9 0x59(89)ADC10 0x5A(90)ADC11 0x5B(91)ADC12 0x5C(92)ADC13 0x5D(93)ADC14 0x5E(94)ADC15 0x5F(95)

ADCchannelsdonottypicallyprovidethesameleveloffeedbackperformanceasencoders,buthavetheadvantageofprovidingabsoluteratherthanincrementalfeedback.

On7340/7330controllers,ADCs5through8arehard-wiredtospecificsources,andcannotbeusedasgeneral-purposeresourcesorasfeedbackdevices.RefertotheReadADCsVIformoreinformation.

Page 24: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingADCsNineThroughFifteen

CompletethefollowingstepstouseADCsninethroughfifteen:

1. OpenthedesiredVIinLabVIEW.2. Viewtheblockdiagram.3. Right-clicktheappropriateterminalandselectCreate»Constant.4. Clickthedrop-downarrowontheconstantandselectOther.5. TypetheselectedADCnumber(indecimal)forADCsninethroughfifteen.

Page 25: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

DACOutputsDACresourcesaretypicallymappedtoservoaxesandgeneratetheanalogcontroloutputsfromthePIDloops.DACresourcesthatarenotusedbyaxesareavailablefornon-axisspecificapplications.YoucandirectlycontrolanunmappedDACasageneral-purposeanalogoutput.

TheDACoutputsoffer16-bitresolutionandtheindustry-standard±10Vrange.RefertothespecificationsofthemotioncontrollerdocumentationforcompleteDACoutputspecifications.ThefollowingtableliststheresourceIDsforDACs:

ResourceName ResourceIDDAC1 0x31(49)DAC2 0x32(50)DAC3 0x33(51)DAC4 0x34(52)DAC5 0x35(53)DAC6 0x36(54)DAC7 0x37(55)DAC8 0x38(56)DAC9 0x39(57)DAC10 0x3A(58)DAC11 0x3B(59)DAC12 0x3C(60)DAC13 0x3D(61)DAC14 0x3E(62)DAC15 0x3F(63)

Page 26: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingDACsNineThroughFifteen

CompletethefollowingstepstouseDACsninethroughfifteen:

1. OpenthedesiredVIinLabVIEW.2. Viewtheblockdiagram.3. Right-clicktheappropriateterminalandselectCreate»Constant.4. Clickthedrop-downarrowontheconstantandselectOther.5. TypetheselectedDACnumber(indecimal)forDACsninethroughfifteen.

Page 27: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

StepperOutputsStepperoutputresourcesgeneratethesteppulsesrequiredforstepperaxiscontrol.TheyoperateliketheDACoutputinaservoaxis.

NI-Motionsupportsthetwoindustry-standardstepperoutputconfigurations:StepandDirection,orCW/CCWpulses.RefertoConfigureStepperOutputformoreinformationabouttheseoutputconfigurations.ThefollowingtableliststheresourceIDsforstepperoutputs:

ResourceName ResourceIDStepperOutput1 0x41(65)StepperOutput2 0x42(66)StepperOutput3 0x43(67)StepperOutput4 0x44(68)StepperOutput5 0x45(69)StepperOutput6 0x46(70)StepperOutput7 0x47(71)StepperOutput8 0x48(72)StepperOutput9 0x49(73)StepperOutput10 0x4A(74)StepperOutput11 0x4B(75)StepperOutput12 0x4C(76)StepperOutput13 0x4D(77)StepperOutput14 0x4E(78)StepperOutput15 0x4F(79)

Page 28: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingStepperOutputsNineThroughFifteen

Completethefollowingstepstousestepperoutputsninethroughfifteen:

1. OpenthedesiredVIinLabVIEW.2. Viewtheblockdiagram.3. Right-clicktheappropriateterminalandselectCreate»Constant.4. Clickthedrop-downarrowontheconstantandselectOther.5. Typetheselectedstepperoutputnumber(indecimal)forstepperoutputs

ninethroughfifteen.

Page 29: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

General-PurposeI/OPortsYoucanusethegeneral-purposeI/Oportstructureforprogrammablelogiccontroller(PLC)functionsorforsimplepointI/O.RefertoAnalog&DigitalI/OVIsforinformationabouthowtoconfigurethedirectionandpolarityoftheI/Oportsandbits,setandresetindividualbits,andreadthelogicalportstatus.

TheseI/Oportsarealsohardwareresources,butbecausetheyarenevermappedtoaxes,theyarenotconsideredmotionresources.Referto73xxControllerGeneral-PurposeI/OPortIDsandNISoftMotionControllerGeneral-PurposeI/OPortIDsforI/Oportresourcenumbers.

Notes

1. TheRTSIportisnotsupportedbytheNISoftMotionController.2. TheresourceIDfortheRTSIportis0x09(9).

Page 30: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingUnlistedGeneral-PurposeI/OPorts

Completethefollowingstepstouseunlistedgeneral-purposeI/Oports:

1. OpenthedesiredVIinLabVIEW.2. Viewtheblockdiagram.3. Right-clicktheappropriateterminalandselectCreate»Constant.4. Clickthedrop-downarrowontheconstantandselectOther.5. Typetheselectedportnumber,indecimal.

Page 31: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

AvailableI/OResources

ThefollowingtableliststheI/Oresourcesbycontrollertype.

Device DigitalI/OLinesNI7330 four8-bitports,RTSII/OportNI7340 four8-bitports,RTSII/OportNI7350 eight8-bitports,RTSII/Oport

NIPCI-7390 four2-bitinputports,four2-bitoutputports,RTSII/Oport

NISoftMotionControllerforXenus(CopleyControlsCANopendrive)

sevendigitalinputlines,threedigitaloutputlinesperaxis

NISoftMotionControllerforAccelnet(CopleyControlsCANopendrive)

sevendigitalinputlines,twodigitalinputlinesperaxis

Page 32: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

73xxControllerGeneral-PurposeI/OPortIDs7330,7340,and7350ControllerI/OPortResourceIDs

ThefollowingtableliststheresourceIDsforI/Oportson7330,7340,and7350controllers.

NoteTheI/OlinedirectionisuserconfigurableusingtheSetI/OPortDirectionVI,sothesecontrollersdonothaveseparateportIDsforinputandoutputports.

ResourceName ResourceIDI/OPort1 0x01(1)I/OPort2 0x02(2)I/OPort3 0x03(3)I/OPort4 0x04(4)I/OPort5 0x05(5)I/OPort6 0x06(6)I/OPort7 0x07(7)I/OPort8 0x08(8)RTSIPort 0x09(9)

Page 33: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

PCI-7390ControllerI/OPortResourceIDs

ThefollowingtableliststheresourceIDsforI/OportsonthePCI-7390controller.

DigitalInputPortsResourceName ResourceIDInputPort1 0x01(1)InputPort2 0x02(2)InputPort3 0x03(3)InputPort4 0x04(4)

DigitalOutputPortsResourceName ResourceIDOutputPort1 0x81(129)OutputPort2 0x82(130)OutputPort3 0x83(131)OutputPort4 0x84(132)

Page 34: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

NISoftMotionControllerGeneral-PurposeI/OPortIDsThefollowingtableliststheresourceIDsforI/OportsontheNISoftMotionController:

DigitalInputPortsResourceName ResourceIDInputPort1 0x01(1)InputPort2 0x02(2)InputPort3 0x03(3)InputPort4 0x04(4)InputPort5 0x05(5)InputPort6 0x06(6)InputPort7 0x07(7)InputPort8 0x08(8)InputPort9 0x09(9)InputPort10 0x0A(10)InputPort11 0x0B(11)InputPort12 0x0C(12)InputPort13 0x0D(13)InputPort14 0x0E(14)InputPort15 0x0F(15)

DigitalOutputPortsResourceName ResourceIDOutputPort1 0x81(129)OutputPort2 0x82(130)OutputPort3 0x83(131)OutputPort4 0x84(132)OutputPort5 0x85(133)OutputPort6 0x86(134)OutputPort7 0x87(135)OutputPort8 0x88(136)OutputPort9 0x89(137)OutputPort10 0x8A(138)OutputPort11 0x8B(139)OutputPort12 0x8C(140)OutputPort13 0x8D(141)OutputPort14 0x8E(142)OutputPort15 0x8F(143)

Page 35: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

TrajectoryParametersAlltrajectoryparametersforservoandclosed-loopstepperaxesareexpressedintermsofquadratureencodercounts.Parametersforopen-loopstepperaxesareexpressedinsteps.Forservoaxes,theencoderresolutionincountsperrevolutiondeterminestheultimatepositionalresolutionoftheaxis.

Forstepperaxes,thenumberofstepsperrevolutiondependsuponthetypeofstepperdriverandmotorbeingused.Forexample,asteppermotorwith1.8°/step(200steps/revolution)usedinconjunctionwitha10xmicrostepdriverwouldhaveaneffectiveresolutionof2,000stepsperrevolution.Resolutiononclosed-loopstepperaxesislimitedtothestepsperrevolutionorencodercountsperrevolution,whicheveriscoarser.

TherearetwootherfactorsthataffectthewaytrajectoryparametersareloadedtotheNImotioncontrollerversushowtheyareusedbythetrajectorygenerators:floating-pointversusfixed-pointparameterrepresentation,andtimebase.

Youcanloadsometrajectoryparametersaseitherfloating-pointorfixed-pointvalues.TheinternalrepresentationontheNImotioncontrollerisalwaysfixed-point,however.Thisfactisimportantwhenworkingwithonboardvariables,input,andreturnvectors.Italsohasasmalleffectonparameterrangeandresolution,asshownintheexampleintheVelocityinRPMtopic.

Thesecondfactoristhetimebase.Velocityandaccelerationvaluesareloadedincounts/s,RPM,RPS/sec,steps/s,andsoon—allfunctionsofsecondsorminutes.ButthetrajectorygeneratorsupdatetargetpositionattheTrajectoryUpdateRate,whichisprogrammablewiththeEnableAxesVI.Thismeansthattherangefortheseparametersdependsontheupdaterateselected,asshownintheexampleintheVelocityinRPMtopic.

RPMvaluesstoredinonboardvariablesareindouble-precisionIEEEformat(f64).RefertoOnboardVariablesandInputandReturnVectors,forinformationaboutthenumberofvariablesrequiredtoholdanRPMvalue.

NI73xxVelocityinRPM

Page 36: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

NI73xxVelocityinCounts/sorSteps/s

NI73xxAccelerationinCounts/s2

NI73xxAccelerationinRPS/s

NI73xxVelocityOverrideinPercent

NI73xxArcAnglesinDegrees

Page 37: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ValueMotiontoNI-MotionConversionToaidinconvertingaValueMotionapplicationtoNI-Motion,thefollowingtablelistseachVIintheValueMotionAPIandgivesthenearestNI-MotionVI.SomeValueMotionVIsarerelatedtotwoNI-MotionVIs.Inthesecases,thefirstVIistheclosestmatchtotheValueMotionVI,butthesecondNI-MotionVI,incombinationwiththefirst,isrequiredtocompletelymimicthefunctionalityoftheoriginalValueMotionVI.

RefertotheindividualVIsinboththeValueMotionandNI-MotionVIonlinehelpfordetailedinformationaboutthefunctionalandsyntacticdifferences.

ValueMotionVIName NI-MotionEquivalent

AcquireSamples AcquireTrajectoryDataClearReturnDataBuffer FlushReturnDataBufferCommunicate ReadReturnDataBufferConfigureMasterSlave ConfigureGearMaster

EnableGearingEnable4ALimitSwitchInputs EnableLimits

EnableHomeInputsEnableBreakpoint EnableBreakpointOutput

ConfigureBreakpointEnableTriggerInputs WaitonConditionFindHome FindReferenceHomeFindIndex FindReferenceIndexGetBoardType GetMotionBoardInformationGetMotionBoardInfo GetMotionBoardInformationInitializeController InitializeControllerKillAll StopMotionKillMotion StopMotionLoadAcceleration LoadAcceleration/DecelerationLoadAccelerationFactor NotsupportedLoadBreakpoint LoadBreakpointPositionLoadBreakpointRepeatPeriod LoadBreakpointModulusLoadDerivativeGain LoadSinglePIDParameter

Page 38: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

VIExecutionTimesForselectedVIexecutiontimes,selectyourcontrollerfromthefollowinglist:

NI7330NI7334NI7340NI7342NI7344NI7350NI7390

Page 39: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

CommunicationbetweentheHostComputerandtheNIMotionControllerThehostcomputercommunicateswiththeNImotioncontrollerthroughanumberofI/OportaddressesontheISAorPCIbus.

Atthecontroller'sbaseaddressistheprimarybidirectionaldatatransferport.ThisportsupportsFIFOdatapassinginbothsendandreadbackdirections.TheNImotioncontrollerhasbothacommandbufferforincomingcommandsandaReturnDataBuffer(RDB)forreturndata.

Atoffsetsfromthecontroller'sbaseaddressaretworead-onlystatusregisters.TheflowofcommunicationsbetweenthehostandtheNImotioncontrolleriscontrolledbyhandshakingbitsintheCommunicationsStatusRegister(CSR).TheMCSregisterprovidesinstantaneousmotionstatusofallaxes.

BoardIdentificationParameter

Packets,Handshaking,andFIFOBuffers

ReturnDataBuffer

Page 40: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

BoardIdentificationParameterAllVIsinNI-MotionhaveBoardIDasthefirstparameter.BoardIDisdefinedasboardID(u8)—theboardidentificationnumberassignedbyMeasurement&AutomationExplorer.

BoardIDisauniquenumberassignedtoeachmotioncontrollerinthesystembyMeasurement&AutomationExplorer.Afterthisassignmentismade,allNI-MotionVIsusethisboardIDtosendandreceivecommandsanddatatoorfromaspecificNI-Motioncontroller.MostNI-MotionVIsalsohaveaBoardIDOutterminalwhichisprovidedforflowcontrol.YoucanstringtogetherNI-MotionVIsbywiringtheBoardIDOutterminalofoneVItotheBoardIDterminalofthenextVI.

Page 41: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Packets,Handshaking,andFIFOBuffersThistopicbrieflydescribeshowcommandsanddataarepassedbetweenthehostcomputerandtheNImotioncontroller.Thisinformationisprovidedforreferencepurposes.TheNI-Motionsoftwareprovidesdrivers,DLLs,andCfunctionlibrariesthathandlethehost-to-controllercommunicationsforyou.

DatapassedtoorfromtheNImotioncontrollerishandledinapacketformat.Apacketconsistsofapacketidentifierword,commandanddatacontent,andapacketterminatorword.Thisapproachtocommunicationsenhancestheintegrityofdatacommunications,speedstheprocessingofthetransferredcommandanddata,andorganizesoperationintopowerful,high-levelfunctions.

EachwordinapacketissentoverthebusaftercheckingtheReady-to-Receive(RTR)handshakingbitintheCSR.RefertotheReadCommunicationStatusVIforthestatusclusterandmoreinformationaboutthestatusreportedintheCSR.

Commandanddatapacketsarecheckedforpacketformaterrorsasthecontrollerreceivesthem.Ifthecontrollerdetectsapacketerror,itimmediatelyreportstheerrorbysettinganerrorbitintheCSR.Whenthepacketisreceivedwithouterror,thecommandanddataisstoredinaFIFObuffer.

ThisFIFOcanholdupto16commands.TheNI-MotionRTOSprocessescommandswhenitisnotbusywithhigherprioritytasks.IntheunlikelyeventthattheFIFOfillsupbeforeanycommandscanbeprocessed,thehostisheldoffwithaNot-Ready-to-Receivecondition.

Eachcommandisprocessedandadeterminationismadewhethertoexecutethecommandimmediately,orstoreitawayinaprogramtoexecutelater.Commandsarealsocheckedfordataandmodal(sequence)errorsatthistime.ModalerrorsareflaggedbysettingtheErrorMessagebitintheCSR.Thismodalerrorisfunctionallydifferentfromthepacketcommunicationerrorpreviouslydescribed.RefertoErrorsandErrorHandlingformoreinformation.

Page 42: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReturnDataBuffer(73xxControllersOnly)DataorstatusrequestedbythehostisbufferedintheReturnDataBuffer(RDB)inFIFOmode.TheFIFOis16commandsdeep.

WhendataexistsintheRDB,theReadytoSendbitintheCommunicationStatusRegister(CSR)isset.

YoucanusetheRDBeitherasatemporarybufferthatholdsasinglereturndatapacket,orasasmallFIFObuffer.WhentherequesteddataisavailableintheRDB,useReadReturnDataBuffertoretrieveit.Youalsocanrequestmultipledataitemsandleavetheminthebufferforretrievalatalatertime.IftheRDBbecomesfullandcannotaccommodaterequestedreturndata,NI-MotiongeneratesanerrorandsetstheErrorMessagebitintheCSR.

Page 43: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ErrorsandErrorHandlingTominimizethepossibilityoferroneoussystemoperation,VIs,packets,anddataarecheckedforerrorsatmultiplelevelswithintheNI-MotionsoftwareandwithinthefirmwarethatresidesontheNImotioncontroller.

Inaperfectsystem,errorsshouldnotbegenerated.However,duringapplicationdevelopmentanddebugging,errorsareunfortunatelyquitecommon.NI-MotionoffersanextensiveerrorhandlingstructureandutilityVIstoallowyoutoquicklydiagnoseanyerror-generatingsituation.RefertotheError&UtilityVIsforinformationaboutspecificVIsandErrorCodesforalistingoferrorsreturnedbyNI-Motion.

Page 44: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ErrorCodesThefollowingtablelistsallNI–Motionerrorcodes,symbolicnames,andabriefdescriptionoftheassociatederrorconditions.

RefertotheError&UtilityVIsfordetaileddescriptionsoftheVIsforerrorhandling.RefertoErrorsandErrorHandlingformoreinformationabouterrorsanderrorhandlingtechniques.

ErrorCode SymbolicNameDescription

0 NIMC_noError Noerror.

-70001 NIMC_readyToReceiveTimeoutError

ReadytoReceiveTimeout.Thecontrollerisstillnotreadytoreceivecommandsafterthespecifiedtimeoutperiod.Thiserrormayoccurifthecontrollerisbusyprocessingpreviouscommands.Ifthiserrorpersists,evenwhenthecontrollershouldnotbebusy,contactNationalInstruments.

-70002 NIMC_currentPacketError

Eitherthisfunctionisnotsupportedbythistypeofcontroller,orthecontrollerreceivedanincompletecommandpacketandcannot

Page 45: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ErrorCodesThefollowingtablelistsallNI–Motionerrorcodes,symbolicnames,andabriefdescriptionoftheassociatederrorconditions.

RefertotheError&UtilityVIsfordetaileddescriptionsoftheVIsforerrorhandling.RefertoErrorsandErrorHandlingformoreinformationabouterrorsanderrorhandlingtechniques.

ErrorCode SymbolicNameDescription

0 NIMC_noError Noerror.

-70001 NIMC_readyToReceiveTimeoutError

ReadytoReceiveTimeout.Thecontrollerisstillnotreadytoreceivecommandsafterthespecifiedtimeoutperiod.Thiserrormayoccurifthecontrollerisbusyprocessingpreviouscommands.Ifthiserrorpersists,evenwhenthecontrollershouldnotbebusy,contactNationalInstruments.

-70002 NIMC_currentPacketError

Eitherthisfunctionisnotsupportedbythistypeofcontroller,orthecontrollerreceivedanincompletecommandpacketandcannot

Page 46: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ErrorHandlingTechniquesInadditiontousingtheerrorinanderroroutterminalsoneachmotionVI,checkformodalerrorsbycallingtheMotionErrorHandlerVIintheapplication.TheMotionErrorHandlerVIchecksthecontrollerforerrorsandreadanddisplayerrorsfromtheErrorStackiftheyexist.RefertotheexampleVIsintheLabVIEW\Examples\Motion\NI-MotiondirectorytoseehowthisVIisused.

Howoftentocheckformodalerrorsdependsupontheapplication,butyoucanusethefollowinglistasaguideline:

1. Checkforerrorsattheendofeachmajorsubroutineorfunctionalblock.2. Checkforerrorsattheendofaninitializationprocedure.Evenbetteristo

alsocheckaftereachaxisinitialization.AfterexecutingaFindReferenceVI,checktomakesurethesequencecompletedsuccessfully.

3. Includeanerrorcheckineverystatuspollingloop.Mostapplicationsincludeapollinglooptodisplaymotionstatus,position,velocity,andsoon.Thiswayyouareassuredofnevermissinganerror.

4. Duringdebugging,youcanrunanindependentVItocheckforerrors.TheErrorMonitorVIintheError&Utilitypaletteisprovidedforthispurpose.YoucanrunthisVIwhileanotherVIisexecutingmotionVIs,andtheErrorMonitordisplaysmodalerrors.

Foradditionalinformationabouterrors,refertothefollowingtopics:

OnboardVariables

FatalHardwareandCommunicationsErrors

Page 47: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ErrorMessageStackModalerrorsgenerateanerrormessagecontainingthecommandID,resourceID,anderrorcodethatispushedontheErrorMessageStackontheNImotioncontrollerandflaggedintheErrorMessage(ErrMsg)bitoftheCommunicationsStatusRegister(CSR).YoucanreturnamodalerrormessagetothehostbyexecutingtheReadErrorMessageVI.

Foryourconvenience,theMotionErrorHandlerVIcheckstheCSRforerrors,andifanerrorispresentonthestack,readstheerrormessagefromthecontroller.

TheErrorMessageStackisorganizedasalast-in-first-out(LIFO)buffersothatthemostrecenterrorisavailableimmediately.OldererrorscanbereadwithadditionalcallstotheMotionErrorHandlerVIandarereturnedintheinverseordertowhichtheyweregenerated.Whenthestackisempty,theErrorMessage(ErrMsg)bitintheCSRisreset.

TheErrorStackcanholdupto10errors.Whenthestackisfull,whichisanunlikelyevent,additionalerrormessagesarethrownaway.

Page 48: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

FatalHardwareandCommunicationsErrorsThereareafewerrorsthat,ifdetected,indicateasevereorfatalerrorcondition.TheseincludebutarenotlimitedtoBoardFailureError,WatchdogTimeoutError,FPGAProgramError,DSPInitializationError,I/OInitializationError,andReadytoReceiveTimeoutError.

RefertoErrorCodes,foracompletelistoferrorcodesandpossiblecauses.

Fatalerrorsareunlikely,butiftheyoccur,trytoclearthembyresettingorpowercycling.Ifthisproceduredoesnotcleartheproblem,refertoTechnicalSupportandProfessionalServices.

Page 49: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ModalandNon-ModalErrorsNI-Motioncandetecttwotypesoferrors—modalandnon-modal.Non-modalerrorsareerrorsdetectedatthetimeofVIexecution.Thisincludescommunicationsfailures,parametervalueerrors,andbadBoardIDerror.

IfaNI-MotionVIencountersanon-modalerror,suchasthoselistedabove,communicationwiththecontrollerisimpossible,andthecommandisneversenttooracceptedbythecontroller.TheVIreportsthiserrorintheerroroutcluster.WhenVIsarewiredtogetherthroughtheErrorInandErrorOutterminals,allVIsdownstreamofaVIcausinganon-modalerrordonotexecute.However,theStopMotionVIalwaysexecutes,evenifanotherVIencounteredanerrorearlier.

Modalerrors,ontheotherhand,areerrorsthatarenotdetectedatthetimeofVIexecution,becauseVIscanbebufferedintheonboardFIFO.Furthermore,someVIscanbelegalatonetimeandillegalatanother,dependingonthestateormodeoftheNImotioncontroller.ThismodalerrorstructurealsocorrectlydetectserrorsgeneratedbyincorrectlysequencedVIsinonboardprograms.Modalerrorsareplacedintheonboarderrorstack,andyouhavetoexplicitlyquerythecontrollertocheckforerrors.TheMotionErrorHandlerVIcheckstheonboarderrorstackeverytimeyoucallit.

Page 50: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

VITypesandParametersInadditiontotheAPIfunctionalorganization,NI-MotionVIscanbecategorizedbycommonformat,execution,andparametercharacteristics.

BitmappedversusPer-ResourceVIs

SingleandDouble-BufferedParameters

InputandReturnVectors

OnboardVariables

Page 51: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

BitmappedversusPer-ResourceVIsTherearetwobasictypesofNI-MotionVIs—thosethatoperateononeresourceatatime,andthosethatoperateonmultipleaxes,vectorspaces,I/Obits,andsoonsimultaneously.

Per-resourceVIstypicallysendnumericvaluesto,orreadnumericvaluesfrom,theselectedaxisorresource.Theyoperateidenticallyoneachaxisormemberintheresourcefamily.

Incontrast,VIsthatoperateonmultiplebitssendandreturnbitmaps,whereeachbit(axis,vectorspace,I/Obit,andsoon)isrepresentedbyonebitinthebitmap.

SomeVIssetandresetbitsinthebitmapusingtheMustOn/MustOff(MOMO)protocol.Thistri-stateprotocolallowsyoutoset/resetoneormorebitswithoutaffectingtheotherbitsinthebitmap.RefertoanyoftheMOMOVIdescriptionsforcompleteinformationaboutthisprotocol.

BitmappedVIsactonallbitssimultaneously.Becauseeachexecutionreconfiguresallbitsinthebitmap,donotusetheseVIsincrementally.

Page 52: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

InputandReturnVectorsManyVIsthatloadvaluesandvirtuallyallreadbackVIssupportvectoring.LoadVIs,forexampleLoadTargetPosition,takeaninputvectorthatspecifiesthesourceofthedata,eitherimmediate(usingtheVIinputparameters),fromageneral-purposeonboardvariable,orfromanindirectvariable.ReadVIs,forexampleReadPosition,takeareturnvectorthatspecifiesthedestinationforthereturneddata,eitherthehostcomputer,anonboardvariable,oranindirectvariable.

TheabilitytousevariablesinmotioncontrolVIsisoneofthepowerfulfeaturesoftheNI-Motiononboardprogrammingenvironment.Youcanreaddatafromaresourceintoavariable,scaleorperformsomeothercalculationonthevalue,andthenloadthenewvalueasatrajectoryorothermotionparameter.AllDataOperationsVIstakedatafromvariablesandreturntheresultthroughareturnvector,typicallytoanothervariable.

NoteDatareturnedtothehostbyareturnvectorof0xFFisactuallyleftintheReturnDataBuffer(RDB).ReaddatafromtheRDBusingReadReturnDataBuffer.

Inadditiontospecifyingavariabledirectly,youcanuseindirectvariablestoreferenceavariableindirectly,muchlikeapointerinC.RefertoOnboardVariablesformoreinformation.

Inputandreturnvectorsareveryusefulwhenwritingonboardprogramsbuthavelittleornouseinprogramsrunningonthehostcomputer.Forthisreason,thedefaultvalueforinputvectorisimmediate(0xFF).

NoteThereturnvectormustbe0xFFonthe7330and7390,becausethey

Page 53: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

donotsupportonboardprogramming.

RefertoCommunicationbetweentheHostComputerandtheNI-MotionControllerforinformationabouttheRDB.

Page 54: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

OnboardVariablesNI-Motionsupports120general-purposevariables(0x01through0x78)foruseinonboardprograms.Variablesare32bitswideandcanholdeithersigned(i32)orunsigned(u32)values.Variablescanbereferencedininputandreturnvectorparameters.DataOperationsVIsusevariablesexclusivelyforinputoperandsandtheoutputresult.

Ingeneral,mostVIshaveasingledataparameterthatfitsintoasingle32-bitvariable.IftheVIusesonlya16-bitdatavalue,itisintheleastsignificantportion(right-most)ofthe32-bitvariable.However,someVIswithinputorreturnvectorshavemorethanonedataparameter.Asageneralrule,eachparameter,regardlessofsize,requiresitownvariable.FortheseVIs,thevectorpointstothefirstvariableinasequentialgroupofvariables.Parametersarethenassociatedwithvariablesinsequentialorder.

AfewadvancedVIshandlevariablesdifferentlyfromthepreviousdescription.RefertoUsingInputsandReturnVectorswithOnboardVariablesformoreinformationaboutvariablesandvectors.

IndirectVariables

IndirectvariablesprovidefunctionalitysimilartopointersinaprogramminglanguagesuchasC.Whenyouuseanindirectvariable(0x81through0xF8)asaninputvectororreturnvector,theNI-Motionsoftwarelooksatthecontentsoftheindirectvariableandusesthatvalueastheinputorreturnvector.Indirectvariables0x81through0xF8correspondtovariables0x01through0x78.Sowhenyouspecifyaninputvectorof0x81,theNImotioncontrollerusesthecontentsofvariable0x01astheinputvector.Thiscanbeveryusefulinloopingstructuresinonboardprograms,aswellaschangingtheinputvaluestoVIsdynamically.

Example

Supposethevaluesofonboardvariables1to10areasfollows:

0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0A

Page 55: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

0 7 0 0 0 0 1000 0 0 0

Inthisexample,readingtheindirectvariable0x82returnsthevalue1000.

NoteYoucansavetheentiresetofonboardgeneral-purposevariablestoFlashROMwiththeSaveDefaultParametersVI.

VariableArray

VariablearraysareusedwhenreadingorwritingabufferofdatatoorfromonboardmemoryusingtheReadBufferorWriteBufferVIs.

Inmemory,thebufferoccupiesn+2variables,wherenisthenumberofbufferelementsread.Thefirstvariablecontainsthenumberofvaluesreadfromthebuffer.Thesecondvariablecontainstheerrorcodeofthereadoperation.Ifthisvalueiszero,thennoerroroccurred.Thenextnelementsarethevaluesreadfromthearray.Thereadbufferaccountsforthetwoadditionalvalue.However,whenyouarewritingabufferusingavariablearray,thesecondparameteristheregenerationmode,notanerrorcode.

Example

Supposetheonboardvariablelookslikethefollowing:

0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 ...5 0 0 0 0 0 0 0 ...

Further,supposethatthereisabuffercontainingthefollowingelements:

1 2 3 4 5

Ifyouweretoreadthefirstfiveelementsofthebuffertoonboardmemorylocation0x81,theonboardmemorywouldlooklikethefollowing:

0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xA 0xB 0xC ...5 0 0 0 5 0 1 2 3 4 5 0 ...

0x5containsthenumberofelementstoread.0x6displaystheerrorsthatoccurred.Inthiscase,thelocationcontainsa0,meaningnoerrorsoccurred.

Page 56: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

0x7–0xBarethefiveelementsthatwereread.

Page 57: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReflectiveMemoryVIsSomeoftheAdvancedReadVIsusereflectivememorytoreturnstatusanddatainformationtothecontroller.UnlikethetrajectorycontrolVIsthatalsoreturnthisinformation,thesespecializedVIsreadstatusanddatainformationfromtheregisterandsenditbackinamuchhigherresponsetime.

TheseVIsshouldnotbeusedforeventchecking.OnlyusetheinformationreturnedbytheseVIsfordisplaypurposes.ThisisbecausethetradeoffforsignificantlyfasterresponsetimeisthattheseVIsarenotserializedwithotheroperations.VIsthatreturndatainformationarereadfromaregisteronthecontrollerandrefreshedevery5ms.VIsthatreturnstatusinformationarerefreshedassoonaspossible.Thisconfigurationmakesthedataandstatusinformationquicklyaccessible—inabout40µsasopposedto>2mswiththetrajectorycontrolVIs.However,thisalsomeansthatyoucanreadstatusinformationsoonerthantheVIhastimetoexecute.Forexample,acalltoStartMotionfollowedimmediatelybyacalltothemovecompleteattributeoftheReadExecutionStatusVImayreturnaTruevaluebecausetheStartMotionVImaynothavestartedbeforethemovecompletestatusinformationisreturned.

NoteVIsusingreflectivememoryarenotsupportedbytheNISoftMotionController.

ThefollowingtableliststheVIsusingreflectivememory,whichcontrollerhasreflectivememorysupport,andwhichattributesusereflectivememory,ifapplicable:

Function 7330 7340 7350 7390ReadAllAxisData — — Y YReadAllAxisStatus — — Y YReadAxisData(allattributes) — — Y YReadAxisStatus(allattributes) — — Y YReadCaptureCompareData

CapturedPosition — — N N

Page 58: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

PositionCaptureOccurred

PositionCompareOccurred

Y

Y

Y

Y

ReadCoordinateData(allattributes) — — Y YReadCoordinateStatus(allattributes) — — Y YReadCoordinatePosition(allattributes) — — Y YReadDigitalI/OData

OutputActiveState

InputActiveState

OutputActive

InputActive

ConfigureAsInput

N

N

N

N

N

N

N

N

N

N

N

N

Y

Y

N

N

N

Y

Y

ReadEncoderData(allattributes) — — Y Y

ReadMotionI/OData

ForwardLimitActive

ReverseLimitActive

ForwardSoftwareLimitActive

ReverseSoftwareLimitActive

HomeInputActive

Inhibit-InActive

In-PositionActive

N

N

N

N

N

N

N

N

N

N

N

N

N

N

Y

Y

Y

Y

Y

N

N

Y

Y

Y

Y

Y

N

N

Page 59: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

DriveReadyActive

Inhibit-OutActive

N

N

N

N

N

N

N

N

Page 60: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

SingleandDouble-BufferedParametersAlmostallNI-Motionparametersareeithersingle-bufferedordouble-bufferedonthecontroller.Single-bufferedparameterstakeeffectimmediatelyuponVIexecutionandremainineffectuntiltheyareoverwrittenwithanothercalltotheVIthatloadedorsetthem.Itisnotnecessarytoconstantlyreloadsingle-bufferedparameterseachtimeyoudealwithanaxis,vectorspace,orresource.TheobviousexceptiontothisisactioncommandslikeStartMotion,StopMotion,FindReference,andsoon,whichmustbecalledeachtime.

Mosttrajectorycontrolparametersaredouble-buffered.Youcanloadtheseparametersontheflywithoutaffectingthemoveinprocess.TheydonottakeeffectuntilthenextStartorBlendMotionVIisexecuted.Likesingle-bufferedparameters,thecontrollerretainsthevaluessotheydonothavetobeloadedbeforeeachmoveunlessyouwanttochangetheirvalues.

LoadBreakpointPositionandLoadBreakpointModulusaretheonlynon-trajectoryparametersthatarealsodouble-buffered.TheyhavenoeffectuntilyouexecuteasubsequentEnableBreakpointOutputVI.

Page 61: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingInputandReturnVectorswithOnboardVariablesThistablegivesadditionalinformationabouthowtouseinputandreturnvectorsinconjunctionwithonboardvariables.ThefollowingtablelistsVIswithmorethanonedataparameterthatrequiremultiplevariableswhenusingvectors.TheMaximumVariableNumbercolumnliststhehighestvariablenumberthatavectorcanpointtoandstillhaveroomforallthedatawithoutexceedingthetotalvariablespace.Thistablealsocontainsnotesthathighlightafewspecialcaseswherethenumberofparametersdoesnotequalthenumberofvariables.

VIName

VectorType

NumberofParameters

NumberofVariablesRequired

MaximumVariableNumber

Comments

LoadAllPIDParameters Input 8 8 0x71

LoadVelocityFilterParameter

Input 2 2 0x77

LoadVelocityinRPM Input 1 2(Note1) 0x75

NationalInstrumentsrecommendsusingLoadVelocityforonboardvariables.

LoadAccel/DecelinRPS/sec

Input 1 2(Note1) 0x75

LoadVectorSpacePosition

Input 3 3 0x76

NationalInstruments

Page 62: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

AbouttheNI-MotionSoftwareNI-MotionsoftwareprovidesacomprehensiveAPIyouusetocontroltheNImotioncontrollers.NI-MotionsoftwarecombinedwiththeNImotioncontrollersprovidefunctionalityandpowerforintegratedmotionsystemsforuseinlaboratory,test,andproductionenvironments.

Forprogrammingease,NI-Motionsoftwareisenhancedbyatoolboxofdrivers,LabVIEWVIlibraries,andWindowsdynamiclinklibraries(DLLs)thatimplementtheentireNI-MotionAPI.

TheNI-MotionsoftwarepackageincludesMeasurement&AutomationExplorer(MAX),whichassociatesphysicalbusaddresseswithboardIDs,whichareusedinprogramstodistinguishbetweencontrollers.MAXalsoverifiesthattheNI-Motioncontrollerisinstalledcorrectlyandiscommunicatingwiththehostcomputer.

ThemotionconfigurationenvironmentunderMAXallowsyoutoconfigureinitializationsettingsthatareusedtoinitializetheNImotioncontroller.MAXalsoprovidesaneasyinteractiveenvironmentfortestingandtroubleshootingthemotionsystem.RefertotheMAXonlinehelpformoreinformation.

Forapplicationdevelopment,theNI-Motionsoftwarepackageincludesexampleprogramstohelpgetyouupandrunningquickly.

AseparateNI-MotionsoftwarepackageincludesacompletemotionClibrary,withexamples,forusewithCorC++developmentenvironments.

Page 63: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

InitializationTheconfigurationpanelsinMeasurement&AutomationExplorer(MAX)allowyoutosetalargenumberofNImotioncontrollerattributessuchasmotortype,limitswitchpolarity,positionmode,andmaximumvelocity.Mostoftheattributesareone-timeconfigurationsettingsthatdonotchange.BysettingtheseattributesonetimeinMAX,yourprogrammingismuchsimpler,andyoucanconcentrateonthemotion-specificpartofyourapplication.

WhenyoucalltheInitializeControllerVI,alltheattributesstoredinMAXareretrievedandsenttothemotioncontroller.Afterthecontrollerisinitialized,youdonotneedtoinitializeeachtimeyouruntheapplication.NationalInstrumentsrecommendsyoucallInitializeControlleronetimeafterrestartingthecomputerorresettingthemotionhardware.Themotorsaretemporarilydisabled(killed)whilethisinitializationprocesstakesplace.

Inmostcases,youcallInitializeControllerwiththeSettingsNameterminalunwired,whichcausesthecurrentinitializationsettingsinMAXtouse.YoualsocaninitializethecontrollerwithalternateinitializationsettingsbypassinginthenameofthealternatesettingasspecifiedinMAX.

ClicktheiconsforVIdescriptions.

InitializeController

Page 64: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Subpalettes

Axis&ResourceConfigurationVIs AdvancedTrajectoryVIsStart&StopMotionVIs MotionI/OVIsFindReferenceVIs BreakpointVIsAnalog&DigitalI/OVIs High-SpeedCaptureVIsAdvancedVIs Error&UtilityVIsTrajectoryControlVIs AdvancedError&UtilityVIsArcVIs OnboardProgrammingVIsGearingVIs ObjectManagementVIsBufferedOperationsVIs DataOperationsVIs

Page 65: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

InitializeControllerInitializesthespecifiedcontrolleraccordingtothesettingsasconfiguredinMeasurement&AutomationExplorer.

Details

DeviceCompatibility

SettingsNameisthenameoftheconfigurationsettings,suchasDefault7330Settings,specifiedinMeasurement&AutomationExplorer(MAX).Tousethecurrentconfigurationsettings,leaveSettingsNameunwiredorpassNULLfortheSettingsNameparameter.ThecurrentsettingsarethesettingsthatareconfiguredinMAX.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,

Page 66: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

ThisVIallowsyoutoinitializethecontrollertoaknownstatebasedupontheconfigurationsettingsstoredintheMeasurement&AutomationExplorerdatabase.ThisVIpullsvaluesfromtheconfigurationdatabaseandcallsdozensofNI-MotionVIs,configuringthecontrollerforyouinonesimplestep.

IftheInitializeControllerVIreturnsanerror,youcancalltheGetLastErrorVItodeterminethespecificNI-MotionVIandresourcegeneratingtheerror.YoucanthencalltheGetErrorDescriptionVI,whichformatsastringforyouwiththeVIname,resourceID,anderrordescription.

NoteIfyouarerunningaNI-MotionstartupapplicationonETS(PharLap)systems,thefirstVIinyourapplicationmustbeeithertheClearPowerUpStatusorInitializeControllerVI.CallinganyotherVIfirstmayresultinerror–70012(NIMC_badBoardIDError)becausethedrivermaynothaveloadedbeforeaNI-MotionVIiscalled.NoteRefertoVIExecutionTimesforbenchmarktiminginformationaboutyourcontroller.

Page 67: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Axis&ResourceConfigurationVIsTheseVIsgiveyouaccesstosomeofthemostpowerfulfeaturesofNI-Motion.Theyallowyoutomapencoder,ADC,andDACresourcestovariousaxes,configureaxesforservoorsteppercontrol,andcombineaxesinto2Dand3Dvectorspacesforadvancedmotioncontrolapplications.

TheseaxisandresourceconfigurationVIsaretypicallyexecutedonetimeduringsysteminitialization.Youcancallmostofthematanytimetoreconfigurethemotioncontrolsystemon-the-fly.AlloftheAxis&ResourceConfigurationVIshavedefaultvaluesthatprovidegoodstartingpointsformanymotioncontrolapplications.

ClicktheiconsforVIdescriptions.

EnableAxes ConfigureMoveCompleteCriteriaConfigureAxisResources LoadVelocityFilterParameterConfigureVectorSpace LoadAllPIDParametersSetStepperLoopMode LoadSinglePIDParameterLoadCounts/StepsperRevolution LoadAdvancedControlParameterConfigureStepperOutput LoadCommutationParameter

Page 68: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ConfigureAxisResourcesConfiguresanaxisbydefiningitsfeedbackandoutputresources.

DetailsRemarks

DeviceCompatibility

SecondaryOutputisthenumberforanoptionalsecondaryoutputresourcebeingmappedtotheaxis.Thisisanoptionalcommandoutput.SelectNonetoconfigurenosecondaryoutputresource.SecondaryFeedbackisthenumberforanoptionalsecondaryfeedbackresourcebeingmappedtotheaxis.Ifasecondaryfeedbackresourceismapped,itisusedforvelocityfeedback(Kv).SelectNonetoconfigurenosecondaryfeedbackresource.RefertotheVelocityFeedbackGainsectionofLoadSinglePIDParameterformoreinformationaboutKv.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisistheaxisforwhichtoloadPIDparameters.Validaxisnumbersare1through15forallNImotioncontrollers.Oncontrollerswithlessthaneightaxes,configuringnon-existentaxeshasnoeffect.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassesthe

Page 69: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheConfigureAxisResourcesVIdefinesthefeedbackandoutputdevicesforanaxis.Youcanconfigureuptotwofeedbackresourcesandtwooutputresourcesforeachaxis.Thisflexiblemappingofresourcestoaxesallowsforadvancedservoandstepperconfigurationssuchas:independentvelocityandpositionfeedbackdevices(dual-loopcontrol),dualDACoutputswithdifferentoffsets,andchangingfeedbackonthefly.

Thevariousfeedbackandoutputresourcesonthemotioncontrollerhavedifferentinterface,performance,andfunctionalitycharacteristics.ThisVIallowsyoutodefinetheaxisandtailoritsperformance.

Thefollowingtablelistsvalidresources:

ResourceType 7330 7340 7350 7390PrimaryFeedback Encoder/ADC Encoder/ADC Encoder/ADC EncoderSecondaryFeedback Encoder Encoder Encoder/ADC —PrimaryOutput Stepper Stepper/DAC Stepper/DAC StepperSecondaryOutput — DAC DAC —

TipRefertoMotionResourcesformoreinformationaboutresourceIDs.TipForinformationabouttheresourceIDs,refertoMotionResources.

ThisVImustbecalledforeachaxisthatisusedbyanapplicationpriortoenablingtheaxis.Thefactorydefaultmappingofresourcestoaxesisasfollows:

Axis PrimaryFeedbackSecondaryFeedback

PrimaryOutput

SecondaryOutput

1 0x21(Enc1) 0 0x31(DAC1) 02 0x22(Enc2) 0 0x32(DAC2) 03 0x23(Enc3) 0 0x33(DAC3) 04 0x24(Enc4) 0 0x34(DAC4) 05 0x25(Enc5) 0 0x35(DAC5) 0

Page 70: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

Ifyouareusinga7330,7340,or7390motioncontroller,youcannotconfigureanaxiswhenanyaxesareenabled.YoumustfirstdisableallaxesusingtheEnableAxesVI.Tochangefeedbackonthefly(NI7350controllersonly),callthisfunctionwhentheaxisisnotmoving(movecomplete).

NoteThefeedbackresourcesusedforswitchingfeedbackontheflymustmeetthefollowingconditions:

Thefeedbackdevicemustbeenabled.Thefeedbackdevicebeingswitchedtomustnotbeusedbyanotheraxis.

RefertoSwitchingFeedbackontheFlyintheNI-MotionHelpfordetailedinformationaboutconfiguringyoursystemtoswitchbetweentwofeedbackdevices.

Example1

Tochangeaxis3tousethefourthencoderchannelandthefirstDACoutput,calltheConfigureAxisResourcesVIwiththefollowingconfiguration:

Axis PrimaryFeedback

SecondaryFeedback

PrimaryOutput

SecondaryOutput

3 0x24(Enc4) 0 0x31(DAC1) 0

Page 71: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ConfigureMoveCompleteCriteriaConfiguresthecriteriafortheMoveCompletestatustobeTrue.

Details

DeviceCompatibility

MoveCompleteMinimumPulse(0)istheminimumtimeinmsthatthemovecompletestatusmuststaytrue.Thisparameterallowsyoutoenforceaminimumpulsewidthonthemovecompletestatuseveniftheaxisisstartedagain.Thisistheamountoftimeyouhavetoreadthemovecompletestatusbeforeitisreset.Therangeis0(default)to255ms.MoveCompleteDelay(0)isaprogrammablesettlingtimedelayinms.Youcanprogramitfrom0(default)to255ms.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisistheaxisforwhichtoloadPIDparameters.Validaxisnumbersare1through15forallNImotioncontrollers.Oncontrollerswithlessthaneightaxes,configuringnon-existentaxeshasnoeffect.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowing

Page 72: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheConfigureMoveCompleteCriteriaVIdefinestheconditionsforreportingamovecomplete.Whenamoveiscompleteonanaxis,thecorrespondingbitintheMCSregisterisset.RefertotheReadMoveCompleteStatusVIforinformationaboutreadingtheMCSregister.Also,theReadperAxisStatusVIcanprovideyouwithmovecompletestatusonaspecifiedaxis.

ThisVIallowsagreatdealofcontroloverwhenandhowamoveisconsideredcomplete.TheCriteriabitmapcontainsfivebitstosettheconditionsusedtodeterminetheMoveCompletestatus.Thefirsttwo,ProfileCompleteandMotorOff,arelogicallyOR'dtoprovidethebasisforMoveComplete.TheProfileCompletebitisalwayssetandcannotbedisabled.Whentheaxistrajectorygeneratorcompletesitsprofile,thisconditionissatisfied.IftheMotorOffbitisset,anyconditionthatcausestheaxistoturnitsmotoroff(akillorfollowingerrortrip)satisfiesthisbasicrequirementforMoveComplete.Inotherwords,eitherProfileCompleteORMotorOffmustbeTrueforMoveCompletetobeTrue.

Thenextthreecriteria,Run/Stop,Delay,andIn-Position,areoptionalconditionsthatarelogicallyANDedtofurtherqualifytheMoveCompletestatus.IftheRun/Stopbitisset,theaxismustalsobelogicallystoppedforthemovetobeconsideredcomplete.RefertotheLoadRun/StopThresholdVIforinformationabouttheRun/Stopstatus.

IftheDelaybitisset,theaxismustwaitauser-defineddelayaftertheothercriteriaaremetbeforethemoveisconsideredcomplete.Theuser-definedMoveCompleteDelayparameteristypicallyusedtowaitthemechanicalsettlingtimesothatamoveisnotconsideredcompleteuntilvibrationsinthemechanicalsystemhavedampedout.ItalsocanbeusedtocompensateforPIDpull-intimeduetotheintegralterm.Thispull-inistypicallyatvelocitiesbelowtheRun/Stopthreshold.

Finally,iftheIn-Positionbitisset,theaxischecksitsfinalstoppingpositionversusitstargetpositionandonlysetstheMoveCompletestatusiftheabsolutevalueofthedifferenceislessthanthein-positiondeadband.

Page 73: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ConfigureStepperOutputConfiguresthedrivemode,outputmode,andpolarityofastepperoutput.

DeviceCompatibility

Details

Polaritysetsthepolarityforthestepperoutput.SelectTRUE(default)foractivelow.SelectFALSEforactivehigh.

Whenconfiguredasactivelow,theoutputisactivewhenthereisalowsignalontheoutputpin.Conversely,activehighmeansthattheoutputisactivewhenthereisahighsignalontheoutputpin.OutputModespecifiesthemodeasStepandDirectionorClockwise/Counterclockwise.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisorStepperOutputistheaxisorstepperoutputtoconfigure.Whensenttoastepperaxis,thisVIconfiguresthemappedstepperoutput.Alternatively,youcanexecutethisVIdirectlyonthestepperoutputresource.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralready

Page 74: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

UsethisVItoconfigureastepperoutputtocorrectlyinterfacewithastepperdriver.NI-Motionsupportsthetwoindustrystandardsforsteppercontroloutputs.ThemostpopularmodeisStepandDirection,whereoneoutputproducesthesteppulsesandtheotheroutputproducesadirectionsignal.

InClockwiseandCounterclockwise(CW/CCW)mode,thefirstoutputproducespulseswhenmovingforward,orCW,whilethesecondoutputproducespulseswhenmovingreverse,orCCW.

Ineithermode,youcansettheactivepolaritywiththepolaritybitasactiveloworactivehigh.Forexample,inStepandDirectionmode,thepolaritybitsdeterminewhetherahighdirectionoutputisforwardorreverse.Italsodeterminestherestingstatesofoutputswhentheyarenotpulsing.

TheConfigureStepperOutputVIistypicallycalledforeachstepperaxispriortousingtheaxis.Afterthemodesandpolarityareset,theyremainineffectuntilchanged.YoucanexecutethisVIatanytime.

Forthe7350controller,youcansetthestepperoutputDriveModetoOpenCollectororTotemPole.Onthe7330/40,stepperoutputisOpenCollectorandcannotbechanged.Onthe7390,stepperoutputisisolatedsoDriveModedoesnotapplyandcannotbechanged.FormoreinformationaboutOpenCollectorandTotemPoledrivemodes,refertothedocumentationforyour7350device.

Page 75: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ConfigureVectorSpaceDefinestheaxesthatareassociatedwithavectorspace.

Details

DeviceCompatibility

ZAxis(3)isthephysicalaxis(1through15)toactasthelogicalzaxis.Thedefaultis3.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.VectorSpaceisthevectorspacetoconfigure.

NoteForNI7330/40/90motioncontrollers,validvectorspacenumbersare0x11(default),0x12,and0x13.NoteFortheNI7350motioncontrollers,validvectorspacenumbersare0x11(default),0x12,0x13,and0x14.

errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.If

Page 76: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

UsetheConfigureVectorSpaceVItogroupaxesintoavectorspace.Avectorspacedefinesanxandy(2D)orx,y,andz(3D)coordinatespace.Youcanmapanyphysicalaxistothelogicalx,y,andzaxestocoordinatethemotionofmultipleaxes.ThetotalnumberofvectorspacesNI-Motionsupportsinyourmotioncontrolsystemcanbecalculatedusingthefollowingformula:

totalvectorspaces= .

TipTounconfigureavectorspace,setallaxestoNone.

Afteritisconfigured,youcanusetheVectorSpacenumberinallVIsthatsupportvectorspaces.Vectorspacesareusedin2Dand3Dlinearinterpolationwithvectorposition,vectorvelocity,vectoraccelerationanddeceleration,andvectoroperationmode.Theyarealsousedincircular,helicalandsphericalarcmoves.Youcanstart,blend,andstopvectorspacesjustlikeaxes.Youcanevensynchronouslystartmultiplevectorspacesformulti-vectorspacecoordination.

ManystatusanddatareadbackVIsalsooperateonvectorspaces.Youcanreadvectorposition,vectorvelocity,vectorblendstatus,andsoon,oryoucanreadper-axisvaluesandstatusfortheaxeswithinthevectorspace.

Whilevectorspacescanbecomprisedofthreeaxes,itispossibletodefinetwo-axisorevenone-axisvectorspaces.ThesevectorspacesfunctionproperlyforallVIsthatdonotrequireagreateraxiscount.

YoucanuseothercomplexmotioncontrolVIswithvectorspaces,includingelectronicallygearinganindependentaxistoamasteraxiscontainedwithinavectorspacedefinition.

NoteRefertoVIExecutionTimesforbenchmarktiminginformationaboutyourcontroller.

Example

Page 77: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

EnableAxesEnablestheoperatingaxesanddefinesthePIDandtrajectoryupdaterate.

DetailsRemarks

DeviceCompatibility

AxisBitmapisthebitmapofenabledaxes.Axis1—Iftrue,axisisenabled.Iffalse,axisisdisabled(default).Axis2—Iftrue,axisisenabled.Iffalse,axisisdisabled(default).Axis3—Iftrue,axisisenabled.Iffalse,axisisdisabled(default).Axis4—Iftrue,axisisenabled.Iffalse,axisisdisabled(default).Axis5—Iftrue,axisisenabled.Iffalse,axisisdisabled(default).Axis6—Iftrue,axisisenabled.Iffalse,axisisdisabled(default).Axis7—Iftrue,axisisenabled.Iffalse,axisisdisabled(default).Axis8—Iftrue,axisisenabled.Iffalse,axisisdisabled(default).

SamplePIDRateisthePIDcontrolloopandtrajectorygeneratorupdaterate,forNI73xxmotioncontrollers.Forstepperaxes,thisparameteralsodetermineshowoftenthestepgeneratorisupdated.Therangeforthisparameteris0to7,withadefaultof3(250µs).

UpdateRate=(SamplePIDRate+1)x62.5µs

SamplePIDRate UpdateRate0 62.5µs1 125µs

Page 78: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheEnableAxesVIisusedtoenablethespecificaxesrequiredfortheapplicationandsettheservo(andstepper)updateorsamplerate.AnaxisisenabledforoperationbyaTrueinthecorrespondinglocationinthebitmap.Onlyenabledaxesareupdatedandthereisadirectcorrespondencebetweenthenumberofenabledaxesandthefastestupdaterateallowed.

Thefastestupdaterateisonlyachievablewhenallaxesaresingle-feedbackservoaxesandnoextraencodersareenabled.

CautionUpdateratesthataretoofastforthenumberofaxes,stepperoutputs,and/orencodersenabledgenerateanerrorandtheprevioussettingremainsineffect.RefertoErrorsandErrorHandlingforinformationabouterrorsanderrorhandling.

TheEnableAxesVIautomaticallyenablesthefeedbackdevicesmappedtotheenabledaxes.ItisnotnecessarytoexplicitlyenabletheencodersorADCchannelsbeforeenablingtheaxes.AxesmustbekilledbeforetheyaredisabledortheerrorNIMC_wrongModeErrorisgenerated.RefertotheEnableEncodersandEnableADCsVIsformoreinformationaboutenablinganddisablingtheseresourceswhenyouareusingthemnotmappedtoanaxis.

NoteADCchannelscanrateisaffectedbythenumberofchannelsenabled.Thiscouldlimittheeffectiveupdaterate(foraxeswithanalogfeedback).RefertotheEnableADCsVIformoreinformation.CautionIllegallyconfiguredaxescannotbeenabled,andattemptingtodosogeneratesanerror.Forexample,anattempttoenableaservoaxisthatdoesnotatleasthaveitsPrimaryFeedbackdevicemappedgeneratesanerror.

Youalsocansettheupdaterateslowerthanthemaximum.ThisisusefulinmanyapplicationstoscaletheeffectiverangeofthePIDcontrolloopparametersand/ortoimprovestability.RefertotheLoadSinglePIDParameterVIformoreinformationaboutthePIDparametersaffectedbytheupdaterate.

Page 79: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

TheADCchannelscanrateisaffectedbythenumberofchannelsenabled.Thiscouldlimittheeffectiveupdaterate(foraxeswithanalogfeedback).RefertotheEnableADCsVIformoreinformation.ThisVIisusedtoenablethespecificaxesrequiredfortheapplicationandsettheservo(andstepper)updateorsamplerate.AnaxisisenabledforoperationbyaTrueinthecorrespondinglocationinthebitmap.Onlyenabledaxesareupdatedandthereisadirectcorrespondencebetweenthenumberofenabledaxesandthefastestupdaterateallowed.

NumberofEnabledAxes(7330/40/90)

FastestUpdateRate

NumberofEnabledAxes(7350)

FastestUpdateRate

1 62µs 1–2 62µs2 125µs 3–4 125µs3 188µs 5–6 188µs4 250µs 7–8 250µsThefastestupdaterateisachievableonlywhenallaxesaresingle-feedbackservoaxesandnoextraencodersareenabled.

CautionUpdateratesthataretoofastforthenumberofaxes,stepperoutputs,and/orencodersenabledgeneratesanerrorandtheprevioussettingremainsineffect.RefertoErrorsandErrorHandlingforinformationabouterrorsanderrorhandling.

TheEnableAxesVIautomaticallyenablesthefeedbackdevicesmappedtotheenabledaxes.ItisnotnecessarytoexplicitlyenabletheencodersorADCchannelsbeforeenablingtheaxes.Axesmustbekilledbeforethey

Page 80: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadAxisConfigurationParameterLoadsdataonaperaxisbasisforanaxisconfigurationobjectonthemotioncontroller.

DetailsRemarks

DeviceCompatibility

DataisaclusterofvariablesthatcontainsthevaluesfortheselectedAttribute.

Integeris32-bitintegerdata.Doubleis64-bitfloatingpointdata.BooleanisBooleandata.

Attributeistheattributeyouwanttoload:

Enableenablesthecurrentlyselectedaxis.SettheBooleanelementoftheDataclustertoTRUEtoenabletheaxis,andtoFALSEtodisabletheaxis.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorerusedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisIDistheaxisyouarecontrolling.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralready

Page 81: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

UsethisVItoloadthedataonaperaxisbasisfortheAxisConfigurationobjectonthemotioncontroller.

Page 82: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxcontroller:

Becausethenumberofaxesenableddependsonthecontrollooprate,usetheEnableAxesVItoenable/disableanaxisfor73xxcontrollers.

Page 83: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadAdvancedControlParameterSetsanadvancedcontrolloopparameterforagivenaxis.

DetailsRemarks

DeviceCompatibility

Valueisthevaluetoloadforthespecifiedparameter.ControlParameterisoneofthefollowingcontrolloopparameterstoset:StaticFrictionModeStaticFrictionMaxDeadzoneStaticFrictionMinDeadzoneStaticFrictionForwardVoltageOffsetStaticFrictionReverseVoltageOffsetPIDRateMultiplierNotchFilterFrequencyNotchFilterBandwidthNotchFilterEnableLowpassFilterCutoffFrequencyLowpassFilterEnableSecondSetofPIDParametersBoardIDisauniquenumberassignedbyMeasurement&Automation

Page 84: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

UsetheLoadAdvancedControlParameterVItoconfigureanadvancedcontrolloopparameterforagivenaxis.

EnableStaticFrictionModetoconfigurestaticfriction(stiction)compensationonthemotionsystem.Stictioncompensationadjustsforincreasedpowerneededtoovercomestaticfrictionwhenbeginningamovefromastandstill.SetStaticFrictionModeto1toenable,or0todisable,staticfrictioncompensation.

TheMaxandMinDeadzonesarethewindowsaroundthetargetpositionthatdetermineitssensitivitytoexternalforcesthattrytomoveitfromitsposition.Insidethemaximumdeadzonewindow,anaxiscanbemovedwithoutresponse.Assoonasthemovementcausestheaxistoexceedthemaximumdeadzone,thecontrollooprespondsbycorrectingthepositionbacktowithinthewindowdefinedbyminimumdeadzone.Therangeis1to32,767.

ForwardandReverseOffsetVoltagesarethevoltagesnecessarytoovercomestaticfrictionwhenbeginningamove.Thevoltagescanbethesameforbothdirections,butcanbedifferentundersomecircumstances.Forexample,ifanaxismovesagainstgravityinonedirectionandwithgravityintheotherdirection,theoffsetvoltagenecessarytoovercomestaticfrictionagainstgravityishigherthanthatofthedirectionthatmoveswithgravity.

ThePIDRateMultiplierspecifiesamultipliertoslowthePIDRate.Thedefaultis1(nochange),andtherangeis1to10.Forexample,witha250µsPIDRateandaPIDRateMultiplierof4,theeffectivecontrollooprateisshowninthefollowingequation:

effectiverate=PIDRate×PIDRateMultiplier=250µs×4=1ms

Notchfiltersremoveanarrowbandoffrequenciesaroundagivenpointtofilteroutputsignalsthatcouldcausesysteminstability.SetNotchFilterEnableto1toenable,or0todisable,thefilter.UseNotchFilterFrequencytospecifythefrequencyofthesignalthatyouwanttoremove.Therangeforthefrequencyis1HztoPIDRate(inHz)/2.UseNotchFilterBandwidthtospecifythe

Page 85: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxcontroller:

StaticFrictionandPIDRateMultiplierparameterscanbesetonlyon7340/50motioncontrollers.NotchFilterandLowpassFilterparameterscanbesetonlyon7350motioncontrollers.SecondSetofPIDParametersisvalidonlyon7350controllers.

OnlytheDisabledandSwitchFeedbackoptionsarevalid.IftheSwitchFeedbackoptionisselected,thecontrollooptogglesbetweensetsofPIDparameterseachtimethefeedbackischanged.Forexample,ifyouareusingencoder1,thecontrolloopusestheprimarysetofPIDparameters.IfyouswitchtoADC1,thecontrolloopusesthesecondarysetofPIDparameters.Ifyouswitchbacktoencoder1,thecontrolloopswitchesbacktotheprimarysetofPIDparameters.

NISoftMotionControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

IftheSwitchFeedbackoptionisselected,thecontrolloopusestheprimarysetofPIDparameterswhenyouuseaprimaryresourceandusesthesecondarysetofPIDparameterswhenyouuseanauxiliaryresource.Forexample,ifyouuseencoder1,thecontrolloopusestheprimarysetofPIDparameters.Ifyouuseauxiliaryencoder1,thecontrolloopusesthesecondarysetofPIDparameters.SecondSetofPIDParametersisnotvalidfortheNISoftMotion

Page 86: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadAllPIDParametersLoadsall8PIDcontrolloopparametersforanaxis.

Details

DeviceCompatibility

PIDParametersdatastructurecontainsalleightPIDparametersinthefollowingstructure:

Kp—ProportionalGainKi—IntegralGainIL—IntegrationLimitKd—DerivativeGainTd—DerivativeSamplePeriodKv—VelocityFeedbackGainAff—AccelerationFeedforwardGainVff—VelocityFeedforwardGain

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisistheaxisforwhichtoloadPIDparameters.Validaxisnumbersare1through15forallNImotioncontrollers.Oncontrollerswithlessthaneightaxes,configuringnon-existentaxeshasnoeffect.InpVectindicatesthesourceofthedataforthisVI.Availableinputvectorsincludeimmediate(0xFF),variable(0x01through0x78),or

Page 87: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheLoadAllPIDParametersVIallowsyoutosetall8PIDparametersatthesametimeforagivenaxis.YoucancallthisVIatanytime.However,itistypicallyusedduringinitializationtoconfigureandtuneanaxis.NI-MotionalsooffersaLoadSinglePIDParameterVI,whichyoucanusetochangeanindividualvalueon-the-flywithouthavingtoworryabouttheotherunchangedvalues.

RefertothemotioncontrollerdocumentationforanoverviewofthePIDcontrolloopontheNImotioncontrollerandtotheLoadSinglePIDParameterVIfordescriptionsontheindividualPIDparametersandtheirranges.

NoteIfyouaredoingonboardprogrammingandareusingInpVecttogetthedatathisVIneeds,thisVIreadsthevariablesstartingatthememoryaddresspointedtobyInpVectinthefollowingorder:Kp,Ki,IL,Kd,Td,Kv,Aff,Vff.

LoadingaSecondSetofPIDParameters

ToloadasecondsetofPIDparameters,usetheLoadAllPIDParametersandLoadSinglePIDParameterVIstoloadthesecondsetofPIDvalues.InsteadofusingregularaxisresourceIDs,suchasaxis1=0x1(1),axis2=0x2(2),andsoon,usethefollowingalternateresourceIDs:axis1=0xA1(161),axis2=0xA2(162).

UsetheLoadAdvancedControlParameterVItoenablethenewsetofPIDparametersbasedontheconditionspecifiedinthevalueparameter.

RefertotheRemarkssectionoftheLoadAdvancedControlParametertopicformoreinformationabouthowtochangefeedbackwhiletheaxisisenabled.

Page 88: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadCommutationParameterSetsacommutationparameterforagivenaxis.

Details

DeviceCompatibility

Attributeisoneofthefollowingcommutationattributestoset:InitializationTypeFindZeroVoltageFindZeroTimeDirectSetPhaseElectricalCycleCountsHallSensorTypeCommutationModeBoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Axisistheaxistoconfigure.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

Page 89: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

UsetheLoadCommutationParameterVItoconfigureacommutationparameterforagivenaxis.

NoteOnly7350controllerssupporttheLoadCommutationParameterVI.

InitializationTypespecifieshowthecontrollerinitializesthecommutationphase.Selectoneofthefollowingvalues:

Value Description0 HallSensor—InitializesthephasebasedontheHallsensor'sinput.

1 ShakeandWake—Initializesthephasebydrivingthesystemtothezerodegreecommutationphase.

2 DirectSet—Setsthecommutationphasedirectlywiththephaseanglespecified.

CautionPhaseinitializationisperformedwhentheaxesareenabled.IfyouuseShakeandWake,thesystemcanmoveduringtheinitializationprocess.

FindZeroVoltagespecifiesthevoltagetousewithShakeandWakeinitialization.Therangeis0to10.FindZeroTimespecifiesthedurationofShakeandWakeinitializationinmilliseconds.Therangeis0to10,000ms.

DirectSetPhasespecifiesphaseangletosetwithDirectSetinitialization.ForDirectSet,thecontrollersetsthecurrentpositionasthespecifiedphaseangle.NationalInstrumentsrecommendsthisinitializationmethodonlyforcustomsystemswithaknowninitialphaseangle.Therangeforthephaseangleis0to359°.

ElectricalCycleCountsspecifiestheencodercountsforthecommutationcycle.Thisinformationisusuallylistedinthemotororstagedocumentation.Somemotormanufacturerspresentthisinformationasthenumberofpoles.Insuchcases,convertnumberofpolestocountsperelectricalcyclewiththefollowingequation.Therangeis2to268,435,000counts.

Page 90: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadCounts/StepsperRevolutionLoadsthequadraturecountsorstepsperrevolutionforanaxis.

DetailsRemarks

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Axisistheaxistocontrol.Counts(Steps)/Reviseitherthequadraturecountsperrevolutionfortheencodermappedtotheaxisorthenumberofsteps(full,half,ormicrostep)permotorrevolution.Thedefaultis2,000.UnitTypeisthetypeofinformation,countsorsteps,toload.Thedefaultiscounts.

Validvaluesare:

Counts—Usetodefinecounts/revolutionforaquadratureencoder.

Steps—Usetodefinesteps/revolutionforasteppermotor.

errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassesthe

Page 91: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

UsetheLoadCounts/StepsperRevolutionVItoloadanyfeedbackvalue(countsorvolts)perunitofmeasureortoloadthenumberofstepspermotorrevolution.Forencoders,thisistypicallyinunitsofquadraturecountspermotorrevolution,butcanbecountsperinch,percm,orperanyunitofmeasure.Foranalogfeedback,itcanbeinunitsofscaledvoltage.Stepscanbefullsteps,halfsteps,ormicrostepsdependinguponhowyouhavetheexternalstepperdriverandmotorconfigured.

ThisparametermustbecorrectlyloadedbeforeyoucalltheLoadVelocityinRPM,LoadAccel/DecelinRPS/sec,LoadVelocityThresholdinRPM,ReadVelocityinRPM,LoadMoveConstraints,orFindReferenceVIs.

TheFindReferenceVIsearchesfortheencoderindexforonerevolutionasdefinedbythisVI.Therefore,anotherusefulunitofmeasureiscountsperindexperiod.Linearencodersoftenhaveindexeseveryinchoreverycentimeter.

Closed-loopstepperfunctionalityreliesontheratioofcountstostepsandnotontheabsolutevaluesofcountsorstepsperrevolution.Forclosed-loopoperation,anyunitofmeasure(UOM)thatallowsyoutoenterbothcountsperUOMandstepsperUOMthatarewithintheirvalidrangeswork.NoticethatthisVImustbecalledtwice:onetimetosetupthesteppermotorsteps/rev,andagaintosetupthequadratureencodercounts/rev.

CautionForclosed-loopsteppercontrollers,stepsperrevolution/countsperrevolutionmustbeintherangeof1/32,767<steps/counts<32,767.

TheLoadCounts/StepsperRevolutionVIsimplyloadsascalefactorthataffectssubsequentlyloadedandreadbackvaluesofvelocityandacceleration.

Page 92: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxcontroller:

Counts(Steps)/RevisinterpretedasnumberofencodercountsperrevolutionforencoderfeedbackornumberofADCcodes(LSBs)perrevolutionforanalogfeedback.TherangefortheCounts(Steps)/Revparameteris2to228–1withadefaultvalueof2,000.

NISoftMotionControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

TherangefortheCounts(Steps)/Revparameteris1to231–1withadefaultvalueof1.

NoteThisparametermustbecorrectlyloadedbeforeyouloadtargetpositionsorwritecontourpositioninformationtothecontrollerorcammingtable.

ThisVIdeterminestheunitusedwhenloadingvelocity.YoumustsettheCounts(Steps)/Revvalueto1tousethisVItoloadvelocityvaluesincounts/secandloadaccelerationvaluesincounts/sec2.IfyousetCounts(Steps)/Revtoanyvalueotherthan1,youmustusetheLoadMoveConstraintsVItoloadvelocityandaccelerationincounts.

Page 93: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadSinglePIDParameterLoadsasinglePIDcontrolloopparameterforanaxis.

Details

DeviceCompatibility

Value(0)isthevaluetoloadfortheselectedPIDparameter.

PIDParameter Abbreviation DataRange DefaultProportionalGain Kp 0to32,767 100IntegralGain Ki 0to32,767 0IntegrationLimit Ilim 0to32,767 1,000DerivativeGain Kd 0to32,767 1,000DerivativeSamplePeriod Td 0to63 2VelocityFeedbackGain Kv 0to32,767 0AccelerationFeedforwardGain Aff 0to32,767 0VelocityFeedforwardGain Vff 0to32,767 0Parameter(Kp)istheselectorforthePIDparametertoload.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisistheaxisforwhichtoloadPIDparameters.Validaxisnumbersare1through15forallNImotioncontrollers.Oncontrollerswithlessthaneightaxes,configuringnon-existentaxeshasnoeffect.

Page 94: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

ThisVIexpectstobegiventheparametersinthefollowingorder:Axis,Parameter,Value.

RefertothemotioncontrollerdocumentationforanoverviewoftheenhancedPIDcontrolloopontheNImotioncontroller.TheLoadSinglePIDParameterVIallowsyoutochangeanindividualPIDvalueon-the-flywithouthavingtoworryabouttheotherunchangedPIDvalues.

Example

ToloadaKpof1,000toanaxis2,calltheLoadSinglePIDParameterVIwiththefollowingparameters:

Axis=2Parameter=KpValue=1,000InpVect=0xFF(Immediate)

NoteIfyouaredoingonboardprogrammingandareusingInpVecttogetthedatathisVIneeds,rememberthatthisVIreadsthevariablesstartingatthememoryaddresspointedtobyInpVectinthefollowingorder:Parameter,Value.

LoadingaSecondSetofPIDParameters

ToloadasecondsetofPIDparameters,usetheLoadAllPIDParametersandLoadSinglePIDParameterVIstoloadthesecondsetofPIDvalues.InsteadofusingregularaxisresourceIDs,suchasaxis1=0x1(1),axis2=0x2(2),andsoon,usethefollowingalternateresourceIDs:axis1=0xA1(161),axis2=0xA2(162).

UsetheLoadAdvancedControlParameterVItoenablethenewsetofPIDparametersbasedontheconditionspecifiedinthevalueparameter.

Page 95: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadVelocityFilterParameterSetsthevelocityFilterTimeConstantforthedigitalsingle-polelowpassfilterusedtoaveragetheinstantaneousaxisvelocity.

DetailsRemarks

DeviceCompatibility

UpdateIntervalisthemaximumvelocityupdateperiodinms.Therangeforthisparameteris1to2,500ms.FilterDistanceisthenumberofpositionchangesincounts/stepsnecessaryforavelocitytobereported.Therangeforthisparameterisfrom0to1,000counts/steps.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Axisistheaxistoconfigure.InpVectcontainsthedistanceandintervalparametersthatarethesourceofthedataforthisVI.

Availableinputvectorsincludeimmediate(0xFF),variable(0x01through0x78),orindirectvariable(0x81through0xF8).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralready

Page 96: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

ThisVIconfigurestheinternalfilterforvelocityreporting.Thereportedvelocitycanoscillateduetofeedbackquantizationerror,noise,andjitterysystems,renderingthedatauseless.Youcanapplyafilterovermultipledatasamplestocalculateanaveragevelocitythatreflectstheactualsystembehavior.ThisfilterisrepresentedbyFilterDistance.ThelargertheFilterDistance,themorepositionchangesaccumulatetoperformvelocitycalculation.Thisisusuallybetterforanoisysystem.

AlargeFilterDistancecanintroducealongerdelayinvelocityreportingasthepositionchangesaccumulate.Tolimitthisdelayandsluggishdatareading,specifyaminimumupdateintervalusingtheUpdateIntervalparameter.TheaxisvelocityisupdatedwithinthisupdateintervaliftheFilterDistancerequirementisnotmet.

NoteVelocityquantizationnoiseisameasurement-onlyphenomenonanddoesnotaffecttheabilityofthemotioncontrollertoaccuratelycontrolvelocityandpositionduringamove.

Page 97: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NISoftMotionControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

FortheInpVectparameter,theNISoftMotionControllersupportsonlytheimmediatereturnvector(0XFF).

Page 98: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

SetStepperLoopModeSetsastepperaxistooperateineitheropen-loop,closed-loop,orP-Commandmode.

Details

DeviceCompatibility

LoopMode(Open)setsthemodeforthestepperaxis.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisistheaxisforwhichtoloadPIDparameters.Validaxisnumbersare1through15forallNImotioncontrollers.Oncontrollerswithlessthaneightaxes,configuringnon-existentaxeshasnoeffect.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningof

Page 99: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

Youcanoperatestepperaxesinbothopenandclosed-loopmodes.Inopen-loopmode,thestepperaxiscontrolsthetrajectoryprofileandgeneratesstepsbuthasnofeedbackfromthemotororactuatortodetermineiftheprofileisfollowedcorrectly.

Inclosed-loopmode,thefeedbackpositionisconstantlycomparedtothenumberofstepsgeneratedtoseeifthesteppermotorismovingcorrectly.Whenthetrajectoryprofileiscomplete,missingsteps(ifany)aremadeupwithapull-inmove.If,atanytimeduringthemove,thedifferencebetweentheinstantaneouscommandedpositionandthefeedbackpositionexceedstheprogrammedfollowingerrorlimit,theaxisiskilledandmotionstops.

YouuseP-Commandmodeforsystemsinwhichaservodrivereceivesstep/dir(CW/CCW)fromthemotioncontroller.ThedriveclosesthePIDloop,andthemotioncontrollergeneratesthetrajectory.Similartoclosed-loopmode,inP-Commandmode,theaxisiskilledwhentheprogrammedfollowingerrorlimitisexceeded.

CautionForproperclosed-loopandP-Commandoperation,thecorrectvaluesforsteps/revandcounts/revmustbeloadedwiththeLoadCounts/StepsperRevolutionVI.Incorrectcountstostepsratiocanresultinfailuretoreachthetargetpositionanderroneousclosed-loopstepperoperation.

Tooperateinclosed-looporP-Commandmode,astepperaxismusthaveaprimaryfeedbackresource,suchasanencoder,mappedtoitpriortoenablingtheaxis.RefertotheConfigureAxisResourcesVIformoreinformationaboutfeedbackresources.Youcanoperateanaxiswithaprimaryfeedbackresourceinopen-loop,closed-loop,orP-Commandmodeandyoucanswitchthemodeatanytime.Youcanstillreadthepositionofthemappedfeedbackresourceevenwhentheaxisisinopen-loopmode.

Page 100: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

TrajectoryControlVIsThisVIgroupcontainsdetaileddescriptionsofVIsusedtosetupandcontrolmotiontrajectoriesontheNImotioncontroller.ItincludesVIstoloaddouble-bufferedtrajectoryparameters,readbackinstantaneousvelocity,positionandtrajectorystatus,aswellasVIstoconfigureblending,gearing,andotheradvancedtrajectoryfeatures.

Doublebufferedparametersforaxesandvectorspacesincludeacceleration,deceleration,velocity,s-curve,operationmode,targetposition,andcircular,helical,andsphericalarcparameters.Youcansendtheseparameterstothecontrolleratanytime,buttheydonottakeeffectuntilyouexecutethenextStartMotionorBlendMotionVI.Thisdoublebufferingallowsyoutosetupmovesaheadoftime,synchronizingthemwithasingleStartMotionorBlendMotioncall.

OthertrajectoryVIsallowyoutoconfiguretheoperationoftrajectorygeneratorsandsetstatusthresholds.Theseparametersincludefollowingerror,blendfactor,gearmaster,ratioandenable,positionmodulus,velocitythreshold,torquelimit,torqueoffset,andsoftwarelimitpositions.Unlikedouble-bufferedparameters,ifyouchangetheseparametersonthefly,theytakeeffectimmediately.AlsointhiscategoryareVIstoresetpositiontozerooranotherspecifiedvalueandtoforceavelocityoverride.

Duringamove,youcanreadtheinstantaneousvaluesofposition,velocity,followingerror,andDACoutput(torque).TherearealsoVIstoreadthefollowingtrajectorystatus:movecomplete,profilecomplete,blendcomplete,motoroff,followingerrortrip,velocitythreshold,andDAClimitstatus.Thesetrajectoryvaluesandstatusareusedformovesequencing,systemcoordination,andoverallmonitoringpurposes.

Finally,NI-MotionoffersasetofVIstoacquiretime-sampledpositionandvelocitydataintoalargeonboardbufferandthenlaterreaditoutforanalysisanddisplay.TheseVIsimplementadigitaloscilloscopethatisusefulduringsystemsetup,PIDtuning,andgeneralmotionwithdataacquisitionsynchronization.

Page 101: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ClicktheiconsforVIdescriptions.

LoadTargetPosition ReadPositionLoadVectorSpacePosition ReadVectorSpacePositionLoadVelocity ReadVelocityLoadAcceleration/Deceleration ReadVelocityinRPMSetOperationMode CheckBlendCompleteStatusResetPosition CheckMoveCompleteStatusLoadMoveConstraint WaitforBlendCompleteReadperAxisStatus WaitforMoveComplete

Page 102: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Subpalettes

ArcVIs

GearingandCammingVIs

BufferedOperationsVIs

AdvancedTrajectoryVIs

Page 103: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

CheckBlendCompleteStatusCheckstheblendcompletestatusforanaxis,vectorspace,groupofaxes,orgroupofvectorspaces.

Details

DeviceCompatibility

Axis/VSMapisthebitmapofaxesorvectorspacestocheck.ItisonlyrequiredwhenmultipleaxesorvectorspacesareselectedwiththeAxisorVectorSpaceparameter.Otherwise,thisparameterisignored.

Whencheckingmultipleaxes(Axis/VSMap=AxisControl):

Axis1—Iftrue,blendmustbecompleteonthespecifiedaxis.Iffalse,blendcanbeeithercompleteornotcompleteonthespecifiedaxis(donotcare).Axis2—Iftrue,blendmustbecompleteonthespecifiedaxis.Iffalse,blendcanbeeithercompleteornotcompleteonthespecifiedaxis(donotcare).Axis3—Iftrue,blendmustbecompleteonthespecifiedaxis.Iffalse,blendcanbeeithercompleteornotcompleteonthespecifiedaxis(donotcare).Axis4—Iftrue,blendmustbecompleteonthespecifiedaxis.Iffalse,blendcanbeeithercompleteornotcompleteonthespecifiedaxis(donotcare).Axis5—Iftrue,blendmustbecompleteonthespecifiedaxis.If

Page 104: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

ThisVIextendsthefunctionalityoftheReadBlendStatusVI,suchthatyoucandefineacombinationofaxesorvectorspacestocheckasagroup.Italsocanchecktheblendcompletestatusforasingleaxisorvectorspace,muchthesameasReadBlendStatus.InsteadofdecodingtheoutputoftheReadBlendStatusVIyourself,thisVIdoesthatforyoubycomparingtheaxesorvectorspacesspecifiedintheAxisorVectorSpaceandAxis/VSMapinputparameterswiththeblendcompletestatusfortheappropriateaxesorvectorspaces.Theoutputisasingletrue/falsevalueindicatingwhetherornotthespecifiedblendorblendsarecomplete.

ThisVIdoesnotcheckforfollowingerrorstatusoraxisoffstatus.Checkingforfaultsduringmovesisrecommended.Todothis,useReadperAxisStatus,whichreturnsfollowingerrorandaxisoffstatusinadditiontothemovecompletestatus.RefertotheNI-MotionHelpformoreinformationandexamplecode.

Formoreinformationaboutblendcompletestatus,refertotheReadBlendStatusVI.

NoteRefertoVIExecutionTimesforbenchmarktiminginformationaboutyourcontroller.

Page 105: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

CheckMoveCompleteStatusChecksthemovecompletestatusforanaxis,vectorspace,groupofaxes,orgroupofvectorspaces.

Details

DeviceCompatibility

Axis/VSMapisthebitmapofaxesorvectorspacestocheck.ItisonlyrequiredwhenmultipleaxesorvectorspacesareselectedwiththeAxisorVectorSpaceparameter.Otherwise,thisparameterisignored.

Whencheckingmultipleaxes(Axis/VSMap=AxisControl):

Axis1—Iftrue,movemustbecompleteonthespecifiedaxis.Iffalse,movecanbeeithercompleteornotcompleteonthespecifiedaxis(donotcare).Axis2—Iftrue,movemustbecompleteonthespecifiedaxis.Iffalse,movecanbeeithercompleteornotcompleteonthespecifiedaxis(donotcare).Axis3—Iftrue,movemustbecompleteonthespecifiedaxis.Iffalse,movecanbeeithercompleteornotcompleteonthespecifiedaxis(donotcare).Axis4—Iftrue,movemustbecompleteonthespecifiedaxis.Iffalse,movecanbeeithercompleteornotcompleteonthespecifiedaxis(donotcare).Axis5—Iftrue,movemustbecompleteonthespecifiedaxis.If

Page 106: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

ThisVIextendsthefunctionalityoftheReadTrajectoryStatusVI,suchthatyoucandefineacombinationofaxesorvectorspacestocheckasagroup.Italsocancheckthemovecompletestatusforasingleaxisorvectorspace,muchthesameasReadBlendStatus.InsteadofdecodingtheoutputoftheReadTrajectoryStatusVIyourself,thisVIdoesthatforyoubycomparingtheaxesorvectorspacesspecifiedintheAxisorVectorSpaceandAxisorVSMapinputparameterswiththemovecompletestatusfortheappropriateaxesorvectorspaces.Theoutputisasingletrue/falsevalueindicatingwhetherornotthespecifiedmoveormovesarecomplete.

ThisVIdoesnotcheckforfollowingerrorstatusoraxisoffstatus.Checkingforfaultsduringmovesisrecommended.Todothis,useReadperAxisStatus,whichreturnsfollowingerrorandaxisoffstatusinadditiontothemovecompletestatus.RefertotheNI-MotionHelpformoreinformationandexamplecode.

Formoreinformationaboutmovecompletestatus,refertotheReadTrajectoryStatusandConfigureMoveCompleteCriteriaVIs.

NoteRefertoVIExecutionTimesforbenchmarktiminginformationaboutyourcontroller.

Page 107: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadAcceleration/DecelerationLoadsthemaximumaccelerationand/ordecelerationvalueforanaxisorvectorspace.

DetailsRemarks

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisorVectorSpaceistheaxisorvectorspacetocontrol.InpVectindicatesthesourceofthedataforthisVI.Availableinputvectorsincludeimmediate(0xFF),variable(0x01through0x78),orindirectvariable(0x81through0xF8).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroora

Page 108: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheLoadAccelerationVIspecifiesthemaximumrateofaccelerationand/ordecelerationforindividualaxesorvectorspaces.Whenexecutedonavectorspace,thevaluecontrolsthevectoracceleration(deceleration)alongthevectormovepath.

YoucanusethisVItoloadseparatelimitsforaccelerationanddecelerationortosetthembothtothesamevaluewithonecall.Theseparametersaredouble-bufferedsoyoucanloadthemontheflywithoutaffectingthemoveinprocess,andtheytakeeffectonthenextStartorBlendMotioncall.Aftertheyareloaded,theseparametersremainineffectforallsubsequentmotionprofilesuntilre-loadedbythisVI.Youdonotneedtoloadaccelerationbeforeeachmoveunlessyouwanttochangetheaccelerationand/ordeceleration.

Accelerationdefineshowquicklytheaxisoraxescomeuptospeedandistypicallylimitedtoavoidexcessivestressonthemotor,mechanicalsystem,and/orload.Aseparate,slowerdecelerationisusefulinapplicationswherecomingtoagentlestopisimportant.

NoteUseLoadMoveConstraintstoloadanaccelerationoflessthan1count/s2.

Page 109: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

Accelerationanddecelerationvaluesareconvertedtoaninternal16.16fixed-pointformatinunitsofcounts/s2beforebeingusedbythetrajectorygenerator.Youcancalculatetheminimumaccelerationincrementwiththefollowingformula:

minimumacceleration/deceleration=Amin×( )2

where:Aminis1/65,536counts/sample2orsteps/sample2,Tsisthesampleperiodinsecondspersample.Foratypicalservoaxiswith2,000countsperrevolutionoperatingatthe250msupdaterate,calculatetheminimumacceleration/decelerationincrementusingthefollowingequation:

× =0.122070counts/sYoucancalculatethemaximumacceleration/decelerationusingthefollowingequation:

maximumacceleration/deceleration=Amax×( )2

where:Amaxis32counts/sample,Tsisthesampleperiodinsecondspersample,andisconstrainedaccordingtothefollowingequations:

acceleration 256×decelerationdeceleration 65536×accelerationIfyouaredoingonboardprogrammingandareusingInpVecttogetthe

Page 110: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadTargetPositionLoadsthetargetpositionforthenextaxismove.

Details

DeviceCompatibility

TargetPosition(0)isthetargetpositionforthenextaxismoveincounts(servoaxes)orsteps(stepperaxes).Targetpositionscanbeanywherewithinthe32-bitpositionrange,–(231)to+((231)–1).Thedefaultvaluefortargetpositioniszero(0).

CautionAnysinglemoveislimitedto±(231–1)countsorsteps.AnerrorisgeneratedifyouexceedthislimitbyloadingatargetpositiontoofarfromthecurrentAxisposition.

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Axisistheaxistocontrol.InpVectindicatesthesourceofthedataforthisVI.Availableinputvectorsincludeimmediate(0xFF),variable(0x01through0x78),orindirectvariable(0x81through0xF8).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassesthe

Page 111: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheLoadTargetPositionVIloadsatargetpositiontothespecifiedaxis.Targetpositionscanbeforsingleaxismoves,multi-axiscoordinatedmoves,orvectorspacemoves.Positionvaluesindicatetheendlocationanddirectionofmotion(targetposition).

NoteRefertotheLoadVectorSpacePositionVIforaneasywaytoloaduptothreetargetpositionsforavectorspaceinonecall.

Targetpositionisdouble-bufferedsoyoucanloaditontheflywithoutaffectingthemoveinprocess,andittakeseffectonthenextStartorBlendMotionVI.Whenthetargetpositionisloaded,itisinterpretedaseitheranabsolutetargetposition,arelativetargetposition,atargetpositionrelativetothelastcapturedpositionorwiththeeffectofapositionmodulus,dependingonthemodesetwiththeSetOperationModeVI.

Thismeansthatifyousettheoperationmodeto"relativetocapture,"youmustloadthetargetpositionafterthecapturehasoccurredbecausethepositionisevaluatedonload.

Afteryouexecutethestartorblend,theaxisoraxesfollowtheprogrammedtrajectoryandendupattheabsolute,relative,ormodulotargetposition.

NoteRefertoVIExecutionTimesforbenchmarktiminginformationaboutyourcontroller.

Page 112: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadVectorSpacePositionLoadstheaxistargetpositionsforthenextvectorspacemove.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.VectorSpaceisthevectorspacetocontrol.InpVectindicatesthesourceofthedataforthisVI.Availableinputvectorsincludeimmediate(0xFF),variable(0x01through0x78),orindirectvariable(0x81through0xF8).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,

Page 113: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheLoadVectorSpacePositionVIloadsuptothreeaxistargetpositionsforthevectorspacespecified.ThisVIisidenticaltocallingtheLoadTargetPositionVIuptothreetimes,onetimepereachaxisinthevectorspace.Positionvaluesindicatetheendlocationanddirectionofmotion(targetposition).

Targetpositionsaredouble-bufferedsoyoucanloadthemontheflywithoutaffectingthemoveinprocess,andtheytakeeffectonthenextStartorBlendMotionVI.Whenthetargetpositionsareloaded,theyareinterpretedaseitherabsolutetargetpositions,relativetargetpositions,targetpositionsrelativetothelastcapturedpositionsorwiththeeffectofapositionmodulus,dependingonthemodesetwiththeSetOperationModeVI.

Thismeansthatifyousettheoperationmodeto"relativetocapture,"youmustloadthetargetpositionafterthecapturehasoccurredbecausethepositionisevaluatedonload.

Afteryouexecutethestartorblend,theaxesinthevectorspacefollowtheprogrammedtrajectoryandendupattheabsolute,relative,ormodulotargetpositions.

NoteIfthevectorspacecontainslessthanthreeaxes,theextratargetpositionvaluesareignored.NoteIfyouaredoingonboardprogrammingandareusingInpVecttogetthedatathisVIneeds,rememberthatthisVIreadsthevariablesstartingatthememoryaddresspointedtobyInpVectinthefollowingorder:XPosition,YPosition,ZPosition.NoteRefertoVIExecutionTimesforbenchmarktiminginformationaboutyourcontroller.

Page 114: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadVelocityLoadsthemaximumvelocityforanaxisorvectorspace.

DetailsRemarks

DeviceCompatibility

Velocityisthetargetormaximumvelocityincounts/s(servoaxes)orsteps/s(stepperaxes).Thedefaultis10000.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisorVectorSpaceistheaxisorvectorspacetocontrol.InpVectindicatesthesourceofthedataforthisVI.Availableinputvectorsincludeimmediate(0xFF),variable(0x01through0x78),orindirectvariable(0x81through0xF8).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroora

Page 115: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheLoadVelocityVIspecifiesthemaximumtrajectoryvelocityforindividualaxesorvectorspaces.Whenexecutedonavectorspace,thevaluecontrolsthevectorvelocityalongthevectormovepath.Forvelocitycontrolapplications,thesignoftheloadedvelocityspecifiesthemovedirection.

Velocityisadouble-bufferedparametersoyoucanloaditontheflywithoutaffectingthemoveinprocess,andittakeseffectonthenextStartorBlendMotioncall.Afteritisloaded,thisparameterremainsineffectforallsubsequentmotionprofilesuntilre-loadedbythisVI.Youdonotneedtoloadvelocitybeforeeachmoveunlessyouwanttochangethevelocity.

NoteUseLoadMoveConstraintstoloadavelocityoflessthan1count/sec.NoteThevelocityloadedwiththisVIisthemaximummovevelocity.ActualvelocityattainableisdeterminedbymanyfactorsincludingPIDtuning,lengthofmove,accelerationanddecelerationvalues,andphysicalconstraintsoftheamplifier/motor/mechanicalsystem.NoteRefertoVIExecutionTimesforbenchmarktiminginformationaboutyourcontroller.

Page 116: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

Velocityvaluesincounts/sorsteps/sarealsoconvertedtotheinternal16.16fixed-pointformatinunitsofcountsorstepspersample(update)periodbeforebeingusedbythetrajectorygenerator.Althoughthemotioncontrollercancontrolvelocityto1/65,536ofacountorsteppersample,itisimpossibletoloadavaluethatsmallwiththeLoadVelocityVI,asshowninthefollowingformula:

Velocityincountsorstep/s=Vmin×( )

where:Vminis1/65,536counts/sampleorsteps/sample,andTsisthesampleperiodinsecondspersample.

Evenatthefastestupdaterate,

Ts=625×10-6

×16,000=0.244countsorsteps/s

Youcancalculatethemaximumvelocitywiththefollowingequation:

maximumvelocity=Vmax

where:Vmax=20MHzforservos,8MHzforsteppersona7350controller,4MHzforsteppersona7330/40/90controller,

Page 117: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadPositionReadsthepositionofanaxis.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Axisistheaxistoread.RetnVectindicatesthedestinationforthereturndatageneratedbythisVI.Availablereturnvectorsincludereturndatatothehost(0xFF),toavariable(0x01through0x78),toanindirectvariable(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.

Page 118: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheReadPositionVIreturnstheinstantaneouspositionofthespecifiedaxis.Forservoaxes,itreturnstheprimaryfeedbackpositionincounts.Foropen-loopstepperaxes,itreturnsthenumberofstepsgenerated.Forclosed-loopstepperaxes,itconvertstheprimaryfeedbackpositionfromcountstostepsandthenreturnsthevalueinsteps.Closed-loopstepperaxesrequireyoutocorrectlyloadvaluesofstepsperrevolutionandcountsperrevolutiontofunctioncorrectly.

NoteForclosed-loopaxes,thisVIalwaysreturnsthepositionoftheprimaryfeedbackresource.TipRefertotheReadVectorSpacePositionVIforaneasywaytoreaduptothreeaxispositionsforavectorspaceinonecall.NoteRefertoVIExecutionTimesforbenchmarktiminginformationaboutyourcontroller.

Page 119: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadperAxisStatusReadsthemotionstatusonaper-axisbasis.

DetailsRemarks

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Axisistheaxistoread.RetVectindicatesthedestinationforthereturndatageneratedbythisVI.Availablereturnvectorsincludereturndatatothehost(0xFF),returndatatoavariable(0x01through0x78),returndatatoanindirectvariable(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,

Page 120: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheReadPerAxisStatusVIreturnsthetrajectoryandmotionI/Ostatusforthespecifiedaxis.ItalsoreturnsthesuccessorfailurestatusofthemostrecentFindReferencesequence.

NoteThisVIreturnsundefinedvaluesforaxesthatarecurrentlyperformingfindreferencemoves.NoteYoualsocanreadindividualitemstatusinamulti-axisformatwithNI-MotionVIslikeReadLimitStatus,ReadTrajectoryStatus,andsoon.

Page 121: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

InthePerAxisH/WStatusbitmap,D7CommunicationWatchdog(WD)isnotsupportedby73xxcontrollers.

NISoftMotionControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

WhenyouareusingtheNISoftMotionControllerwithadevicethatsupportsmultiplehigh-speedcapturesandbreakpoints,thestatusforprimaryandsecondaryinputsisconcatenatedbyalogicalORoperationtopopulatePerAxisH/WStatus.InthePerAxisH/WStatusbitmap,WatchdogisusedforacommunicationstatuswatchdogontheNISoftMotionController.

Page 122: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadVectorSpacePositionReadsthepositionofallaxesinavectorspace.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.VectorSpaceisthevectorspacetoread.RetnVectindicatesthedestinationforthereturndatageneratedbythisVI.Availablereturnvectorsincludereturndatatothehost(0xFF),toavariable(0x01through0x78),toanindirectvariable(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,

Page 123: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheReadVectorSpacePositionVIreturnstheinstantaneouspositionsoftheaxesinthespecifiedvectorspace.Forservoaxes,itreturnstheprimaryfeedbackpositionincounts.Foropen-loopstepperaxes,itreturnsthenumberofstepsgenerated.Forclosed-loopstepperaxes,itconvertstheprimaryfeedbackpositionfromcountstostepsandthenreturnsthevalueinsteps.Closed-loopstepperaxesrequirecorrectlyloadedvaluesofstepsperrevolutionandcountsperrevolutiontofunctioncorrectly.

NoteForclosed-loopaxes,thisVIalwaysreturnsthepositionoftheprimaryfeedbackresource.NoteIfyouaredoingonboardprogrammingandareusingRetnVecttowritedata,thisVIwritesthevariablesstartingatthememoryaddresspointedtobyRetnVectinthefollowingorder:XPosition,YPosition,ZPosition.

Page 124: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadVelocityReadsthefilteredvelocityofanaxisorvectorspace.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisorVectorSpaceistheaxisorvectorspacetoread.RetnVectindicatesthedestinationforthereturndatageneratedbythisVI.Availablereturnvectorsincludereturndatatothehost(0xFF),toavariable(0x01through0x78),toanindirectvariable(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningof

Page 125: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

ThisVIreturnstheaxisorvectorspacefilteredvelocity.Toreducetheeffectsofnoiseandjitteronthefiltercalculation,thedatathisVIreturnsisaveragedbasedonparameterssetintheLoadVelocityFilterParameterVI.

Forvectorspaces,thisVIreturnsvectorvelocity,theroot-mean-squareofthefilteredvelocitiesoftheindividualaxesthatmakeupthevectorspace.

NoteYoualsocanreadvelocityinRPMbycallingtheReadVelocityinRPMVI.NoteRefertoVIExecutionTimesforbenchmarktiminginformationaboutyourcontroller.

Page 126: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadVelocityinRPMReadsthefilteredvelocityofanaxisorvectorspaceinRPM.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisorVectorSpaceistheaxisorvectorspacetoread.RetnVectindicatesthedestinationforthereturndatageneratedbythisVI.Availablereturnvectorsincludereturndatatothehost(0xFF),toavariable(0x01through0x78),toanindirectvariable(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,

Page 127: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

ThisVIreturnstheaxisorvectorspacefilteredvelocityinRPM.Thefilteredvelocityismeasuredbasedontimeelapsedbetweenpositionchanges.Toavoidquantizationerrorandjitterinthemechanicalsystem,afilteringalgorithminLoadVelocityFilterParameterisperformedwithparametersconfigured.

Forvectorspaces,thisVIreturnsvectorvelocity,theroot-mean-squareofthefilteredvelocitiesoftheindividualaxesthatmakeupthevectorspace.

NoteThisVIrequirespreviouslyloadedvaluesofeithercountsperrevolution(forservoaxes)orstepsperrevolution(forstepperaxes)tooperatecorrectly.NoteRefertoVIExecutionTimesforbenchmarktiminginformationaboutyourcontroller.

Page 128: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ResetPositionResetstheaxispositiontothespecifiedposition,takingfollowingerrorintoaccount.

NoteIfyouareusingthisVIwithanNI7350orNI7390devicethatyouarereadingpositionson,itmighttakeupto5msfortheapplicationtodisplaythemostrecentlyreadpositionafteryoucallthisVI.

DetailsRemarks

DeviceCompatibility

PrimaryResetPosition(0)istheresetvaluefortheaxisanditsassociatedprimaryfeedbackresource,takingfollowingerrorintoaccount.Youcanresetpositiontoanyvalueinthetotalpositionrangeof–(231)to+(231–1).Thevalueisinstepsforsteppersystemsandcountsforservosystems.SecondaryResetPosition(0)istheresetvaluefortheoptionalsecondaryfeedbackresource.Youcanresetpositiontoanyvalueinthetotalpositionrangeof–(231)to+(231–1).

NoteForstepperclosed-loopconfigurations,wheretheencodercountsperrevolutionisgreaterthanthestepsperrevolution,therangeofthepositionparametersisreducedbytheratioofcounts/revtosteps/rev.Forexample,iftheratiois4,000countsperrevolutionto2,000stepsperrevolution(2:1ratio),thentherangeofpositionparametersisdividedby2.

Page 129: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

Thisfunctionresetstheaxispositionandtheassociatedprimaryfeedbackposition,takingfollowingerrorintoaccount,andresetstheoptionalsecondaryfeedbackposition.Thismeansthatifyouresetthepositionto0andhaveafollowingerrorof15,thefeedbackpositionis–15.

Youcanresetpositiontozerooranyvalueinthe32-bitpositionrange.Youcanresetthesecondaryfeedbacktothesamevalueastheaxisandprimaryfeedbackoryoucanresetittoadifferentvalue.Ifasecondaryfeedbackresourceisnotinuse,thecorrespondingresetvalueisignored.Ifyouusethesamefeedbackdeviceforbothprimaryandsecondaryfeedback,youmustresetthepositionstobethesamevalue.

NoteNon-zeroresetvaluesareusefulfordefiningapositionreferenceoffset.

Positioncanberesetatanytime.However,itisrecommendedthatyouresetpositiononlywhiletheaxisisstopped.Anaxisresetwhiletheaxisismovingdoesnothavearepeatablereferenceposition.

NoteForaxesinp-commandmode,ensurethattheaxisisnotmovingbeforecallingResetPosition.CallingResetPositionwhentheaxisismovingintroducespositionerrorintothesystem.

Typically,youexecutetheResetPositionVIonetimeaftertheFindHomeandFindIndexsequencesoftheFindReferenceVIhavecompletedsuccessfullytosetthezeropositionforthesystemandnotagainuntilthenextpower-up.

AnADCchannelusedasaprimaryfeedbackresourcesisresetbystoringanoffsetvaluewhenthisVIisexecuted.Inthisway,itszeroreferenceisnotlostandyoucanstillreadtheactualADCvaluewiththeReadADCsVI.

NoteIfyouaredoingonboardprogrammingandareusingInpVecttogetthedatathisVIneeds,rememberthatthisVIreadsthevariablesstartingatthememoryaddresspointedtobyInpVectinthefollowingorder:Primary

Page 130: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NISoftMotionControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

Thesecondaryresetpositionisignored.Whenyouresetaslaveposition,gearingisnotdisabled.

NoteNationalInstrumentsrecommendsthatyoudonotresetthepositionwhenanaxisismovingorgearingisenabledbecausedoingsomightcausetheaxistojumpand/orcauseafollowingerror.

Page 131: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

SetOperationModeSetstheoperationmodeforanaxisorvectorspace.

DetailsRemarks

DeviceCompatibility

PositionMode(Absolute)selectsthetypeofpositionorvelocitymodeforanaxisorvectorspace.

Value Definition0 AbsolutePosition1 RelativePosition2 Velocity3 RelativetoCapture4 ModulusPosition5 AbsoluteContouring6 RelativeContouring

ThesemodesaredescribedintheUsingThisVIsection.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisorVectorSpaceistheaxisorvectorspacetoconfigure.errorin(noerror)describeserrorconditionsthatoccurbeforethisVI

Page 132: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheSetOperationModeVIisusedbothduringinitializationandduringnormalmotioncontroloperationtoconfigurethemodeofoperationforalltrajectorycommandstotheaxisorvectorspacespecified.

Positionmodesareappliedtoallaxesinacoordinate(vector)space.Ifyoulaterwanttooperateanaxisindependentlyinadifferentmodefromtheotheraxes,callSetOperationModeagainonthataxis.

NoteAllaxesinacoordinate(vector)spacemusthavethesameoperationmode.IftheoperationmodesaredifferentoneachAxiswhenaStartMotionorBlendMotionVIisexecuted,anerrorisgenerated.

Theoperationmodemustbesetorchangedbeforeanyothertrajectoryparametersareloadedforthenextmove.Theoperationmodeaffectshowthetargetpositionandvelocityvaluesareinterpreted.Trajectoryparametersloadedafteramodechangeareinterpretedinthenewlyselectedmode.Trajectoryparametersloadedanytimebeforeamodechangedonotreflectthenewmode.

NoteChangingoperationmodeafterthetrajectoryparametersareloadedcanresultinimproperoperation.

Thefiveoperationmodesaredescribedinthefollowingsections:

AbsolutePosition

Inabsolutepositionmode,targetpositionsareinterpretedwithrespecttoanorigin,reference,orzeroposition.Theoriginistypicallysetatahomeswitch,endoftravellimitswitch,orencoderindexposition.Anabsolutepositionmoveusesthepreprogrammedvaluesofacceleration,deceleration,s-curve,andvelocitytocompleteatrajectoryprofilewithanendingpositionequaltotheloadedabsolutetargetposition.

Thelengthofanabsolutemovedependsupontheloadedpositionandthecurrentpositionwhenthemoveisstarted.Ifthetargetpositionisthesameas

Page 133: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

NI7330andNI7390controllersdonotsupportabsoluteorrelativecontouring.NI73xxcontrollersdonotsupporttheVelocityoptionofthePositionModeparameterforvectorspaces.

NISoftMotionControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

TheNISoftMotionControllerdoesnotsupporttheModulusPositionoptionforPositionMode.

Page 134: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

WaitforBlendCompleteWaitsuptothespecifiedperiodoftimeforablendtobecompletedonanaxis,vectorspace,groupofaxes,orgroupofvectorspaces.

Details

DeviceCompatibility

PollInterval(20ms)istheamountoftime,inmilliseconds,towaitbetweensuccessivequeriestothecontrollertodetermineiftheblendiscomplete.Timeout(10,000ms)istheamountoftime,inmilliseconds,towaitfortheblendtobecomecomplete.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisorVectorSpacecanselectanaxis(1through15),vectorspace(0x11through0x14),multipleaxes(AxisControl),ormultiplevectorspaces(VectorSpaceControl).Whensimultaneouslyactingonmultipleaxesorvectorspaces,theAxis/VSMapparameterindicateswhichaxesorvectorspacesareinvolved.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassesthe

Page 135: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

ThisutilityVIisbuiltontopoftheCheckBlendCompleteStatusVI,andisprovidedforyourprogrammingconvenience.ThisVIcomparestheaxesorvectorspacesspecifiedintheAxisorVectorSpaceandAxis/VSMapinputparameterswiththeblendcompletestatusfortheappropriateaxesorvectorspaces.Itdoesthisrepeatedly,withthePollIntervaltimedeterminingthefrequencythatthecontrollerisqueried.Whentheblendiscomplete,thisVIreturnswithBlendCompletesettoTrue,otherwiseitwaitsfortheamountoftimespecifiedbytheTimeoutparameter.IftheVIwaitslongerthanthespecifiedtimeout,itreturnsNIMC_eventTimeoutErrorandBlendCompleteissettofalse.

Theoutputisasingletrue/falsevalueindicatingwhetherornotthespecifiedblendorblendsarecomplete.

ThisVIdoesnotcheckforfollowingerrorstatusoraxisoffstatus.Checkingforfaultsduringmovesisrecommended.Todothis,useReadperAxisStatus,whichreturnsfollowingerrorandaxisoffstatusinadditiontothemovecompletestatus.RefertotheNI-MotionHelpformoreinformationandexamplecode.

Formoreinformationaboutblendcompletestatus,refertotheReadBlendStatusVI.

NotetoLabVIEWRTusersIfthisVIisusedwithLabVIEWRTinatime-criticalprioritythread,theentirethreadisputtosleepuntilthenextmultipleofPollInterval.FormoreinformationrefertotheLabVIEWRTdocumentation

Page 136: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

WaitforMoveCompleteWaitsuptothespecifiedperiodoftimeforamovetobecompletedonanaxis,vectorspace,groupofaxes,orgroupofvectorspaces.

Details

DeviceCompatibility

PollInterval(20ms)istheamountoftime,inmilliseconds,towaitbetweensuccessivequeriestothecontrollertodetermineiftheblendiscomplete.Timeout(10,000ms)istheamountoftime,inmilliseconds,towaitfortheblendtobecomecomplete.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisorVectorSpacecanselectanaxis(1through15),vectorspace(0x11through0x14),multipleaxes(AxisControl),ormultiplevectorspaces(VectorSpaceControl).Whensimultaneouslyactingonmultipleaxesorvectorspaces,theAxis/VSMapparameterindicateswhichaxesorvectorspacesareinvolved.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassesthe

Page 137: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

ThisutilityVIisbuiltontopoftheCheckMoveCompleteStatusVI,andisprovidedforyourprogrammingconvenience.ThisVIcomparestheaxesorvectorspacesspecifiedintheAxisorVectorSpaceandAxis/VSMapinputparameterswiththemovecompletestatusfortheappropriateaxesorvectorspaces.Itdoesthisrepeatedly,withthePollIntervaltimedeterminingthefrequencythatthecontrollerisqueried.Whenthemoveiscomplete,thisVIreturnswithMoveCompletesettoTrue,otherwiseitwaitsfortheamountoftimespecifiedbytheTimeoutparameter.IftheVIwaitslongerthanthespecifiedtimeout,itreturnsNIMC_eventTimeoutErrorandMoveCompleteissettofalse.

Theoutputisasingletrue/falsevalueindicatingwhetherornotthespecifiedmoveormovesarecomplete.

ThisVIdoesnotcheckforfollowingerrorstatusoraxisoffstatus.Checkingforfaultsduringmovesisrecommended.Todothis,useReadperAxisStatus,whichreturnsfollowingerrorandaxisoffstatusinadditiontothemovecompletestatus.RefertotheNI-MotionHelpformoreinformationandexamplecode.

Formoreinformationaboutmovecompletestatus,refertotheReadTrajectoryStatusandConfigureMoveCompleteCriteriaVIs.

NotetoLabVIEWRTusersIfthisVIisusedwithLabVIEWRTinatime-criticalprioritythread,theentirethreadisputtosleepuntilthenextmultipleofPollInterval.FormoreinformationrefertotheLabVIEWRTdocumentation

Page 138: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

AdvancedTrajectoryVIsAdvancedTrajectoryVIsareusefulinspecialapplicationsandshowcasesomeofNI-Motion'spowerandflexibility.

YoucanuseAdvancedTrajectoryVIstoacquiretime-sampledpositionandvelocitydataintoalargeonboardbufferandthenlaterreaditoutforanalysisanddisplay.TheseVIsimplementadigitaloscilloscopethatisusefulduringsystemsetup,PIDtuning,andgeneralmotionwithdataacquisitionsynchronization.

ClicktheiconsforVIdescriptions.

LoadVelocityinRPM LoadPositionModulusLoadAccel/DecelinRPS/sec LoadS-CurveTimeLoadFollowingError LoadVelocityOverrideReadFollowingError LoadBaseVelocityAcquireTrajectoryData LoadVelocityThresholdReadTrajectoryData LoadVelocityThresholdinRPMReadBlendStatus LoadRun/StopThresholdReadMoveCompleteStatus ReadDACReadTrajectoryStatus ReadDACLimitStatus

Page 139: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadBlendFactor LoadTorqueOffsetReadTargetPosition LoadTorqueLimitReadStepsGenerated

Page 140: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

AcquireTrajectoryDataAcquirestime-sampledpositionandvelocitydataonmultipleaxes.

DeviceCompatibility

Timeperiod(3ms)isthetimeperiodbetweensamplesinms.Therangeisfrom3(default)to65,535ms.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.Typically,sourceisthenameoftheVIinwhichtheerroroccurred.

Page 141: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheAcquireTrajectoryDataVIinitiatestheautomaticacquisitionofpositionandvelocitydatafortheselectedaxes.Thedataisheldinanonboardfirst-in-first-out(FIFO)bufferuntillaterreadbackwiththeReadTrajectoryDataVI.Youcanselectwhichaxestoacquiredataforandprogramthetimeperiodbetweensamples.

TheAcquireandReadTrajectoryDataVIsareusedtoacquireandreadbacktime-sampledpositionandvelocitydataforanalysisanddisplay.TheseVIsimplementadigitaloscilloscopethatisusefulduringsystemsetup,PIDtuning,andgeneralmotionwithdataacquisitionsynchronization.

Afteritisstarted,thisdataacquisitionoperatesautonomouslyinthebackgroundasaseparatetask.MotioncontroloperatesnormallyandyoucanexecuteothermotionVIssimultaneously.Dependingupontheprogrammedtimeperiodandthetotalnumberofsamples,thisacquisitiontaskcanrunanywherefromafewmillisecondstotensofhours.

CautionWaitanappropriateamountoftimebeforeattemptingtoreadbackthetrajectorydata.

Becausehostcommunication,eventhandling,arcpointgeneration,contourpointdispensing,bufferedbreakpoints,andbufferedhigh-speedcaptureareahigherpriorityonthecontrollerthanacquiringtrajectorydata,youmaynoticeirregulartimespacingofsampleddatawhenhostcommunicationsoreventnotificationisheavy.Tominimizethechanceofirregulardata,limithostcommunicationtoaminimumwhileacquiringtrajectorydata.Ifyoustillnoticeirregulardata,increasethetimeperiod.

Example

Toacquire100samplesofdataonaxes1and2at10ms/sample,calltheAcquireTrajectoryDataVIwiththefollowingparameters:

AxisMapcorrespondstothefollowing

Page 142: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadAccel/DecelinRPS/secLoadsthemaximumaccelerationand/ordecelerationvalueforanaxisorvectorspaceinRPS/s.

DetailsRemarks

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.InpVectindicatesthesourceofthedataforthisVI.Availableinputvectorsincludeimmediate(0xFF),variable(0x01through0x78),orindirectvariable(0x81through0xF8).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroora

Page 143: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheLoadAccel/DecelinRPS/secVIspecifiesthemaximumrateofaccelerationand/ordecelerationforindividualaxesorvectorspacesinrevolutions/s2.Whenexecutedonavectorspace,thevaluecontrolsthevectoracceleration(deceleration)alongthevectormovepath.ThisVIrequirespreviouslyloadedvaluesofeithercountsperrevolution(forstepperaxes)orstepsperrevolution(forservoaxes)tooperatecorrectly.

YoucanusethisVItoloadseparatelimitsforaccelerationanddecelerationortosetthembothtothesamevaluewithonecall.Theseparametersaredouble-bufferedsoyoucanloadthemontheflywithoutaffectingthemoveinprocess,andtheytakeeffectonthenextStartorBlendMotioncall.Aftertheyareloaded,theseparametersremainineffectforallsubsequentmotionprofilesuntilre-loadedbythisVI.Youdonotneedtoloadaccelerationbeforeeachmoveunlessyouwanttochangetheaccelerationand/ordecelerationvalue.

Accelerationdefineshowquicklytheaxisoraxescomeuptospeedandistypicallylimitedtoavoidexcessivestressonthemotor,mechanicalsystem,and/orload.Aseparate,slowerdecelerationisusefulinapplicationswheregentlycomingtoastopismostimportant.

TipUseLoadMoveConstraintsinsteadofthisVIformoremoveoptions.

Page 144: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

RPS/svaluesstoredinonboardvariablesareindouble-precisionIEEEformat(f64).ForinformationaboutthenumberofvariablesrequiredtoholdanRPS/svalue,refertoUsingInputsandReturnVectorswithOnboardVariables.NI-Motionfirmwareusesa16.16fixed-pointformatinternallytorepresentvelocityincounts/sampleperiodorsteps/sampleperiodandacceleration/decelerationincounts/sampleperiod2orsteps/sampleperiod2.IfyouchangecountsorstepsperrevolutionorchangetheupdaterateusingEnableAxes,youmustreloadthevelocityandacceleration/deceleration.Youalsocanloadaccelerationanddecelerationincounts/s2orsteps/s2bycallingtheLoadAcceleration/DecelerationVI.IfyouaredoingonboardprogrammingandareusinginputVectortogetthedatathisVIneeds,noticethatthisVIreadsthevariablesstartingatthememoryaddresspointedtobyinputVectorinthefollowingorder:accelerationType,RPSPS.AccelerationanddecelerationvaluesinRPS/sareconvertedtoaninternal16.16fixed-pointformatinunitsofcounts/sample2orsteps/sample2beforebeingusedbythetrajectorygenerator.YoucancalculatetheminimumaccelerationincrementinRPS/swiththefollowingformula:

RPS/s=Amin×( )2×

where:Aminis1/65,536counts/sample2orsteps/sample2,

Page 145: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadBaseVelocitySetsthebasevelocityusedbythetrajectorycontrolloopfortheaxisspecified.

Details

DeviceCompatibility

BaseVelocityisthebasevelocityforthestepperaxisinsteps/secondandisa16-bitdatawordintherangeof0through65,535.Thedefaultvalueis0.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Axisistheaxistocontrol.InpVectindicatesthesourceofthedataforthisVI.Availableinputvectorsincludeimmediate(0xFF),variable(0x01through0x78),orindirectvariable(0x81through0xF8).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,or

Page 146: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

Basevelocityistheminimumsteprateusedbythetrajectorygeneratorduringaccelerationanddeceleration.Basevelocityisusefulwhenthesystemusesfull-steporhalf-stepmode.Basevelocityisnotnecessaryifthesystemusesmicrostepping.

IfthetargetvelocityloadedwiththeLoadVelocityVIislowerthanthebasevelocity,thebasevelocityisreducedtoequaltheloadedtargetvelocity.

NoteThisVIisvalidonlyonaxesconfiguredassteppers,soyoumustconfigureanaxisasastepperusingtheConfigureAxisResourcesVIbeforeexecutingthisVI.

Example

Ifthebasevelocityloadedis2,000steps/sandtheloadedvelocityis5000,theaxisstartsatthebasevelocityandacceleratestotheloadedvelocity.Theaxisthendeceleratestothebasevelocityandstops,asshowninthefollowingfigure.

Page 147: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadBlendFactorLoadstheblendfactorforanaxisorvectorspace.

Details

DeviceCompatibility

BlendFactoristheblendfactormodeand/ordwelltime.–1specifiesnormalblending(default),0specifiesastartafterthepreviousmoveisfullystopped,andvalues>0specifyadditionaldwelltimeinmilliseconds.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisorVectorSpaceistheaxisorvectorspacetocontrol.InpVectindicatesthesourceofthedataforthisVI.Availableinputvectorsincludeimmediate(0xFF),variable(0x01through0x78),orindirectvariable(0x81through0xF8).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.

Page 148: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheLoadBlendFactorVIcontrolshowtheBlendMotionVIoperates.Blendingautomaticallystartsapendingmoveonanaxisorvectorspacewhenthemoveinprocesscompletes.Exactlywhenthependingmovestartsisdeterminedbytheloadedblendfactor.

Ablendfactorof–1causesthependingmovetostartwhentheexistingmovefinishesitsconstantvelocitysegmentandstartstodecelerate,asshowninthefollowingfigure.Thisblendsthetwomovestogetherattheoptimumblendpoint.

Ifthetwomovesareatthesamevelocity,inthesamedirection,andhavematchingaccelerationanddeceleration,theysuperimposeperfectlywithoutadiporincreaseinaxisvelocity.Vectorvelocitydipsbasedontheamountofdeflectionfromastraightline.

Foravectormove,ifalloftheaxescontinueinthesamedirection,thevectorvelocityremainsconstant.But,ifoneoftheaxeschangesdirection,thevectorvelocitydoesnotremainconstantduringthetransitionphase.

Ablendfactorofzero(0)causesthependingmovetostartwhentheexistingmovefullycompletesitsprofile.

Positiveblendfactorsallowforadwellattheendofthefirstmovebeforetheautomaticstartofthependingmove.Theblendfactordwellisprogrammedinmilliseconds.

ThemaximumvalueofthepositiveblendfactordependsupontheSamplePIDRatethatyousetintheEnableAxesVI,becausetheDSPdelaysthetrajectorygeneratorsbasedonPIDsampleperiods.Theformulausedtodeterminethemaximumpositiveblendfactorisasfollows:

Page 149: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadFollowingErrorLoadsthefollowingerrortrippoint.

DetailsRemarks

DeviceCompatibility

FollowingErroristhefollowingerrortrippointincounts.Ifthefollowingerrorexceedsthisvalue,theaxisisautomaticallykilled.Therangeis0to32,767withadefaultof32,767counts.Loadingzero(0)isaspecialcasethatdisablesthefollowingerrortripfunctionality.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Axisistheaxistocontrol.InpVectindicatesthesourceofthedataforthisVI.Availableinputvectorsincludeimmediate(0xFF),variable(0x01through0x78),orindirectvariable(0x81through0xF8).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.If

Page 150: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheLoadFollowingErrorVIsetsthemaximumallowablefollowingerror.Followingerroristhedifferencebetweentheinstantaneouscommandedtrajectorypositionandthefeedbackposition.Iftheabsolutevalueofthisdifferenceexceedsthetrippoint,aninternalkillstopisissuedandtheaxisisdisabled.

Ifthisaxisispartofacoordinate(vector)space,allotheraxesarecommandedtodeceleratetoastopwhenoneaxistripsonfollowingerror.

ThisVIisasafetyfeatureusedtoprotectthemotionhardwareandassociatedsystemcomponentsfromdamagewhenthepositionerrorgetsexcessiveduetofriction,binding,oracompletelystalledmotor.Italsoprotectsthesystemincaseyouloadunobtainablevaluesforvelocityand/oracceleration.

Thisfeatureisavailableonallservoandclosed-loopstepperaxes.Ithasnoeffectonstepperaxesrunninginopen-loopmode.Youcancompletelydisablethefollowingerrorfeaturebyloadingazero(0)value.

CautionFollowingerrormustnotbedisabledunlesstheapplicationabsolutelyrequiresoperatingwithgreaterthan32,767countsoferror.

YoucanmonitorfollowingerrorstatuswiththeReadTrajectoryStatusorReadperAxisStatusVIs.AfollowingerrortripalwayssetstheMotorOffstatus.Inservosystems,youcanfurtherdiagnosethecauseofthetripbycheckingthetorquelimitstatuswiththeReadDACLimitStatusVI.

Ifanaxistripsonfollowingerror,thataxis,oranyaxesassociatedthroughacoordinatespace,areprohibitedfromstartingfromanonboardprogramuntilastartfromthehost,pauseoftheonboardprogram,orrunofanonboardprogram.

Ingeneral,afollowingerrortripisconsiderednormaloperationanddoesnotgenerateanerror.Thereareafewcaseswhereanunexpectedfollowingerrortripgeneratesamodalerror:duringFindReference,andwhileexecutinga

Page 151: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NISoftMotionControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

TheNISoftMotionControllerdoesnotsupportloadingzero(0)inFollowingErrortodisablethefollowingerror.FortheInpVectparameter,theNISoftMotionControllersupportsonlytheimmediatereturnvector(0XFF).

Page 152: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadMoveConstraintsLoadsmoveconstraintsinuserunits.

DetailsRemarks

DeviceCompatibility

DataisaclusterofvariablesthatcontainsthevaluesfortheselectedAttribute.

Integeris32-bitintegerdata.Doubleis64-bitfloatingpointdata.BooleanisBooleandata.

Attributeistheattributeyouwanttoload:

VelocityConstraint—SettheDoubleelementoftheDataclustertotheappropriatevelocitylimitinuserunits/second.AccelerationConstraint—SettheDoubleelementoftheDataclustertotheappropriateaccelerationlimitinuserunits/second2.DecelerationConstraint—SettheDoubleelementoftheDataclustertotheappropriatedecelerationlimitinuserunits/second2.AccelerationJerk—SettheDoubleelementoftheDataclustertotheappropriateaccelerationjerklimitinuserunits/second3.DecelerationJerk—SettheDoubleelementoftheDataclustertotheappropriatedecelerationjerklimitinuserunits/second3.

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorerusedtosendandreceivecommandsanddatatoorfroma

Page 153: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

ThisVIloadsmoveconstraintsinuserunitsusingtheDoubleparameteroftheDatacluster.UseLoadCounts/StepsperRevolutiontosettheuserunitratio.

Example1

Ifyouload2,000counts/revusingtheLoadCounts/StepsperRevolutionVI,andyoucallLoadMoveConstraintswithVelocityConstraintsetto10.5,thevelocityloadedis10.5revolutions/secondor21,000counts/second.

Example2

IfyousetCounts(Steps)/Revto1intheLoadCounts/StepsperRevolutionVI,andyoucallLoadMoveConstraintswithVelocityConstraintsetto1.3,thevelocityloadedis1.3counts/second.

Page 154: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

73xxcontrollersdonotsupporttheAccelerationJerkandDecelerationJerkattributes.UseLoadVelocityandLoadAcceleration/Decelerationforfasterperformance.

Page 155: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadPositionModulusLoadsthepositionmodulusforanaxis.

Details

DeviceCompatibility

PositionModulus(0)isthepositionmodulusvalueincounts(servoaxes)orsteps(stepperaxes).Themodulusrangeisfrom0(default)to(231)–1.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Axisistheaxistocontrol.InpVectindicatesthesourceofthedataforthisVI.Availableinputvectorsincludeimmediate(0xFF),variable(0x01through0x78),orindirectvariable(0x81through0xF8).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,

Page 156: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheLoadPositionModulusVIsetsthemodulususedwhentheaxisisoperatinginModulusPositionmode.Ithasnoeffectwhentheaxisisoperatinginothermodes.Whenatargetpositionisloaded,itisinterpretedwithintheboundariesofamodulusrange.

RefertotheSetOperationModeVIforacompletedescriptionoftheModulusPositionmode.

Page 157: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadRun/StopThresholdSetsthevelocityRun/StopThreshold,whichaffectstherun/stopstatusreturnedbyReadTrajectoryStatus.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Run/StopThresholdistheRun/Stopthresholdvelocityincounts/sampleperiodforservoaxesorsteps/sampleperiodforopen-loopandclosed-loopstepperaxes.Therangeforthisparameteris1(default)to32,767countsorsteps/sampleperiod.Thisparametersetsthenumberofcounts/stepsanaxismustmovetobeconsideredrunning.Axisistheaxistoconfigure.InpVectindicatesthesourceofthedataforthisVI.Availableinputvectorsincludeimmediate(0xFF),variable(0x01through0x78),orindirectvariable(0x81through0xF8).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowing

Page 158: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

ThisVIsetsthevelocitythresholdabovewhichanaxisisconsideredrunning.TheRun/StopThresholdparameterhastimeunitsofupdatesampleperiodsandisaffectedbytheupdateratesetintheEnableAxesVI.

Ifthevelocityofanaxisisabovethestep/countpersampleperiodspecifiedinthisVI,therun/stopstatusfromReadTrajectoryStatusreturnsTRUE.Ifitisbelowthethreshold,therun/stopstatusreturnsFALSE.

Page 159: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadS-CurveTimeLoadsthes-curvetimeforanaxisorvectorspace.

DetailsRemarks

DeviceCompatibility

SCurveTime(1)isthetimeinupdatesampleperiodsoverwhichtheaccelerationprofileissmoothedasittransitionsfromzerototheprogrammedvalueandbacktozero.Thes-curverangeisfrom1to32,767withadefaultof1sampleperiod.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisorVectorSpaceistheaxisorvectorspacetocontrol.InpVectindicatesthesourceofthedataforthisVI.Availableinputvectorsincludeimmediate(0xFF),variable(0x01through0x78),orindirectvariable(0x81through0xF8).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,or

Page 160: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheLoadS-CurveTimeVIsmoothestheaccelerationanddecelerationportionsofamotionprofile,resultinginlessabrupttransitionsfromstartmotiontoacceleration,accelerationtoconstantvelocity,constantvelocitytodeceleration,anddecelerationtostop.Usings-curveaccelerationlimitsthejerkinamotioncontrolsystem.

Officially,jerkisdefinedasthederivativeofacceleration(changeofaccelerationperunittime)andismeasuredinunitsofcounts(steps)/s3.ThisVI,however,allowsyoutoloads-curvetimeinupdatesampleperiodsratherthanhavetodealwiththeobscureunitsofjerk.

Withthedefaults-curvetimeofone(1)sampleperiod,thereisalmostnoeffectonthemotionprofile,andthestandardtrapezoidaltrajectoryisexecuted.Ass-curvetimeincreases,thesmoothingeffectontheaccelerationanddecelerationportionsofthemotionprofileincrease,asshowninthefollowingfigure.Largevaluesofs-curvetimecanoverridetheprogrammedvaluesofaccelerationanddecelerationbysufficientlysmoothingtheprofilesuchthattheaccelerationanddecelerationslopesareneverreached.

NoteAlarges-curvevaluemakesthetimetoacceleratetothecommandedvelocitylonger.Therefore,thetimeittakestoreachthetargetpositionisalsolonger.Ifthes-curvevalueistoolarge,thevalueisignoredandfullaccelerationisused.Thishappenswhentheaccelerationanddecelerationbecometoolongtoperformsmoothly.

Youcanloads-curvetimetoindividualaxesortoavectorspaceforsmoothingallaxesinthevectorspace.Whensenttoavectorspace,thes-curvetimeisbroadcasttoallaxesinthevectorspacetochangetheper-axiss-curvetimes.Ifyoulaterwanttooperateanaxisindependentlywithadifferents-curvetime,youmustexecutetheLoadS-CurveTimeVIagainforthataxis.

NoteAllaxesinavectorspacemusthavethesames-curvetimeforbest

Page 161: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NISoftMotionControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

WhenyouusethisVIwiththeNISoftMotionController,SCurveTime(1)isthesmoothingtimeinthehostloopperiod.NationalInstrumentssuggestsyouusetheLoadMoveConstraintsVIwiththeNISoftMotionControllerinsteadofusingthisVI.

Page 162: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadTorqueLimitLoadsprimaryandsecondaryDACtorquelimitsforanaxis.

Details

DeviceCompatibility

Secondary(–)LimitistheoptionalsecondaryDACnegativetorque(orvelocity)limit.Therangeis–32,768to+32,767(–10Vto+10V)withadefaultvalueof–32,768(–10V).

NoteThepositivelimitcannotbelessthanthenegativelimit.Secondary(+)LimitistheoptionalsecondaryDACpositivetorque(orvelocity)limit.Therangeis–32,768to+32,767(–10Vto+10V)withadefaultvalueof32,767(+10V).BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Axisistheaxistocontrol.InpVectcontainstheprimarypositive,primarynegative,secondarypositive,andsecondarynegativeparametersthatarethesourceofdataforthisVI.

Availableinputvectorsincludeimmediate(0xFF),variable(0x01through0x78),orindirectvariable(0x81through0xF8).RefertoInputandReturn

Page 163: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheLoadTorqueLimitVIallowsyoutolimittheoutputrangeoftheDACoutput(s)ontheselectedservoaxis.ThisVIhasnoeffectonstepperaxesorindependentDACoutputsthatarenotmappedtoanaxis.

BylimitingtheoutputrangeofaDAC,itispossibletocontrolthemaximumtorque(whenconnectedtoatorqueblockservoamplifier)orvelocity(whenconnectedtoavelocityblockservoamplifier).ThisVIisalsohelpfulwheninterfacingtoamplifiersthatdonotsupportthestandard±10Vcommandrange.

PrimaryandsecondaryDACscanhavedifferentlimits,andthepositiveandnegativelimitscanbebothpositiveorbothnegativetolimittheDACoutputtoaunipolarrange.TheonlyrestrictionisthatapositiveDAClimitcannotbelessthanthenegativeDAClimit.

YoualsocansetatorqueoffsetontheprimaryandsecondaryDACoutputs.RefertotheLoadTorqueOffsetVIformoreinformation.

Example

CallingtheLoadTorqueLimitVIwiththefollowingparameterslimitstheoutputrangesoftheprimaryandsecondaryDACsmappedtotheaxis,asshowninthefollowingfigure:

PrimaryPositiveLimit=16,383PrimaryNegativeLimit=–16,384SecondaryPositiveLimit=8,191SecondaryNegativeLimit=–32,768

TheresultofthisVIcallistolimittheprimaryDACtoonlyhalfitsrangeineitherdirection,or±5V.ThesecondaryDACcanonlytraveloveraquarterofitspositiverangebuthasitsfullnegativerange.

Page 164: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadTorqueOffsetLoadsprimaryandsecondaryDACtorqueoffsetsforanaxis.

Details

DeviceCompatibility

SecondaryOffset(0)isthesecondaryDACtorque(orvelocity)offset.Theoffsetrangeis–32,768to+32,767(–10Vto+10V)withadefaultvalueof0(0V).

NoteTheoffsetvaluemustbewithintherangelimitssetbytheLoadTorqueLimitVI.

PrimaryOffset(0)istheprimaryDACtorque(orvelocity)offset.Theoffsetrangeis–32,768to+32,767(–10Vto+10V)withadefaultvalueof0(0V).BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Axisistheaxistocontrol.InpVectcontainstheprimaryandsecondaryparametersthatarethesourceofdataforthisVI.

Availableinputvectorsincludeimmediate(0xFF),variable(0x01through0x78),orindirectvariable(0x81through0xF8).RefertoInputandReturnVectorsformoredetailedinformation.

Page 165: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheLoadTorqueOffsetVIloadsoffsetvaluesfortheDACsmappedtotheselectedservoaxis.ThisVIhasnoeffectonstepperaxesorindependentDACoutputsthatarenotmappedtoanaxis.WhenaDACisconnectedtoavelocityblockservoamplifier,thetorqueoffsetfunctionsasavelocityoffset.

Atorque(orvelocity)offsetshiftstheDACoutput(s)bytheprogrammedoffsetvaluewithoutrequiringanyactionfromthePIDloop.Inaservosystem,thiscanbeusedtoovercomeamplifierinputoffsets,systemimbalances,ortheeffectsofoutsideforcessuchasgravity.DifferenttorqueoffsetscanbeloadedfortheprimaryandsecondaryDAC.

NoteWhenanAxisiskilled,itsDACoutputsarezeroedregardlessofthetorqueoffsetloaded.

DACoffsetscanbeusedinconjunctionwithDACrangelimitstointerfacetoservoamplifierswithunipolarinputranges(forexample,0to5Vor0to10V).

Example

CallingtheLoadTorqueOffsetVIwithPrimaryOffset=4,096andSecondaryOffset=0shiftstheoutputrangesoftheprimaryDACmappedtotheaxisasshowninthefollowingfigure:

TheresultofthisVIcallistolimittheprimaryDACtoarangeof–8.75Vto+10Vwithanoffsetornullvalueof+1.25V.ThisisbecauseevenwhenthePIDloopiscommandingfullnegativetorque,thetorqueoffsetisaddedandtheresultingoutputis–8.75V.Inthepositivedirection,theDACcannotgoabove+10Vnomatterwhattheoffsetis.

TheVIcallleavesthesecondaryDACoffsetatitsdefaultvalueofzero(0).ThisexampleassumesthefulltorquerangeisavailableandnotlimitedbytheLoadTorqueLimitVI.

Page 166: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadVelocityinRPMLoadsvelocityforanaxisorvectorspaceinRPM.

DetailsRemarks

DeviceCompatibility

Velocity(500)isthedoubleprecisionfloatingpointvelocityvalueinRPM.TheVelocityrangedependsuponthemotorcountsorstepsperrevolutionandthetrajectoryupdaterate.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisorVectorSpaceistheaxisorvectorspacetocontrol.InpVectindicatesthesourceofthedataforthisVI.Availableinputvectorsincludeimmediate(0xFF),variable(0x01through0x78),orindirectvariable(0x81through0xF8).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.If

Page 167: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheLoadVelocityinRPMVIspecifiesthemaximumtrajectoryvelocityforindividualaxesorvectorspaces.Whenexecutedonavectorspace,thevaluecontrolsthevectorvelocityalongthevectormovepath.Forvelocitycontrolapplications,thesignoftheloadedvelocityspecifiesthemovedirection.ThisVIrequirespreviouslyloadedvaluesofeithercountsperrevolution(forservoaxes)orstepsperrevolution(forstepperaxes)tooperatecorrectly.

RPMisdouble-buffered,soyoucanloaditontheflywithoutaffectingthemoveinprocess,andittakeseffectonthenextStartorBlendMotioncall.Afteritisloaded,thisparameterremainsineffectforallsubsequentmotionprofilesuntilre-loadedbythisVI.Youdonotneedtoloadvelocitybeforeeachmoveunlessyouwanttochangethevelocity.

NoteThevelocityloadedwiththisVIisthemaximummovevelocity.ActualvelocityattainableisdeterminedbymanyfactorsincludingPIDtuning,lengthofmove,accelerationanddecelerationvalues,andphysicalconstraintsoftheamplifier/motor/mechanicalsystem.

Youalsocanloadvelocityincounts/sorsteps/sbycallingtheLoadVelocityVI.TipUseLoadMoveConstraintsinsteadofthisVIformoremoveoptions.NoteRefertoVIExecutionTimesforbenchmarktiminginformationaboutyourcontroller.

Page 168: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

For73xxmotioncontrollers,RPMvaluesstoredinonboardvariablesareindouble-precisionIEEEformat(f64).ForinformationaboutthenumberofvariablesrequiredtoholdanRPMvalue,refertoUsingInputsandReturnVectorswithOnboardVariables.

NoteNI-Motionfirmwareusesa16.16fixed-pointformatinternallytorepresentvelocityincounts/sampleperiodorsteps/sampleperiodandacceleration/decelerationincounts/sampleperiod2orsteps/sampleperiod2.IfyouchangecountsorstepsperrevolutionorchangetheupdaterateusingEnableAxes,youmustreloadthevelocityandacceleration/deceleration.

VelocityvaluesinRPMareconvertedtoaninternal16.16fixed-pointformatinunitsofcounts(steps)persampleperiod(updateperiod)beforebeingusedbythetrajectorygenerator.NI-Motioncancontrolvelocityto1/65,536ofacountorsteppersample.YoucancalculatethisminimumvelocityincrementinRPMwiththefollowingformula:

minimumRPM=Vmin×( )×60×( )

where:Vminis1/65,536count/sampleorstep/sample,Tsisthesampleperiodinsecondspersample,60isthenumberofsecondsinaminute,andRisthecounts/stepsperrevolution.

Foratypicalservoaxiswith2,000countsperrevolutionoperatingatthe250µsupdaterate,theminimumRPMincrementis:

Page 169: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadVelocityOverrideLoadsaninstantaneousvelocityoverrideforanaxisorvectorspace.

DetailsRemarks

DeviceCompatibility

OverridePercentage(100%)isasingleprecisionfloatingpointvaluefrom0to150%.Thisvaluedirectlyscalestheprogrammedvelocity.Thedefaultvalueis100%(noeffect).BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisorVectorSpaceistheaxisorvectorspacetocontrol.InpVectindicatesthesourceofthedataforthisVI.Availableinputvectorsincludeimmediate(0xFF),variable(0x01through0x78),orindirectvariable(0x81through0xF8).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.If

Page 170: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheLoadVelocityOverrideVIscalestheoperatingvelocityonanaxisorvectorspacefrom0to150%.Velocityoverrideisnotdouble-buffered.TheVItakeseffectimmediatelyanddoesnotrequireaStartorBlendMotionVIexecutiontochangetheoperatingvelocity.Allvelocitychangesusetheloadedvaluesofacceleration,deceleration,ands-curvetosmoothlytransitionthevelocitytoitsnewvalue.

Velocityoverridescalesvelocityinlinearinterpolationaswellasincircular,helical,andsphericalarcs.

NoteVelocityoverrideisnotvalidforcontouredmoves.

Youcanloadvelocityoverridetoindividualaxesortoavectorspaceforcoordinatedvelocityscaling.Whensenttoavectorspace,thevelocityoverrideisbroadcasttoallaxesinthevectorspacetochangetheper-axisoverrides.Ifyoulaterwanttooperateanaxisindependentlywithadifferentvelocityoverride,youmustexecutetheLoadVelocityOverrideVIagainforthataxis.Notethatthisalsoworkswithgearing.Inadditiontofollowingthepositionofthemasteraxis,theslavefollowsthevelocityofthemasteraxis.

Afteritisloaded,velocityoverrideremainsineffectuntilchangedbyanothercalltothisVI.Allsubsequentmovesareatvelocitiesscaledbythemostrecentoverridepercentage.Atpower-upreset,velocityoverrideisalwaysresetto100%.

Velocityoverrideiscommonlyusedinmachinetoolandotherapplicationstoreducethespeedofaprogrammedmotionsequenceandcanbeusedtoimplementafeedholdbysettingthevaluetozero(0).Youcandirectlyuseascaledvaluefromananaloginputasthevelocityoverridevalue.

Page 171: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

For73xxcontrollers,theresolutionofthisVIisapproximately0.4%.Theconversionfromfloating-pointtofixed-pointisperformedonthehostcomputer,notonthemotioncontroller.Toloadvelocityoverridefromanonboardvariable,youmustusetheintegerrepresentationof0to384.Allaxesinavectorspacemusthavethesamevelocityoverride.Ifaxeshavedifferentvelocityoverrides,thevectormovecannotfunctionasexpected.Thismodeislegalanddoesnotgenerateanerror,butitcausestheaxestofinishtheirmovesatdifferenttimes.

NISoftMotionControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

Ifvelocityoverrideisloadedonanaxis,itisappliedonlyduringsingle-axismoves.Ifthevelocityoverrideisloadedonavectorspace,itdoesnotoverwritethevaluesfortheaxesthatareinthevectorspace.Inthiscase,thevelocityoverrideisappliedonlyduringvectorspacemoves.TherangefortheOverridePercentageisthefull64-bitrange,andisnotlimitedto150%fortheNISoftMotionController.

Page 172: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadVelocityThresholdLoadsavelocitythresholdforanaxis.

DetailsRemarks

DeviceCompatibility

VelocityThreshold(100,000)isthevelocitythresholdincounts/s(servoaxes)orsteps/s(stepperaxes).Forservoaxes,thethresholdrangeis1to16,000,000counts/s.Forstepperaxes,itis1to1,500,000steps/s.Thefactorydefaultvalueforthresholdisthemaximum,sothefeatureiseffectivelydisableduntilathresholdisloaded.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Axisistheaxistocontrol.InpVectindicatesthesourceofthedataforthisVI.Availableinputvectorsincludeimmediate(0xFF),variable(0x01through0x78),orindirectvariable(0x81through0xF8).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,or

Page 173: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheLoadVelocityThresholdVIestablishesavelocitythresholdforthespecifiedaxis,whichcanthenbemonitoredwiththeReadTrajectoryStatusVI.ThevelocitythresholdstatusisTruewhentheabsolutevalueoffilteredaxisvelocityisabovethethresholdandFalsewhenthevelocitydropsbelowthethreshold.

Velocitythresholdisastatusanddoesnothavetobeenabledordisabled.Loadingamaximumvalueeffectivelydisablesthefeaturebecausethestatuswillalwaysbeoff.IncreasingthevelocityfiltertimeconstantwiththeConfigureVelocityFilterVIreducesquantizationnoiseinthethresholdstatusbutattheexpenseofincreasingthresholdstatuslatency.

Velocitythresholdistypicallyusedtomonitortheaccelerationanddecelerationtrajectoryperiodstoseewhenorifanaxisisuptospeed.YoucanthenchangePIDtuningorotherparametersasafunctionofvelocity.

Page 174: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NISoftMotionControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

UseLoadCounts/StepsperRevolutiontosetCounts(Steps)/Revvalueto1.Otherwise,NI-Motionreturnsanerror.

Page 175: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadVelocityThresholdinRPMLoadsavelocitythresholdforanaxisinRPM.

Details

DeviceCompatibility

VelocityThreshold(5000)isthedouble-precisionfloatingpointvelocitythresholdvalueinRPM.TheRPMrangedependsuponthemotorcountsorstepsperrevolutionandthetrajectoryupdaterate,andisalwaysapositivenumber.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Axisistheaxistocontrol.InpVectindicatesthesourceofthedataforthisVI.Availableinputvectorsincludeimmediate(0xFF),variable(0x01through0x78),orindirectvariable(0x81through0xF8).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,or

Page 176: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheLoadVelocityThresholdVIestablishesavelocitythresholdinRPMforthespecifiedaxiswhichcanthenbemonitoredwiththeReadTrajectoryStatusVI.ThevelocitythresholdstatusisTruewhentheabsolutevalueoffilteredaxisvelocityisabovethethresholdandFalsewhenthevelocitydropsbelowthethreshold.

Velocitythresholdisastatusanddoesnothavetobeenabledordisabled.Loadingamaximumvalueeffectivelydisablesthefeaturebecausethestatuswillalwaysbeoff.IncreasingthevelocityfiltertimeconstantwiththeLoadVelocityFilterParameterVIreducesquantizationnoiseinthethresholdstatusbutattheexpenseofincreasingthresholdstatuslatency.

Velocitythresholdistypicallyusedtomonitortheaccelerationanddecelerationtrajectoryperiodstoseewhenorifanaxisisuptospeed.YoucanthenchangePIDtuningorotherparametersasafunctionofvelocity.

Page 177: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadBlendStatusReadstheBlendCompletestatusforallaxesorvectorspaces.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisorVectorSpaceselectsaxis,axiscontrol,vectorspace,orvectorspacecontrolformovecomplete,oraxisoraxiscontrolforallothertypes.RetVectindicatesthedestinationforthereturndatageneratedbythisVI.Availablereturnvectorsincludereturndatatothehost(0xFF),returndatatoavariable(0x01through0x78),returndatatoanindirectvariable(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroora

Page 178: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

Blendingsmoothlycombinestwomovesegmentsonanaxis,axes,orvectorspace(s).Whencontinuouslyblendingmovesegmentsintoeachother,itisnecessarytowaituntiltheblendiscompletebetweentheprevioustwomovesbeforeyouloadthetrajectoryparametersforthenextmovetoblend.

ThestatusinformationreturnedbytheReadBlendStatusVIindicatesthatthepreviousblendiscompleteandtheaxis,axes,orvectorspace(s)arereadytoreceivethenextblendmovetrajectorydata.

NoteAttemptingtoexecuteaBlendMotionVIbeforethepreviousblendiscompleteontheaxesinvolvedgeneratesamodalerror.RefertoErrorsandErrorHandlingforinformationabouterrorsanderrorhandling.

Example

Whileblendinga2Dvectorstraight-linemove,youcalltheReadBlendStatusVIwithAxisorVectorSpace=VectorSpaceControltoselectvectorspacestatus.Iftheblendonvectorspace1isstillpending,thisVIreturnsaBlendStatus,whichcorrespondstothefollowingbitmap.

Axis/VS1 Axis/VS2 Axis/VS3 Axis/VS4 Axis5 Axis6 Axis7 Axis8False True True False False False False False

Theblendiscomplete(1)onvectorspaces2and3(ortheydonotexist),buttheblendisstillpending(0)onvectorspace1.

Foryourprogrammingconvenience,twoutilityVIs—CheckBlendCompleteStatusandWaitforBlendComplete—areprovided,whichallowyoutospecifyanaxis,vectorspace,groupofaxes,orgroupofvectorspaces,andfindoutifablendiscomplete,orwaituntilablendiscomplete.TheseVIsreturnasimpletrue/falsevalueindicatingwhetherornotablendiscomplete.

Page 179: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadDACReadsthecommandedDACoutputvalueforanaxis.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisorDACistheaxisorDACtoread.RetnVectindicatesthedestinationforthereturndatageneratedbythisVI.Availablereturnvectorsincludereturndatatothehost(0xFF),toavariable(0x01through0x78),toanindirectvariable(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningof

Page 180: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheReadDACVIreturnsthevalueofthespecifiedDACoutput.Whensenttoanaxis,thisVIreturnsthevalueoftheprimaryDACmappedtothataxis.Thesigned16-bitvaluereturnedcorrespondstothe±10VfullscalerangeoftheDAC.

ThisVIisusedtomonitortheoutputcommandfromthePIDloop.WhentheDACoutputisconnectedtoatorqueblockservoamplifier,youcanusethisvaluetocalculatemotortorqueortomonitortheaccelerationanddecelerationportionsofatrajectorytoseehowclosethecontrolloopistosaturatingatitsmaximumtorquelimits.

WhentheDACoutputisconnectedtoavelocityblockservoamplifier,theDACvaluereadisadirectrepresentationoftheinstantaneouscommandedvelocity.

Page 181: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadDACLimitStatusReadsthestatusoftheDAClimits.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.RetVectcontainsthereverselimitsandforwardlimits,whicharereturnedinoneonboardvariable:0000000RRRRRRRR00000000FFFFFFFF0.

Availablereturnvectorsincludereturndatatothehost(0xFF),returndatatoavariable(0x01through0x78),returndatatoanindirectvariable(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.

Page 182: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheReadDACLimitStatusVIreturnsthepositiveandnegativetorquelimitstatusoftheDACoutput.IndependentDACsthatarenotmappedtoaxesdonothavetorquelimits,sothoseDACswillalwaysreturnFalse.

ADACtorquelimitstatusisTrue(1)whentheDACoutputissaturatedatthecorrespondinglimit.Thisinformationtellsyouthatthemotorisoperatingatitsmaximumtorque,probablyduetoanexcessivelyhighvalueofaccelerationordeceleration.Italsocanindicateexcessivefrictionontheaxis,acompletelystalledmotor,orsomeothersystemfault.

Whenanaxisisactive(notinthekilled,motoroffstate),thisVIreturnstheinstantaneousstateofthetorquelimitcircuits.Iftheaxistripsoutonfollowingerror(atypicaloccurrencewhenoperatingatthetorquelimits),theDAClimitstatusislatchedsoyoucantellwhichlimit,positiveornegative,causedthefollowingerrortrip.ThestatusremainslatcheduntiltheaxisisactivatedagainbyaStart,Stop,orBlendMotionVI.

Page 183: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadFollowingErrorReadstheinstantaneousfollowingerrorforanaxisorvectorspace.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisorVectorSpaceistheaxisorvectorspacetoread.RetnVectindicatesthedestinationforthereturndatageneratedbythisVI.Availablereturnvectorsincludereturndatatothehost(0xFF),toavariable(0x01through0x78),toanindirectvariable(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,

Page 184: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheReadFollowingErrorVIreturnstheinstantaneousfollowingerrorfortheaxisorvectorspacespecified.Forvectorspaces,followingerroristheroot-mean-squareofthefollowingerrorsfortheindividualaxesthatmakeupthevectorspace.

Page 185: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadMoveCompleteStatusReadsthemovecompletestatus(MCS)register.

DetailsRemarks

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.Typically,sourceisthenameoftheVIinwhichtheerroroccurred.

MoveCompleteStatusisabitmapofMCSforuptoeightaxes.ThebitmapalsoincludesthestateofthethreeStatusbits:

Page 186: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

ThissectionincludesmoredetailedinformationaboutusingthisVI.

NoteRefertoVIExecutionTimesforbenchmarktiminginformationaboutyourcontroller.

Page 187: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

ThisVIperformsadirectreadoftheMoveCompleteStatus(MCS)registeronthe73xxcontroller.BecausearegisterreadisvirtuallyinstantaneousanddoesnotaffectcommunicationprocessingorotherNI-Motionoperations,youcancallthisVIrepeatedlytogetthemostup-to-datestatusfortheaxes.MoveCompleteStatusisconfigurableindividuallyforeachaxiswiththeConfigureMoveCompleteCriteriaVI.ThecriteriaforconsideringmotiontobecompleteincludeProfileComplete,Run/Stop,In-Position,Settlingtimedelay,andsoon.

NoteReadingtheMCSregisterimmediatelyaftercallingtheStartMotionVImightnotreturnthestatusyouexpected.TheStartMotioncanstillbebufferedinthecommunicationsFIFOwhentheinstantaneousreadoftheMCSoccurs.

ThisVIalsoreturnsthestateoftheUserStatusbits.Youcansetandresetthesethreebitsduringonboardprogramexecutionasgeneral-purposeflagstothehostcomputer.RefertotheSetUserStatusMOMOVIformoreinformation.

NoteWhenthe73xxmotioncontrollerisinthePower-Upstate,theMCSregistercontainsapower-upcodethatdescribeswhythecontrollerisinthePower-Upstate.Foralistofthesepower-upcodes,refertotheClearPowerUpStatusVI.

NISoftMotionControllerConsiderations

Thefollowinglistincludesconsiderationsyoumustmakewhenyouareusing

Page 188: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadStepsGeneratedReadsthenumberofstepsgeneratedbyastepperoutput.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisorStepperOutputistheaxisorstepperoutputtoread.RetVectindicatesthedestinationforthereturndatageneratedbythisVI.Availablereturnvectorsincludereturndatatothehost(0xFF),returndatatoavariable(0x01through0x78),returndatatoanindirectvariable(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,

Page 189: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheReadStepsGeneratedVIreturnsanumberbasedonstepsgeneratedbyastepperaxisorstepperoutputresource.Foropen-loopstepperaxes,thisVIreturnsexactlythesamevalueastheReadPositionVI.

Forclosed-loopstepperaxes,thisVIreturnstheactualnumberofstepsgeneratedwhiletheReadPositionVIreturnsthefeedbackpositionconvertedfromcountstosteps.Thenumberofstepsgeneratedincludesextrastepsaddedduringanypull-inmoverequiredtoreachthetargetposition.

ToresetthevaluereturnedbythisVI,useResetPosition.ResetPositionsetsthestepsparametertotheresetpositionvalue.

Closed-LoopStepperExample

Supposeyouexecuteamovefromposition0toposition100,and10additionalstepsaregeneratedforthepull-inmove.ReadPositionreturns100,butReadStepsGeneratedreturns110.Ifyouexecuteanothermovetoposition50,ReadPositionreturns50,andReadStepsGeneratedreturns60.

Page 190: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadTargetPositionReadsthedestinationpositionofthecurrentmotiontrajectory.

DetailsRemarks

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Axisistheaxistoread.RetnVectindicatesthedestinationforthereturndatageneratedbythisVI.Availablereturnvectorsincludereturndatatothehost(0xFF),toavariable(0x01through0x78),toanindirectvariable(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,

Page 191: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheReadTargetPositionVIreturnsthedestinationpositionofthemotiontrajectorycurrentlyinprocess.Iftheaxisisstopped,itreturnsthetargetpositionofthelasttrajectorycompleted.

ThisVIdiffersfromtheReadPositionVIinthatitreturnsthecommandedtarget(destination)positionratherthantheactualfeedbackposition.

Page 192: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

LoadinganewtargetpositionwithLoadTargetPositiondoesnotaffectthevaluereaduntilastartmotionoccurs.WhencallingBlendMotion,thevaluereaddoesnotreflectthelasttargetpositionloadeduntilaftertheblendoccurs.

NISoftMotionControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

TheNISoftMotionControllerreturnsthetargetpositionloadedregardlessofwhethertheStartMotionVIhasbeencalled.TheNISoftMotionControllerreturnsthetargetpositionofindividualaxes,butdoesnotreturnthetargetpositionloadedbytheLoadVectorSpacePositionVI,eveniftheaxisisconfiguredaspartofthevectorspace.

TheNISoftMotionControllerdoesnotsupportreadingthetargetpositionofavectorspace.

Page 193: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadTrajectoryDataReadsasampleofacquireddatafromthesamplesbuffer.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.RetVectcontainspositionandvelocity.Positionisreturnedinonboardvariablenincounts(steps),andvelocityisreturnedinonboardvariablen+1incounts/s(steps/s).

Availablereturnvectorsincludereturndatatothehost(0xFF),returndatatoavariable(0x01through0x78),returndatatoanindirectvariable(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.

Page 194: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheReadTrajectoryDataVIisusedtoreadbackasinglesampleofacquireddatafromtheonboardsamplebuffer.Thenumberofsamples,thetimebetweensamplesandthesizeofeachsampleissetwhenyouexecutetheAcquireTrajectoryDataVI.Thesamplebufferoperatesfirst-in-first-out(FIFO),somultiplecallstothisVIreturnsamplesintheircorrecttimesequence.

Whileitispossibletoreadthesamplebufferwhilesamplesarestillbeingacquired,youmustwaitenoughtimebetweencallstotheReadTrajectoryDataVItoavoidemptyingthebuffer.

NoteAttemptingtoreadanemptysamplebuffergeneratesanerror.RefertoErrorsandErrorHandlingforinformationabouterrorsanderrorhandling.

TheAcquireandReadTrajectoryDataVIsareusedtoacquireandreadbacktime-sampledpositionandvelocitydataforanalysisanddisplay.TheseVIsimplementadigitaloscilloscopethatisusefulduringsystemsetup,PIDtuning,andgeneralmotionwithdataacquisitionsynchronization.

Example

TheAcquireTrajectoryDataVIisexecutedwithaxes1,2,and4selected.EachcalltotheReadTrajectoryDataVIreturnsonesamplewithanarraysizeofsixandthefollowingdatainthearray:

SampleData[]={Axis1position,Axis1velocity,

Axis2position,Axis2velocity

Axis4position,Axis4velocity}

Page 195: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadTrajectoryStatusReadstheselectedmotiontrajectorystatusofallaxesorvectorspaces.

Details

DeviceCompatibility

StatusTypeistheselectorforthetypeoftrajectorystatustoread.

Value Definition0 Run/Stop1 MotorOff2 VelocityThreshold3 MoveCompleteBoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisorVectorSpaceselectsaxis,axiscontrol,vectorspace,orvectorspacecontrolformovecomplete,oraxisoraxiscontrolforallothertypes.RetVectindicatesthedestinationforthereturndatageneratedbythisVI.Availablereturnvectorsincludereturndatatothehost(0xFF),returndatatoavariable(0x01through0x78),returndatatoanindirectvariable(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVI

Page 196: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheReadTrajectoryStatusVIreturnsamulti-axisstatusbitmapofthestatustypeselected.Youcanselectoneofthefollowingthreetrajectorystatustypes:

Run/StopStatus

Run/Stopstatusisupdatedbasedonfilteredvelocityandrun/stopcriteriasetbytheLoadRun/StopThresholdVI.Thestatusissetwhentheaxisistravellingfastenoughtobeconsideredrunning.TheaxisisconsideredtoberunningwhenthechangeinpositionpersampleperiodexceedstheRun/StopthresholdsetwiththeLoadRun/StopThresholdVI.

MotorOffStatus

AmotorcanbeOfffortworeasons.Eitherakillstopwasexecutedorthefollowingerrortrippointwasexceeded.AMotorOffconditionalsomeansthatanenabledinhibitoutputisactive.RefertotheConfigureInhibitOutputsVIformoreinformation.

VelocityThresholdStatus

TheVelocityThresholdstatusindicateswhethertheaxisvelocityisabove(True)orbelow(False)theprogrammedvelocitythreshold.RefertotheLoadVelocityThresholdVIforinformationaboutsettingandusingavelocitythreshold.

MoveComplete

TheMoveCompletestatusindicateswhetheranaxisorvectorspaceisinthemovecompletestate,whichisthedefaultwhenanaxisorvectorspaceisidle.Whileamoveisinprogress,themovecompletestatusisfalse.Foramovetobecompleteonavectorspace,themovecompletestatusmustbetrueonallaxesinthevectorspace.

Duringavectorspacemove,ifoneaxisinavectorspacetripsoutonafollowingerror,thataxisiskilled,andthemovecompletestatusremainsfalse.

Page 197: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ArcVIsYoucanuseArcVIstoloadparametersforcircularlyinterpolatedmoves.Itincludes2Dcirculararcs,3Dhelicalarcs,andfull3DsphericalarcsVIs.

CircularinterpolationisanadvancedfeatureofNI-Motionandisprimarilyusedincontinuouspathapplicationssuchasmachining,patterncutting,liquiddispensing,robotics,andsoon.Formaximumsmoothnessandaccuracy,theNI-MotionDSPimplementsarcsthroughacubicsplinealgorithm.

ArcVIsarealwayssenttoavectorspace.VelocityandaccelerationparametersloadedbyexecutingthoseVIsonthevectorspaceareusedasthevectorvelocityandvectoraccelerationforallsubsequentarcmoves.Allarcparametersaredouble-bufferedandtakeeffectuponthenextStartMotionorBlendMotionVIexecution.

NoteArcradiusdeterminesthepracticalrangeforvectoraccelerationandvelocity.Unrealizablevectorvaluesgenerateanerrorandthestartorblenddoesnotexecute.

Youcanblendarcmovesintolinearlyinterpolatedmovesandviceversa.YoualsocanloadallaxesinthevectorspaceinthesameblendfactorwiththeLoadBlendFactorVI.

Arcmovesaredefinedrelativetotheirstartingpositionandassuch,areinherentlyoperatedinrelativepositionmode.Thisapproachguaranteesthattheaxesarealreadyonthecircleinthex'y'plane,andavoidsanyimpossiblesituationswheretheendpointofthelastmoveandthebeginningofthearcmovearenotcoincident.ThemodeselectedwiththeSetOperationModeVIhasnoeffectonthearcmove.Itcan,however,affectthelinearlyinterpolatedvectormoveyoumightbeblendingintoorfrom.

ClicktheiconsforVIdescriptions.

Page 198: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadCircularArc

LoadSphericalArc

LoadHelicalArc

Page 199: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadCircularArcLoadsparametersformakingacirculararcmoveina2Dor3Dvectorspace.

DetailsRemarks

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.VectorSpaceisthevectorspacetocontrol.InpVectindicatesthesourceofthedataforthisVI.Availableinputvectorsincludeimmediate(0xFF),variable(0x01through0x78),orindirectvariable(0x81through0xF8).RefertoInputandReturnVectorsformoredetailedinformation.

NoteTheconversionfromfloating-pointtofixed-pointisperformedonthehostcomputer,notonthemotioncontroller.ToloadarcVIsfromonboardvariables,youmustusethe16.16fixed-pointrepresentationforallangles.

errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowing

Page 200: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheLoadCircularArcVIdefinesanarcinthexyplaneofa2Dor3Dvectorspace.

NoteLoadthevelocityandacceleration/decelerationbeforeloadinganarc.

Thearcisspecifiedbyaradius,startingangle,andtravelangleandlikeallvectorspacemoves,usestheloadedvaluesofvectoraccelerationandvectorvelocitytodefinethemotionalongthepathofthearc.Thefollowingfiguredefinesacirculararc.

1CircularArc 3StartingPosition 5Radius2TravelAngle 4StartAngle 6EndingPosition

Circulararcsarenotlimitedto±360°.Movesofover4,000circularrevolutionsineitherdirectioncanbestartedwithonecalltothisVI.

NoteIfyouaredoingonboardprogrammingandareusingInpVecttogetthedatathisVIneeds,rememberthatthisVIreadsthevariablesstartingatthememoryaddresspointedtobyInpVectinthefollowingorder:Radius,StartAngle,TravelAngle.

RefertoNI73xxArcAnglesinDegreesformoreinformationaboutrepresentinganglesnumerically.

Page 201: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

TherangeforRadius(2)is2to231–1counts(steps).TherangeforStartAngle(0)is0to359.999313°whereangle0isalongthepositivexaxisandvaluesincreasecounterclockwisefromthepositivexaxisinthexyplane.TherangeforTravelAngle(0)is–1,474,560°to+1,474,200°(–4,096to+4,095revolutions).

NISoftMotionControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

TherangeforRadius(2)is0to231–1counts(steps).TherangeforStartAngle(0)is0to360°whereangle0isalongthepositivexaxisandvaluesincreasecounterclockwisefromthepositivexaxisinthexyplane.TherangeforTravelAngle(0)isthefull64-bitrange.

Page 202: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadHelicalArcLoadsparametersformakingahelicalarcmoveina3Dvectorspace.

DetailsRemarks

DeviceCompatibility

LinearTravel(0)isthelineartravelofthezaxisincounts(servoaxes)orsteps(stepperaxes).

NoteLoadingazero(0)forLinearTravelreducesthehelicalarctoacirculararc.

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.VectorSpaceisthevectorspacetocontrol.InpVectindicatesthesourceofthedataforthisVI.Availableinputvectorsincludeimmediate(0xFF),variable(0x01through0x78),orindirectvariable(0x81through0xF8).RefertoInputandReturnVectorsformoredetailedinformation.

Note

Theconversionfromfloating-pointtofixed-pointisperformedonthehostcomputer,notonthemotioncontroller.ToloadarcVIsfromonboardvariables,youmustusethe16.16fixed-pointrepresentationforallangles.

errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIruns

Page 203: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheLoadHelicalArcVIdefinesanarcin3Dvectorspacethatconsistsofacircleinthexyplaneandsynchronizedlineartravelinthezaxis.

NoteLoadthevelocityandacceleration/decelerationbeforeloadinganarc.

Thearcisspecifiedbyaradius,startingangle,travelangle,andzaxislineartravel,andlikeallvectorspacemoves,usestheloadedvaluesofvectoraccelerationandvectorvelocitytodefinethemotionalongthehelicalpathofthearc.Thefollowingfiguredefinesahelicalarc.

1HelicalArc 3StartAngle 5Radius 7EndingPosition2TravelAngle 4StartingPosition 6LinearTravel

Likecirculararcs,helicalarcsarenotlimitedto±360°.Movesofupto4,096helicaltwistsineitherdirectioncanbestartedwithonecalltothisVI.

NoteIfyouaredoingonboardprogrammingandareusingInpVecttogetthedatathisVIneeds,rememberthatthisVIreadsthevariablesstartingatthememoryaddresspointedtobyInpVectinthefollowingorder:Radius,StartAngle,TravelAngle,LinearTravel.

RefertoNI73xxArcAnglesinDegreesformoreinformationaboutrepresentinganglesnumerically.

Page 204: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

TherangeforLinearTravel(0)is–(231)to+(231–1)counts(steps).TherangeforRadius(2)is2to231–1counts(steps).TherangeforStartAngle(0)is0to359.999313°whereangle0isalongthepositivexaxisandvaluesincreasecounterclockwisefromthepositivexaxisinthexyplane.TherangeforTravelAngle(0)is–1,474,560°to+1,474,200°(–4,096to+4,095revolutions).

NISoftMotionControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

TherangeforLinearTravel(0)-(±231–1).TherangeforRadius(2)is0to231–1counts(steps).TherangeforStartAngle(0)is0to360°whereangle0isalongthepositivexaxisandvaluesincreasecounterclockwisefromthepositivexaxisinthexyplane.TherangeforTravelAngle(0)isthefull64-bitrange.

Page 205: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadSphericalArcLoadsparametersformakingasphericalarcmoveina3Dvectorspace.

DetailsRemarks

DeviceCompatibility

PlaneYaw(0)isthedoubleprecisionfloatingpointvalue,indegrees,oftheanglebetweenthex'andxaxeswhentheentirex'y'z'vectorspaceisrotatedaroundthezaxis.Thez'axisremainsalignedwiththezaxis.WhenPlaneYawequals90°,thepositivex'axisisalignedwiththepositiveyaxis.

NoteLoadingzerosforPlanePitchandPlaneYawreducesthesphericalarctoacirculararc.

Internally,thefloating-pointvaluesforPlanePitch,PlaneYaw,StartAngle,andTravelAnglearerepresentedasscaled,fixedpointnumbers.

PlanePitch(0)isthedoubleprecisionfloatingpointvalue,indegrees,oftheanglebetweenthex'andxaxeswhentheentirex'y'z'vectorspaceisrotatedaroundtheyaxis.They'axisremainsalignedwiththeyaxis.WhenPlanePitchequals90°,thepositivex'axisisalignedwiththenegativezaxis.

Page 206: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheLoadSphericalArcVIdefinesanarcinthex'y'planeofacoordinatesystemthathastobetransformedbyrotationinpitchandyawfromthenormal3Dvectorspace(xyz).Inthetransformedx'y'z'space,thesphericalarcisreducedtoasimplercirculararc.Itisspecifiedbyaradius,startingangle,andtravelangle,andlikeallvectorspacemoves,usestheloadedvaluesofvectoraccelerationandvectorvelocitytodefinethemotionalongthepathofthearcinthex'y'plane.

NoteLoadthevelocityandacceleration/decelerationbeforeloadinganarc.

Thefollowingfigureshowsagraphicrepresentationofthetransformationbetweenthex'y'z'andxyzcoordinatespaces.TheformaldefinitionsofPlanePitchandPlaneYawarelistedintheprevioussection.

Pitchandyawtransformationsareinherentlyconfusingbecausetheyinteract.Toavoidambiguities,youcanthinkaboutsphericalarcsandcoordinatetransformationsasfollows:

Thesphericalarcisdefinedasacirculararcinthex'y'planeofatransformedvectorspacex'y'z'.TheoriginalvectorspacexyzisdefinedbytheConfigureVectorSpaceVI.Thetransformedvectorspacex'y'z'isdefinedinorientationonly,withnoabsolutepositionoffset.Itsorientationiswithrespecttothexyzvectorspaceandisdefinedintermsofpitchandyawangles.Yawanglerotationcomesbeforepitchanglerotation.Whenrotatingthroughtheyawangle,they'axisneverleavestheoriginalxyplaneasthenewlydefinedx'y'z'vectorspacerotatesaroundtheoriginalzaxis.Whenrotatingthroughthepitchangle,theyandy'axesstayalignedwitheachotherwhilethex'z'planerotatesaroundthem.Atthebeginningofthemove,theaxesareconsideredtobealreadyonthearcinthex'y'plane.Thisavoidsanyimpossiblesituationswheretheendpointofthelastmoveandthebeginningofthearcmovearenot

Page 207: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

TherangeforRadius(2)is2to231–1counts(steps).TherangeforPlanePitch(0)is0to90°.TherangeforPlaneYaw(0)is0to359.999313°.TherangeforStartAngle(0)is0to359.999313°whereangle0isalongthepositivexaxisandvaluesincreasecounterclockwisefromthepositivexaxisinthexyplane.TherangeforTravelAngle(0)is–1,474,560°to+1,474,200°(–4,096to+4,095revolutions).

NISoftMotionControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

TherangeforRadius(2)is0to231–1counts(steps).TherangeforPlanePitch(0)is0to360°.TherangeforPlaneYaw(0)is0to360°.TherangeforStartAngle(0)is0to360°whereangle0isalongthepositivexaxisandvaluesincreasecounterclockwisefromthepositivexaxisinthexyplane.TherangeforTravelAngle(0)isthefull64-bitrange.

Page 208: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

GearingandCammingVIsYoucanuseGearingandCammingVIstosetupandcontrolmaster-slavegearingandcammingontheNImotioncontroller.ItincludesVIstoconfigureagearmaster,loadagearratio,configureacammingmaster,enablecamming,andsoon.

GearingandcammingareadvancedfeaturesofNI-MotionandareusedinapplicationswhereeitherthemasteraxisisnotundercontroloftheNImotioncontrollerorwhenextremelytightsynchronizationbetweenmultipleaxesisrequired.

NoteIfyouaregearingasteppermotorandthegearratioissuchthattheslaveaxisexceedsthemaximumsteppervelocitywhenthemasterdoesnot,theslaveaxisdoesnotmoveandmaytriponfollowingerror.Topreventthis,ensurethegearratiodoesnotpermittheslaveaxistoexceedthemaximumsteppervelocity.Refertoyourmotioncontrollerdocumentationforinformationaboutmaximumsteppervelocities.

ClicktheiconsforVIdescriptions.

ConfigureGearMaster

LoadGearRatio

EnableGearing

EnableGearingSingleAxis

Page 209: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ConfigureCammingMaster

LoadCammingParameter

EnableCamming

EnableCammingSingleAxis

Page 210: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ConfigureCammingMasterConfiguresthemasterdeviceforcammingoperation.

DetailsRemarks

DeviceCompatibility

MasterCycleistherepeatperiodforthemasterdevice.CammingMasteristheaxis,encoder,orADCchanneltouseasthemaster.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisIDistheaxistoconfigure.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,

Page 211: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

UsethisVItoassignamasteraxis,encoder,orADCchanneltotheslaveaxisselectedforthecammingapplication.Anynumberofslaveaxescanhavethesamemaster,buteachslaveaxismusthaveonlyonemaster.

Beforestartingthecammingoperation,youmustconfigurethemasterdevice.Usinganaxisasthemasterdeviceallowstheslaveaxistofollowthetrajectorygenerationoutputofthemasteraxis.Thisfunctionalityisusefulwhenthemasteraxisisanopen-loopsystemorwhenitisusedforhandlingthelatencyofafeedbackdevice(encoderorADC),whichcauseshighfollowingerror.

Youalsocanuseafeedbackdevice,suchasanencoderorADC,asthemasterdevicesothatanymovementmadebythemasterisimmediatelypropagatedtotheslave.

Themasterdevicepositionisinterpreted,ormodularized,withinthemastercycle,whichallowsthecammingoperationtorepeatcontinuouslyasthemasterdevicemoves.Alongwithslavepositions,themastercycleisusedtocalculatethecammingratioatanytime.

Forexample,ifthemastercycleis5,000andthecurrentmasterpositionis12,500,themasterpositioninsidethemastercycleis

position=((12,500modulus5,000)=2,500)

Usingthepreviousmastercyclebutwithamasterpositionof-4,000,themasterpositioninsidethecycleis

position=((-4,000modulus5,000)=1,000)

YoualsocanusetheLoadCammingParameterVItochangethecammingcycle.

RefertotheCammingsectionoftheNI-MotionHelpformoreinformationaboutcammingoperations.

Page 212: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NISoftMotionControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

TheNISoftMotionControllerdoesnotsupportusinganalogfeedbackasthecammingmaster.

Page 213: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ConfigureGearMasterAssignsamasteraxis,encoder,orADCchannelformaster-slavegearing.

DetailsRemarks

DeviceCompatibility

MasterAxisEncoderorADCistheaxis(1through15)trajectorygenerator,encoder(0x21through0x2F),orADCchannel(0x51through0x5F)touseasthemasterforthisslaveaxis.Azero(0)valuemeansnomasterisassigned(default).

NoteAxisandMasterAxis,Encoder,orADCcannotbethesamebecauseanaxiscannotbeitsownmaster.

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Axisistheslaveaxistocontrol.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,

Page 214: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheConfigureGearMasterVIassignsamasteraxis,encoder,orADCchanneltotheslaveaxisselected.Anynumberofslaveaxescanhavethesamemaster,buteachslaveaxiscanhaveonlyonemaster.Aslaveaxismayalsoserveasmasteraxisforanynumberofslaveaxes.

YoumustcalltheConfigureGearMasterVIpriortoenablingmaster-slavegearingwiththeEnableGearingVI.Typically,thesourceforthemasterpositionisanindependentencoder,anADCchannel,orthefeedbackresourceofanenabledaxis.Ineachcase,youassigntheresource,nottheaxis,asthemaster.Thegearmaster,whichcanbeanaxis,encoder,orADC,mustbeenabledbeforeyoucanusethisVI.UsetheEnableAxes,EnableEncoders,orEnableADCsVIstoenablethegearmaster.

Whenanaxisisassignedasthemaster,itstrajectorygeneratoroutput(notitsfeedbackposition)isusedasthemasterpositioncommand.Thismodeofoperationcaneliminatethefollowingerrorskewbetweenthemasterandslaveaxesandisespeciallyusefulingantryapplications.Themasteraxiscanoperateinanymode(includingasaslavetoanothermaster).

Master-slavefunctionalityofslaveaxesisinadditiontotheirnormalmodeofoperation.Thisallowsapoint-to-pointmovetobesuperimposedupontheslavewhiletheslaveaxisisinmotionduetobeinggearedtoitsmaster.Thisfunctionalityisusefulforregistrationandreferenceoffsetmoves.RefertotheGearingsectionoftheNI-MotionHelpforinformationaboutusingsuperimposedmoves/registrationapplications.Also,refertotheRotatingKnifesectionoftheNI-MotionHelpforexamplecodethatincludessuperimposedmoves.

RefertotheLoadGearRatioandEnableGearingVIsformoreinformationaboutmaster-slavegearing.

Page 215: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NISoftMotionControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

TheNISoftMotionControllerdoesnotsupportusinganalogfeedbackasthegearmaster(analoggearing).

Page 216: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

EnableCammingEnablescammingoperationformultipleaxes.

Details

DeviceCompatibility

EnableDataisanarrayofclustersthatincludethefollowingelements:Axisistheaxisyouwanttostartorstopcammingoperationon.Enableindicatesifthecammingisstarted(True)orstopped(False)ontheselectedAxis.Positionisthepositiontostartorstopthecammingat.Thevalidrangeis–1or0through(mastercycle–1).

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroora

Page 217: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

UsethisVItosimultaneouslystartorstopacammingoperationonmultipleaxes.ThedefaultvalueforthePositionelementoftheEnableDataarrayis–1,whichstartscammingimmediately.Tostartcammingataspecificmasterposition,setthisparametertoavaluebetween0and(mastercycle–1).

RefertotheCammingsectionoftheNI-MotionHelpformoreinformationaboutcammingoperations.

Page 218: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

EnableCammingSingleAxisEnablescammingoperationforthecurrentaxis.

Details

DeviceCompatibility

Positionisthepositiontobegincammingat.Thedefaultis–1,andthevalidrangeis–1or0through(mastercycle–1).Enableenables/disablescammingonthespecifiedaxis.SetEnabletoTRUEtoenablecammingorFALSEtodisablecamming.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisIDistheaxistoconfigure.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.

Page 219: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

UsethisVItostartorstopacammingoperationonanaxis.YoucanstartorstopthecammingoperationimmediatelybysettingPositionto–1.Toconfigurethecammingoperationtotakeplaceafterthemasterdevicecrossesaspecificpositioninsidethemastercycle,setPositiontoavaluebetween0and(mastercycle–1).

RefertotheCammingsectionoftheNI-MotionHelpformoreinformationaboutcammingoperations.

Page 220: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

EnableGearingEnablesslaveaxesformaster-slavegearing.

Details

DeviceCompatibility

Gearing(Disable)isthebitmapofslaveaxestoenableforgearing.Axis1—Iftrue,gearingisenabled.Iffalse,gearingisdisabled(default).Axis2—Iftrue,gearingisenabled.Iffalse,gearingisdisabled(default).Axis3—Iftrue,gearingisenabled.Iffalse,gearingisdisabled(default).Axis4—Iftrue,gearingisenabled.Iffalse,gearingisdisabled(default).Axis5—Iftrue,gearingisenabled.Iffalse,gearingisdisabled(default).Axis6—Iftrue,gearingisenabled.Iffalse,gearingisdisabled(default).Axis7—Iftrue,gearingisenabled.Iffalse,gearingisdisabled(default).Axis8—Iftrue,gearingisenabled.Iffalse,gearingisdisabled(default).

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.errorin(noerror)describeserrorconditionsthatoccurbeforethisVI

Page 221: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheEnableGearingVIenablesanddisablesmaster-slavegearingfunctionalityofslaveaxes.Whengearingisenabled,thepositionsoftheslaveaxesandtheircorrespondingmastersarerecordedastheirabsolutegearingreference.Foraxesandencoders,thecurrentpositionisthevaluerecorded.ForADCs,thebinaryvalueisrecorded.Fromthenon,aslongasthegearratioremainsabsolute,everyincrementalchangeofamasterpositionismultipliedbythecorrespondingabsolutegearratioandappliedtotheslaveaxis.RefertotheLoadGearRatioVIforinformationaboutabsoluteversusrelativegearratios.

NoteChangingtheabsolutegearratiocausestheslaveaxestojumptoanewpositionspecifiedbythenewgearratio.Withservomotorsystemstheslavejumpsimmediately.Withsteppersystems,ifthenewslavepositioniswithin4,000steps,itjumpstothenewposition.Otherwise,theslaveaxiswaitsuntilthecommandedslavepositionmovestowithin4,000stepsandthenjumpstothenewposition.Theslaveaxisthenresumesfollowingthemasteraxisaccordingtothegearratio.

YoumustcalltheConfigureGearMasterandLoadGearRatioVIspriortoenablingmaster-slavegearing.Inaddition,youmustenableandactivatetheslaveaxesbeforeenablinggearing.Anerrorisgeneratedifaslaveiskilledwhengearingisenabled.Thesechecksensurethattheslaveaxisenablesinacontrolledfashion.

NoteIfyouarerunningaslaveaxismovewithastepperaxis,itispossiblethattheslaveaxisgearedvelocityexceedsthemaximumsteprateofthecontroller.Inthiscase,thecontrollerkillstheaxisandsetsthefollowingerrorstatustotrue.RefertotheSpecificationssectionofyourcontrollerusermanualforthemaximumsteprateofyourcontroller.

YoucancalltheEnableGearingVIatanytimetodisablegearingortore-enablegearingwithnewabsolutegearingreferencepositions.Ifgearingisdisabledonamovingaxis,theaxisimmediatelystopsbutremainsactive.Iftheslaveaxiswasalsoimplementingasuperimposedmove,thesuperimposedmovedeceleratestoastop.

Page 222: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

EnableGearingSingleAxisEnablesslaveaxisformaster-slavegearing.

Details

DeviceCompatibility

Gearing(Disable)indicateswhethertoenableordisabletheslaveaxisforgearing.Iftrue,gearingisenabled.Iffalse,gearingisdisabled(default).BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Axisistheslaveaxistoenableordisable.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.

Page 223: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

ThisVIissimilartotheEnableGearingVI,butallowsyoutoenableordisablegearingonasingleaxiswithoutaffectingtheotheraxes.

TheEnableGearingSingleAxisVIenablesanddisablesmaster-slavegearingfunctionalityofaslaveaxis.Whengearingisenabled,thepositionoftheslaveaxisanditscorrespondingmasterisrecordedasitsabsolutegearingreference.Fromthenon,aslongasthegearratioremainsabsolute,everyincrementalchangeofamasterpositionismultipliedbythecorrespondingabsolutegearratioandappliedtotheslaveaxis.RefertotheLoadGearRatioVIforinformationaboutabsoluteversusrelativegearratios.

NoteChangingtheabsolutegearratiocausestheslaveaxestojumptoanewpositionspecifiedbythenewgearratio.Withservomotorsystemstheslavejumpsimmediately.Withsteppersystems,ifthenewslavepositioniswithin4,000steps,itjumpstothenewposition.Otherwise,theslaveaxiswaitsuntilthecommandedslavepositionmovestowithin4,000stepsandthenjumpstothenewposition.Theslaveaxisthenresumesfollowingthemasteraxisaccordingtothegearratio.

YoumustcalltheConfigureGearMasterandLoadGearRatioVIspriortoenablingmaster-slavegearing.Inaddition,youmustenableandactivatetheslaveaxisbeforeenablinggearing.Anerrorisgeneratediftheslaveiskilledwhengearingisenabled.Thesechecksensurethattheslaveaxisenablesinacontrolledfashion.

NoteIfyouarerunningaslaveaxismovewithastepperaxis,itispossiblethattheslaveaxisgearedvelocityexceedsthemaximumsteprateofthecontroller.Inthiscase,thecontrollerkillstheaxisandsetsthefollowingerrorstatustotrue.RefertotheSpecificationssectionofyourcontrollerusermanualforthemaximumsteprateofyourcontroller.

YoucancalltheEnableGearingSingleAxisVIatanytimetodisablegearingortore-enablegearingwithnewabsolutegearingreferencepositions.Ifgearingisdisabledonamovingaxis,theaxisimmediatelystopsbutremains

Page 224: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadCammingParameterLoadsothercammingparameters,suchasmasteraxispositionoffsetandslaveaxispositionoffset.

Details

DeviceCompatibility

DataisaclusterofvariablesthatcontainsthevaluesfortheselectedAttribute.

Integeris32-bitintegerdata.Doubleis64-bitfloatingpointdata.BooleanisBooleandata.

Attributeistheattributetoconfigure.Thefollowinglistincludesvalidattributes:

MasterCycle—SettheDoubleelementoftheDataclustertothemastercycleinuserunits.Themastercycleindicateshowoftenthecammingcyclerepeatsitself.Forexample,ifyouspecify8,000countsfortheMasterCycle,thecammingrepeatsitselfevery8,000counts.MasterOffset—DoubleelementoftheDataclustertothemasteroffsetinuserunits.Masteroffsettakesintoaccountthepositiondifferencebetweenthecurrentpositionofthemasteraxisandthepositionatwhichthecammingbegins.Rangeis0to(MasterCycle–1).

Page 225: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

UsethisVItoconfigurevariousparametersofthecammingoperation:

MasterCycledefineswhenthecammingoperationisgoingtorepeatbasedonthemasterposition.YoucanconfigurethemastercycleatthesametimeyouconfigurethecammingmasterusingtheConfigureCammingMasterVI.

NoteYoucannotchangethemastercycleaftercammingisenabled.MasterOffsetisappliedtothemasterpositionwhencammingisenabled.Thisattributeshiftsthepositionmodulustocompensateforthefactthatthecammingcyclemaynotstartat0.Forexample,ifyouhaveamastercycleof4,000andamasteroffsetof0,thecammingoperationrepeatsat...,-8,000,-4,000,0,4,000,8,000,...Ifyouchangethemasteroffsetto1000,thecammingoperationrepeatsat...,-7,000,-3,000,1,000,5,000,9,000,....

Thedefaultvalueforthemasteroffsetis0,andthevalidrangeofvaluesforthemasteroffsetis0to(MasterCycle–1).

TipThemasteroffsetisappliedonlywhencammingisstartedorenabled.

SlaveOffsetisappliedwhenthecammingcyclebegins.Thisoffsetisusedtoadjustthecammingprofilewhenthebeginningandendingpositionsfortheslaveaxisarenotthesame.Youcanchangetheslaveoffsetatanytime,butthechangetakeseffectonthenextcammingcycle.

Thedefaultvalueis0.

RefertotheCammingsectionoftheNI-MotionHelpformoreinformationaboutcammingoperations.

Page 226: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadGearRatioLoadsthegearratioformaster-slavegearing.

Details

DeviceCompatibility

Gearing(Absolute)selectsabsoluteFALSEorrelativeTRUEgearingbetweenthemasterandslave.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Axisistheslaveaxistocontrol.InpVectcontainsthetype,numerator,anddenominatorparametersthatarethesourceofdataforthisVI.

Availableinputvectorsincludeimmediate(0xFF),variable(0x01through0x78),orindirectvariable(0x81through0xF8).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.If

Page 227: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheLoadGearRatioVIloadsthegearratiooftheslaveaxisrelativetoitsmasterandselectswhetherthisratioisabsoluteorrelative.Theratioisloadedasanumeratoranddenominatorbecauseitisanaturalformatforaratio(numerator:denominator)anditallowsabroadrangeofratios,from1:32,767to32,767:1.Theratioisalwaysspecifiedasslaverelativetomaster(slave:master).

WhenyouexecutetheEnableGearingVI,thepositionsoftheslaveanditsmasterarerecordedastheirabsolutegearingreference.Fromthenon,aslongasthegearratioremainsabsolute,everyincrementalchangeofthemaster'spositionismultipliedbytheabsolutegearratioandappliedtotheslaveaxis.

Ifarelativegearratioisselectedandloadedaftergearingisenabled,thepositionofthemasterisrecordedasitsrelativereferencepointandeveryincrementalchangefromthisreferencepointismultipliedbytherelativegearratioandappliedtotheslaveaxisoraxes.

NoteWhilechanginganabsolutegearratioontheflyisallowed,youmustbecarefulbecausetheslaveaxisjumpswithfulltorquetothepositiondefinedbythenewratioevenwhenthemasterpositionhasnotchanged.Similarly,resettingthepositiononamasteraxisalsocausesitsslaveaxestojumptoanewpositionrelativetothenewpositionofthemasteraxis.

TheLoadGearRatioVImustbecalledpriortoenablingmaster-slavegearingwiththeEnableGearingVI.Oftenthepositionsofthemasterandslaveareresettozeroorsomeknownpositionpriortoenablinggearing,thoughthisisnotalwaysrequired.TheexecutionoftheEnableGearingVIstoresbothpositionsasoffsetsandgearsthemfromthatpointonward.

Relativegearingchangesthespecifiedpositionoftheslaveaxisonlywhenthemastermoves.Itusesthelengthofthecurrentmoveofthemasteraxistocalculatehowfartomovetheslaveaxis.Attheendofthemove,iftheslaveaxisisnotattheexactposition,thepositionerrorisdiscarded.Thismay

Page 228: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

BufferedOperationsVIsBufferedoperationsallowyoutocreateandmanagememorybuffersontheNImotioncontroller.Youcancreatebuffersthatcanholdupto16,364points,readandwritedatatoandfromthesebuffers,andcheckthestatusofabuffer.BufferscanevenbestoredinROMforlateruse.

Onboardbuffersallowyoutostoremuchmoredatathanthe120onboardvariables.Datacanbemovedbackandforthbetweenbuffersandonboardvariablesbyusinginputandreturnvectors.

Forexample,anonboardbuffercanbecreatedtoholdaseriesoftargetpositionstomoveto,oneafteranother.Anonboardprogramiswrittentoreadapositionfromthebuffertoanonboardvariable,thenusethatvaluetoloadatargetposition,startamove,andwaitforthemovetocomplete.Thesameprocessisrepeatedforeachtargetpositionuntiltheentirebufferofpositionsisconsumed.Thisapproachallowsforalargenumberofmovestoexecuteindependentofthehostcomputer.

Besidessingle-shotapplicationswherethebufferholdsallofthedataorisfilledwithallofthedataonlyonce,itispossibletouseanonboardbufferinacontinuousfashion,allowingforverylargeamountsofdatatotransfertoorfromthemotioncontroller.UsetheCheckBufferVItodeterminethenumberofpointsthatcanbesafelywrittentoorreadfromtheonboardbufferatanypointintime.

The7350and7340controllershavethefollowingonboardmemory:

Controller RAM ROM7340 164ksector 264ksectors7350 264ksectors 464ksectors

YoucanaccessabufferfromeitherRAMorROM,butyoucannotsplitbuffersbetweenthetwo,andyoucannotsplitbuffersbetweenthe64KBROMsectors.

Contouringisaspecialmovementmodeimplementedontopofthebufferedoperations.Contouringallowsyoutospecifyaseriesofpositionsnmilliseconds

Page 229: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

apartforthemotioncontrollertosplinethrough.

YoucanusetheBufferedOperationsVIstoperformbufferedhigh-speedcapturesandbufferedbreakpoints.Theseallowyoutoachievefasterratesthanwouldotherwisebepossiblebyautomaticallystoringcapturedpositionsorautomaticallyloadingbreakpoints.RefertoHigh-SpeedCaptureOverviewandBreakpointOverviewformoreinformation.

NoteConfiguringandclearingbuffersisaprocessor-intensiveoperationontheNImotioncontrollerthatrequirestheallocationandde-allocationofmemory.Configureandclearbuffersonlywhenmotorsarenotmovingandonboardprogramsarenotrunning.

ClicktheiconsforVIdescriptions.

ConfigureBuffer

WriteBuffer

ReadBuffer

CheckBuffer

ClearBuffer

Page 230: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

CheckBufferReturnsinformationaboutthecurrentstateofthebuffer.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Bufferisthebuffertoconfigure.Validbuffernumbersare1through255(0x01through0xFF).RetVectindicatesthedestinationforthereturndatageneratedbythisVI.Availablereturnvectorsincludereturndatatothehost(0xFF),returndatatoavariable(0x01through0x78),returndatatoanindirectvariable(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroora

Page 231: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheCheckBufferVIprovidesyouwithcurrentinformationaboutthestateofthebuffer.Insingleiterationsituations,meaningTotalPointsislessthanorequaltoBufferSizeintheConfigureBufferVI,theBufferStateparameterismostusefulindeterminingthattheoperationhascompleted.

Forafiner-resolutionviewofthestateofthebuffer,theBacklogparameterindicatesthenumberofpointsthatcansafelybewrittentoorreadfromthebufferwithoutviolatingtheOldDataStopcondition.RefertoConfigureBufferformoreinformation.

PointsDoneisthenumberofpointsreadfromthebufferbythecontroller,inthecaseofanoutputbuffer,orwrittentothebufferbythecontroller,inthecaseofaninputbuffer.PointsDoneisfromthepointofviewofthecontroller,ratherthantheuser.

Asanexample,inthecaseofcontouring,Backloghelpsyoudeterminewhenyoucanwritemoredatatothebuffer,whilePointsDonetellsyouhowmanypointshaveactuallybeensplinedtogetherbythecontroller.PointsDonereflectswhatishappeningintherealworld,wheremotionoccurs.

NoteThisVIreturnsdatainthefollowingorder:Backlog,BufferState,andPointsDone.

OutputBufferExample

Afteryouconfigurea10-pointbufferforcontouring,thecontentsareindeterminateandboththereadandwriteheadsareatposition0.

Write:0Read:0

Inwritingthevalues1through5toabuffer,thewriteheadmovestothesixthpositioninthebuffer,wherethenextwritetakesplace.Thereadheadisstillatposition0becauseithasreadnodatafromthebuffer.Likewise,PointsDoneisstill0.

Page 232: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ClearBufferClearsthepreviouslyconfiguredbufferandclearsanyassociationsbetweenresourcesandthespecifiedbuffer.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Bufferisthebuffertoconfigure.Validbuffernumbersare1through255(0x01through0xFF).errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.Typically,sourceisthenameoftheVIinwhichtheerroroccurred.

Page 233: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

Afterabufferedoperationcompletes,itisimportanttoclearthebufferbycallingtheClearBufferVI.Otherwise,thememoryallocatedforthebufferintheonboardRAMisnotavailableforotheruses,suchastheallocationofanotherbufferorthestorageofanonboardprogram.

Abuffercannotbeclearedwhileitisinuse.Ifyoutrytoclearabufferwhileitisinuse,theClearBufferVIgeneratesaBufferInUseerror.

NoteConfiguringandclearingbuffersisaprocessor-intensiveoperationonthemotioncontrollerthatrequirestheallocationanddeallocationofmemory.Youmustconfigureandclearbuffersonlywhenmotorsarenotmovingandonboardprogramsarenotrunning.Forexample,ifyouwishtoexecutethreesimultaneouscontouringoperationsonaxis1,axis2,andvectorspace1(withaxes3and4),youmustfirstconfigureallthreebuffersbeforestartinganyoftheoperations.Youcanstartthecontouroperationsindependently,andatdifferenttimes,butwaituntilalloperationsarecompletebeforeclearinganyofthebuffers.

AdvancedUses

ThisVIonlyclearsabufferfromRAM.IfyousaveabuffertoROMusingtheObjectMemoryManagementVI,youmustdeletethebufferfromROMusingtheObjectMemoryManagementVI.IfyoucalltheClearBufferVIandspecifyabufferthatresidesinROM,theassociationbetweentheresourceandthebufferiscleared,butthebufferremainsinROM.

NoteYoucannotclearabufferthatisattachedtoanaxisthatismoving.Youcanclearabufferthatisactive,suchasahigh-speedcapturebufferthatiswaitingforatrigger,butNI-Motionreturnsanerrorinthiscase.

Ifmultipleresourcesrefertothesamebuffer,allassociationsfromallresourcestothespecifiedbufferarecleared.RefertotheAdvancedUsessectionintheConfigureBufferVIdescriptionformoreinformation.

Page 234: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ConfigureBufferConfiguresabufferforuseinbufferedoperations.

DetailsRemarks

DeviceCompatibility

OldDataStop(True)indicatestothemotioncontrollerwhetherornottostopreadingfromorwritingtothebufferwhenolder,unreaddataisencountered.ThisisonlyrelevantwhenTotalPointsisgreaterthanBufferSize.Intheoutputcase,suchascontouring,whenOldDataStopistrueandTotalPointsisgreaterthanBufferSize,youmustwritenewdatatothebufferbeforethemotioncontrollerfinishesthebufferandstartsoveratthebeginning.Likewise,foraninputbuffer,ifthecontroller(oranonboardprogramrunningonthecontroller)iswritingdatatothebuffer,suchasbufferedhigh-speedcapturedata,youmustreaddataoutofthebufferbeforethecontrollerwrapsaroundandwritesnewdataontopoftheolddata.

IfyousetOldDataStoptofalse,themotioncontrollerdoesnotenforcetheolddatastopcondition,andsimplywritesdatatoorreadsdatafromthebufferasneeded.

RequestedInterval(10ms)isadditionaldataforthePositionbuffertype.ThePositionbuffertyperequiresaRequestedIntervalparameter,andindicatesthetimebetweencontouringdatapointsinmilliseconds.Forallotherbuffertypes,theRequestedIntervalparameterisignored.

Page 235: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

Afterabufferisconfigured,youcanwritetothebufferwiththeWriteBufferVIandreadfromthebufferwiththeReadBufferVI.

AcontouroperationthatusesabufferisinitiatedwhentheStartMotionVIiscalled.YoucheckthestateofthebufferwiththeCheckBufferVItodeterminehowmanypointshavebeenreadfromorwrittentothebufferbythemotioncontroller.

Afterabufferedoperationiscomplete,itisimportanttoclearthebufferbycallingtheClearBufferVI.Otherwise,thememoryallocatedforthebufferintheonboardRAMisnotavailableforotheruses,suchastheallocationofanotherbuffer.Buffersmustonlybeclearedwhennomotorsaremovingandnoprogramsarerunning.

Abuffercannotbereconfiguredorclearedwhilethebufferisinuse.TheVIgeneratesaBufferInUseerrorinsuchacase.

Abuffercanonlybeusedbyoneresourceatatime.Multipleresourcescanbeassociatedwithasinglebuffer,butonlyoneresourcecanusethatbufferatanygiventime.Likewise,asingleresourcecanmakeuseofmanybuffers,butforbuffersofthesametype,onlyoneofthemcanbeassociatedwiththatresourceatagiventime.RefertotheNI73xxControllerConsiderationssectionofthisVIdescriptionformoreinformation.

NoteConfiguringandclearingbuffersisaprocessor-intensiveoperationontheNImotioncontrollerthatrequirestheallocationandde-allocationofmemory.Configureandclearbuffersonlywhenmotorsarenotmovingandonboardprogramsarenotrunning.

ExampleUses

General-PurposeInputandGeneral-PurposeOutputExamples

Configurea300-pointoutputbufferandfillitwithposition,velocity,andaccelerationvaluesforasequenceof100moves.Thenwriteanonboard

Page 236: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

UsinginputvectorsandreturnvectorswiththeReadBufferandWriteBufferVIs,youcanwritetoandreadfromthebufferwithdatastoredinonboardvariables.Youmustlimitthenumberofpointstoreadorwritebecausethereareonly120onboardvariables.DataisreadfromorwrittentoonboardvariablessequentiallystartingatthevariablespecifiedbyInpVectorRetVectintheWriteBufferVIorReadBufferVI,respectively.

SpecifyaBufferSizeof0toassociatearesource(likeanaxisorvectorspace)toanexistingbuffer,withoutaffectingthesizeofthebufferorthedatacontainedinthebuffer.Thefollowingexamplesillustratetheuseofthistechnique:

Asingleresource,forexample,anaxisorvectorspace,canusebuffer1foracontouringoperation,andthenswitchtobuffer2forasubsequentoperation.Youcansetupthetwobuffersaheadoftime,andwhenthefirstoperationiscomplete,youcanmakeanadditionalcalltoConfigureBufferwithaBufferSizeof0,thesamevalueforResource,andthenewbuffernumberforBuffer.Ifyouwishtoreuseabufferwithanotherresource,simplycalltheConfigureBufferVIwiththesamebuffernumber,aBufferSizeof0,andanewvalueforResource.Bothresourcescanstillusethesinglebuffer,butnotatthesametime.

ABufferSizeof0allowsyoutoassociatearesourcewithanexistingbuffer,withoutchangingthecontentsoftheexistingbuffer.Also,aBufferSizeof0canbeusedtoleavethecurrentbufferalone,butchangethevalueofanotherparameter.Whenyoureconfigurethe

Page 237: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadBufferReadsdatafromapreviouslyconfiguredbuffer.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Bufferisthebuffertoconfigure.Validbuffernumbersare1through255(0x01through0xFF).RetVectindicatesthedestinationforthereturndatageneratedbythisVI.Availablereturnvectorsincludereturndatatothehost(0xFF),returndatatoavariable(0x01through0x78)orvariablearray(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.

WhenreturningdatatoRetVect,youmustlimitNumberofPointstoanumberthatfitsinasequenceofonboardvariablesstartingwiththevariablespecifiedbyRetVect.

errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,or

Page 238: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

Aninputbuffercanbewrittentoafterithasbeenconfigured,usuallybyanonboardprogram.Afterdataisavailable,youreadthedatafromthebufferwiththeReadBufferVI.

Whenthebufferisconfiguredforasingleiteration,youcanwaituntilthebufferisfullbycheckingitsstatususingtheCheckBufferVI,andthenreadtheentirecontentsofthebuffer.Youalsocanreadsmallerchunksofdatafromthebufferwhiletheoperationisinprogress.ThenumberofpointsavailabletoreadcanbedeterminedwiththeBacklogparameterreturnedbyCheckBuffer.

Whenusingthebufferasacircularbuffer(TotalPoints>BufferSize)withOldDataStopturnedon,youmustreaddatafromthebufferfasterthanthebufferisfilledwithnewdata.YoucandeterminethenumberofpointsyoucansafelyreadfromthebufferbycallingtheCheckBufferVI.

TheBacklogparametertellsyouhowmanypointsyoucansafelyreadfromthebuffer.

Ifyoutrytoreaddatathathasnotyetbeenwrittentothebufferbythecontroller,thedataisnotread,andthecontrollergeneratesanOldDataStoperror.IfyouconfigurethebufferwithOldDataStopsettofalse,however,youcanreaddatafreelyfromthebuffer,andthecontrollerdoesnotenforcetheOldDataStopcondition.

ReadBuffergeneratesanillegalbufferoperationerrorifyoutrytoreaddatafromanoutputbufferafterthespecifiednumberofpoints(TotalPoints)hasalreadybeenreadfromthebuffer.

Page 239: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

WriteBufferWritesdatatoapreviouslyconfiguredbuffer.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Bufferisthebuffertoconfigure.Validbuffernumbersare1through255(0x01through0xFF).InpVectindicatesthesourceofthedataforthisVI.Availableinputvectorsincludeimmediate(0xFF),variable(0x01through0x78),orindirectvariable(0x81through0xF8).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroora

Page 240: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

Afterabufferhasbeenconfiguredforanoutputoperationsuchascontouring,youmustwritedatatothebufferbeforestartingtheoperation.Whenallofthedatafitsinthebuffer(BufferSize TotalPoints),youneedonlyfillthebufferonetimewiththeappropriatedata.

Whenusingthebufferasacircularbuffer(TotalPoints>BufferSize),withOldDataStopturnedon,youneedtowritefreshdatatothebufferfasterthanthemotioncontrollerconsumesthedata.Afterfillingthebufferonce,andstartingthebufferedoperation,youcandeterminethenumberofpointsyoucansafelywritetothebufferbycallingtheCheckBufferVI.TheBacklogparametertellsyouhowmanypointsyoucansafelywritetothebufferwithoutoverwritingdatathathasyettobeconsumedbythecontroller.

Ifyoutrytowritenewdataontopofolddata,whichisdatathathasnotbeenconsumedbythecontroller,thewritecommanddoesnotexecute,andthecontrollergeneratesanOldDataStoperror.IfyouconfigurethebufferwithOldDataStopsettofalse,however,thecontrollerdoesnotenforcetheOldDataStopconditionandyoucanwritedatafreelytothebuffer.

ExampleUses

BasicUses

Supposeyouhaveacontourmoveof25,107points,andconfigureabufferwithBufferSizeof1,000pointsandTotalPointsof25,107.YousetOldDataStopintheConfigureBufferVItoTrue,andusetheCheckBufferandWriteBufferVIsasyouwritedatatothebufferinsmallchunkswhilethedataisconsumedbythemotioncontroller.Whenyouwritethelastpointstothecontroller,youcanstillsetRegenerationModeto0(nochange)andthemotioncontrollerknowsyouaredonewritingdatatothebufferbecauseyouhavewritten25,107pointsintotal.Whenthecontrollerisunabletoreadanymorebecausethereadmarkhascaughtuptothewritemark,thecontrollerchecksRegenerationMode,recognizesthisstopisintentionalbecausethetotalpointswrittentothebufferisequaltoTotalPoints,andcompletestheoperationwithoutgenerating

Page 241: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Start&StopMotionVIsYoucanuseStart&StopMotionVIstostart,blend,andstopmotion.

YoucanexecutealloftheNI-MotionstartandstopVIsonanindividualaxis,simultaneouslyonmultipleaxes,onavectorspace,orsimultaneouslyonmultiplevectorspaces.TheseVIsgivecompletecontroloverthestateofthemotorsinthesystemandwiththeadditionoftheFindReferenceVIs,aretheonlyNI-MotionVIsthatcanactuallyinitiatemotion.

ClicktheiconsforVIdescriptions.

StartMotion

BlendMotion

StopMotion

Page 242: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

BlendMotionBlendsmotiononasingleaxis,singlevectorspace,multipleaxes,ormultiplevectorspaces.

Details

DeviceCompatibility

Axis/VSMapisthebitmapofaxesorvectorspacestoblend.ItisonlyrequiredwhenyouselectmultipleaxesorvectorspaceswiththeAxisorVectorSpaceparameter.

Whenblendingaxes(AxisorVectorSpace=0):

Axis/VS1—Iftrue,blendaxis.Iffalse,donotblendaxis.Axis/VS2—Iftrue,blendaxis.Iffalse,donotblendaxis.Axis/VS3—Iftrue,blendaxis.Iffalse,donotblendaxis.Axis/VS4—Iftrue,blendaxis.Iffalse,donotblendaxis.Axis/VS5—Iftrue,blendaxis.Iffalse,donotblendaxis.Axis/VS6—Iftrue,blendaxis.Iffalse,donotblendaxis.Axis/VS7—Iftrue,blendaxis.Iffalse,donotblendaxis.Axis/VS8—Iftrue,blendaxis.Iffalse,donotblendaxis.

Whenblendingvectorspaces(AxisorVectorSpace=0x10):

Axis/VS1—Iftrue,blendvectorspace.Iffalse,donotblendvectorspace.Axis/VS2—Iftrue,blendvectorspace.Iffalse,donotblendvectorspace.

Page 243: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheprimarydifferencebetweenaStartMotionVIandaBlendMotionVIisthattheStartMotionVIisimmediateandpreemptive,whiletheBlendMotionwaitsandstartsthenextmoveuponthecompletionofthepreviousmove.

TheBlendMotionVIisusedtoblendmotionprofilesonaxesorvectorspaces,eithersimultaneouslyorindividually.AblendissimilartoanormalstartandhasthesamerequirementsforvalidtrajectoryparametersastheStartMotionVI.Theblendedmoveusesthemostrecentlyloadedvaluesofacceleration,velocity,targetposition,s-curve,operationmodeandsoontogeneratethemotionprofile.

NoteIfastepperaxisisinakilledstate(notenergized),halttheaxisusingtheStopMotionVI,withStopTypesettohaltstop,beforeyouexecuteaStartMotionorBlendMotionVI.Afteryouhalttheaxis,youmightneedtowaitbeforeexecutingaStartMotionorBlendMotionVI,sothatthestepperdrivecomesoutofresetstate.IfthestepperdrivedoesnotcomeoutofresetstatebeforeyouexecutetheVI,thestepperaxismightlosesomestepsduringacceleration.TodeterminewhetheryouneedtowaitbeforeexecutingtheVI,refertothestepperdrivedocumentationorvendor.

Blendstartingsmoothlyblendstwomovesegmentsonanaxis,axes,orvectorspace(s).Therearethreetypesofblends,controlledbytheblendfactor:

Blendmovesbysuperimposingthedecelerationprofileofthepreviousmovewiththeaccelerationprofileofthenextmove(blendfactor=–1).Blendmovesbystartingthenextmoveattheexactpointwhenthepreviousmovehasstopped(blendfactor=0).Startthenextmoveafteraprogrammeddelaytimebetweentheendofthepreviousmoveandthestartofthenextmove(blendfactor>0ms).

RefertotheLoadBlendFactorVIformoreinformationabouthowblendfactorcontrolstheblendingofmotionprofiles.

Page 244: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

StartMotionStartsmotiononasingleaxis,singlevectorspace,multipleaxes,ormultiplevectorspaces.

Details

DeviceCompatibility

Axis/VSMapisthebitmapofaxesorvectorspaces(coordinatespaces)towaiton.ItisonlyrequiredwhenmultipleaxesorvectorspacesareselectedwiththeAxisorVectorSpaceparameter.

Whenstartingaxes(AxisorVectorSpace=0):

Axis/VSMap1—Iftrue,startaxis.Iffalse,donotstartaxis.Axis/VSMap2—Iftrue,startaxis.Iffalse,donotstartaxis.Axis/VSMap3—Iftrue,startaxis.Iffalse,donotstartaxis.Axis/VSMap4—Iftrue,startaxis.Iffalse,donotstartaxis.Axis/VSMap5—Iftrue,startaxis.Iffalse,donotstartaxis.Axis/VSMap6—Iftrue,startaxis.Iffalse,donotstartaxis.Axis/VSMap7—Iftrue,startaxis.Iffalse,donotstartaxis.Axis/VSMap8—Iftrue,startaxis.Iffalse,donotstartaxis.

Whenstartingvectorspaces(AxisorVectorSpace=0x10):

Axis/VSMap1—Iftrue,startvectorspace.Iffalse,donotstartvectorspace.Axis/VSMap2—Iftrue,startvectorspace.Iffalse,donotstartvectorspace.

Page 245: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheStartMotionVIisusedtostartamotionprofileonaxesorvectorspaces,eithersimultaneouslyorindividually.Astartispreemptiveandusesthemostrecentlyloadedvaluesofacceleration,velocity,targetposition,s-curve,operationmode,andsoontogeneratethemotionprofile.

NoteIfastepperaxisisinakilledstate(notenergized),halttheaxisusingthebeforeyouexecuteaStartMotionorBlendMotionVI.Afteryouhalttheaxis,youmightneedtowaitbeforeexecutingaStartMotionorBlendMotionVI,sothatthestepperdrivecomesoutofresetstate.IfthestepperdrivedoesnotcomeoutofresetstatebeforeyouexecutetheVI,thestepperaxismightlosesomestepsduringacceleration.TodeterminewhetheryouneedtowaitbeforeexecutingtheVI,refertothestepperdrivedocumentationorvendor.

YoualsocanusetheStartMotionVItoupdatetrajectoryparameterstoamovethatisalreadyinprocess.Trajectoryparametersloadedafterthestarttakeeffectimmediatelyuponthenextstartwithoutrequiringthemotiontocometoastop.Youcanusethisfeatureforvelocityprofilingandothercontinuousmotionapplications.Theexecutionofapreemptivestartdependsontheparametersentered,thetypeofmove,andthecontroller.Refertothefollowingtableformoreinformation.

MoveType ControllerType SameDirection

SingleAxisMove73xxController Movestartsimmediately1

NISoftMotionController Movestartsimmediately

VectorSpaceMove73xxController Motiondeceleratestoastop,thenstartsNISoftMotionController Movestartsimmediately

1Inmostcases,themovestartsimmediately.However,ifthenewtargetpositionisclosertothecurrentpositionthantheprevioustargetposition,themovedeceleratestoastop,thenstarts.Refertothefiguresbelowformoreinformation.

2Thetimerequiredtostartthenextmovedependsonthedecelerationtime.Ifthedecelerationtimeisveryslow,thenextmovemaytakelongerthanexpectedtostart.

ThefirstimagedemonstratesthecasewhereStartMotioniscalledwithanewtargetpositiononthesamesideoftheoriginaltargetpositionasthecurrentposition.Inthiscase,motiondeceleratestoastop,thenstartsagain.ThesecondimagedemonstratesthecasewhereStartMotioniscalledwithanewtargetpositionontheoppositesideoftheoriginaltargetpositionasthecurrentposition.Inthiscase,themovecontinuestothenewtargetpositionwithoutstopping.

Page 246: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

TheStartMotionVIisusedtostartamotionprofileonaxesorvectorspaces,eithersimultaneouslyorindividually.Astartispreemptiveandusesthemostrecentlyloadedvaluesofacceleration,velocity,targetposition,s-curve,operationmode,andsoontogeneratethe

Ifastepperaxisisinakilledstate(notenergized),halttheaxisusingtheStopMotionVI,withStopTypesettohaltstop,VI.Afteryouhalttheaxis,youmightneedtowaitbeforeexecutingaStart

MotionorBlendMotionVI,sothatthestepperdrivecomesoutofresetstate.IfthestepperdrivedoesnotcomeoutofresetstatebeforeyouexecutetheVI,thestepperaxismightlosesomestepsduringacceleration.TodeterminewhetheryouneedtowaitbeforeexecutingtheVI,refertothestepperdrivedocumentationorvendor.

YoualsocanusetheStartMotionVItoupdatetrajectoryparameterstoamovethatisalreadyinprocess.Trajectoryparametersloadedafterthestarttakeeffectimmediatelyuponthenextstartwithoutrequiringthemotiontocometoastop.Youcanusethisfeatureforvelocityprofilingandothercontinuousmotionapplications.Theexecutionofapreemptivestartdependsontheparametersentered,thetypeofmove,andthecontroller.Refertothefollowingtableformoreinformation.

SameDirection OppositeDirectionMovestartsimmediately1 Motiondeceleratestoastop,thenstarts2

Movestartsimmediately Motiondeceleratestoastop,thenstarts2

Motiondeceleratestoastop,thenstarts2 Motiondeceleratestoastop,thenstarts2

Movestartsimmediately Motiondeceleratestoastop,thenstarts2

Inmostcases,themovestartsimmediately.However,ifthenewtargetpositionisclosertothecurrentpositionthantheprevioustargetposition,themovedeceleratestoastop,thenstarts.Refertothefiguresbelowformoreinformation.

Thetimerequiredtostartthenextmovedependsonthedecelerationtime.Ifthedecelerationtimeisveryslow,thenextmovemaytake

ThefirstimagedemonstratesthecasewhereStartMotioniscalledwithanewtargetpositiononthesamesideoftheoriginaltargetpositionasthecurrentposition.Inthiscase,motiondeceleratestoastop,thenstartsagain.ThesecondimagedemonstratesthecasewhereStartMotioniscalledwithanewtargetpositionontheoppositesideoftheoriginaltargetpositionasthecurrentposition.Inthiscase,themovecontinuestothenewtargetpositionwithoutstopping.

Page 247: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

StopMotionStopsmotiononasingleaxis,singlevectorspace,multipleaxes,ormultiplevectorspaces.

Threetypesofstopscanbeexecuted:

DeceleratetostopHaltstopKillstop

DetailsRemarks

DeviceCompatibility

StopType(Decel)isthetypeofstoptoexecute,asfollows.

Value Definition0 Decelerate1 Halt2 KillAxis/VSMapisthebitmapofaxesorvectorspacestostop.ItisonlyrequiredwhenmultipleaxesorvectorspacesareselectedwiththeAxisorVectorSpaceparameter.NI-Motionignoresadditionalaxesforcontrollersthatoperatelessthaneightaxes.

Whenstoppingaxes(AxisorVectorSpace=0):

Axis/VSMap1—Iftrue,stopaxis.Iffalse,donotstopaxis.

Page 248: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

ThisVIisusedtostopamotionprofileonaxesorvectorspaces,eithersimultaneouslyorindividually.YoucanexecutethreedifferenttypesofstopswiththeStopMotionVI:deceleratestop,haltstop,andkillstop.

DecelerateStop

Whenadeceleratestopisexecuted(deceleratetostop),theaxis,axes,orvectorspace(s)immediatelybegintofollowthedecelerationportionoftheirtrajectoryprofileascontrolledbypreviouslyloadeddecelerationands-curveparameters.Theactualstoppedpositionisthereforedependentuponthisdecelerationtrajectory.

HaltStop

Incontrast,ahaltstophasthefollowingbehaviordependingonthestateoftheaxis:

Iftheaxisisnotmovingandnotenergized,theaxisisenergized.Iftheaxisisnotmovingandenergized,callingahaltstophasnoeffect.Iftheaxisismoving:

Onservoaxes,fulltorqueisappliedtostopthemotor(s)assoonasthecommandisreceivedbythemotioncontroller.Onstepperaxes,thesteppulsesareceasedasquicklyaspossible.However,itispossiblethattheremaybeasmallamountoffollowingerrorafterhaltingthemove.Thisfollowingerrorwillbecompensatedforwithapull-inmoveduringthenextmove.

Inbothcases,NI-Motionattemptstostopthemotor(s)withanearinfiniterateofdeceleration.ThereisnotrajectoryprofileandmotionisnotcontrolledbypreviouslyloadeddecelerationandS-curveparameters.

NoteForstepperaxesconfiguredforp-commandmode,ensurethattheaxisisnotmovingbeforehaltinganaxisthatwaspreviouslykilledtoavoidpositionerrorbetweenthecontrollerandthedrive.Inthiscase,acalltohaltstopwhiletheaxisismovingresetsyourreferencepositiontoanundefinedlocation,andyoushouldperformaexecutinganothermove.

KillStop

Onservoaxes,akillstopdisablesthecontrolloopandzerostheoutputDAC,allowingfrictionalforcesalonetostopthemotion.Onstepperaxes,akillstopceasesthestepperpulsegenerationassoonasthecommandisreceivedbythemotioncontroller.Onbothaxistypes,thereisnotrajectoryprofileduringakillstop.Ifenabled,theinhibitoutputisactivatedtoinhibit(disable)theservoamplifierorstepperdrive.Youcanenabletheinhibitoutputsandsettheirpolaritytoactivehighoractivelowwiththe

Page 249: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ThisVIisusedtostopamotionprofileonaxesorvectorspaces,eithersimultaneouslyorindividually.YoucanexecutethreedifferenttypesofstopswiththeStopMotionVI:deceleratestop,haltstop,andkillstop.

Whenadeceleratestopisexecuted(deceleratetostop),theaxis,axes,orvectorspace(s)immediatelybegintofollowthedecelerationportionoftheirtrajectoryprofileascontrolledbypreviouslyloadeddecelerationands-curveparameters.Theactualstoppedpositionis

Incontrast,ahaltstophasthefollowingbehaviordependingonthestateoftheaxis:

Iftheaxisisnotmovingandnotenergized,theaxisisenergized.Iftheaxisisnotmovingandenergized,callingahaltstophasnoeffect.

Onservoaxes,fulltorqueisappliedtostopthemotor(s)assoonasthecommandisreceivedbythemotioncontroller.Onstepperaxes,thesteppulsesareceasedasquicklyaspossible.However,itispossiblethattheremaybeasmallamountoffollowingerrorafterhaltingthemove.Thisfollowingerrorwillbecompensatedforwithapull-inmoveduringthenextmove.

Inbothcases,NI-Motionattemptstostopthemotor(s)withanearinfiniterateofdeceleration.ThereisnotrajectoryprofileandmotionisnotcontrolledbypreviouslyloadeddecelerationandS-curveparameters.

Forstepperaxesconfiguredforp-commandmode,ensurethattheaxisisnotmovingbeforehaltinganaxisthatwaspreviouslykilledtoavoidpositionerrorbetweenthecontrollerandthedrive.Inthiscase,acalltohaltstopwhiletheaxisismovingresetsyourreferencepositiontoanundefinedlocation,andyoushouldperformaFindHomereferencemovebefore

Onservoaxes,akillstopdisablesthecontrolloopandzerostheoutputDAC,allowingfrictionalforcesalonetostopthemotion.Onstepperaxes,akillstopceasesthestepperpulsegenerationassoonasthecommandisreceivedbythemotioncontroller.Onbothaxistypes,thereisnotrajectoryprofileduringakillstop.Ifenabled,theinhibitoutputisactivatedtoinhibit(disable)theservoamplifierorstepperdrive.YoucanenabletheinhibitoutputsandsettheirpolaritytoactivehighoractivelowwiththeConfigureInhibitOutputsVI.

Page 250: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

Ifanaxisthatispartofavectorspaceisindividuallykilled,theotheraxesinthevectorspacearedeceleratedtostop.Ifaprogramattemptstostartaxesthathavebeenmanuallystoppedbythehostcomputer,itisoverruledandputintothepausedstate.

NISoftMotionControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

Ifanaxisthatispartofavectorspaceisindividuallykilled,theotheraxesinthevectorspacearealsokilled.YoucanexecutethisVIonlyonanaxisthatisenabled.

Page 251: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

MotionI/OVIsYoucanuseMotionI/OVIstosetupandcontrolthemotionI/OfeaturesoftheNImotioncontroller.MotionI/OVIsincludeVIstosetpolarityandenablelimitandhomeinputs,high-speedcaptureinputsandinhibitoutputs,VIstoconfigureandcontrolbreakpointoutputs,andVIstoreadthestatusofallthemotionI/Osignals,high-speedcapturedposition,andsoftwarelimitstatus.

AllofthededicatedmotionI/Oalsocanfunctionasgeneral-purposedigitalI/Owhentheyarenotbeingusedfortheirmotionspecificfeatures.Youcansetandresetoutputs,youcanreadinputsatanytime,andyoucansetandchangetheirpolarityasrequired.

MotionI/OVIsincludelimitsandotherbasicMotionI/OVIs,BreakpointVIs,andHigh-SpeedCaptureVIs.

ClicktheiconsforVIdescriptions.

EnableLimits SetHomeInputPolarityReadLimitStatus ConfigureDriveSignalSetLimitInputPolarity ReadDriveSignalStatusLoadSoftwareLimitPositions ConfigureInhibitOutputsEnableHomeInputs SetInhibitMOMOReadHomeInputStatus

Page 252: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Subpalettes

BreakpointVIs

High-SpeedCaptureVIs

Page 253: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ConfigureDriveSignalConfiguresthedrivesignal.

Details

DeviceCompatibility

Pinisthespecificbit(0to7)intheportspecifiedbyport.FortheHSCport,trigger1=pin0,trigger2=pin1,trigger3=pin2,trigger4=pin3,trigger5=pin4,trigger6=pin5,trigger7=pin6,andtrigger8=pin7.PortisthegeneralpurposeI/Oport(1to8)orHSCsoftwareport(10)tocontrol.BoardIDisauniquenumberassignedbyMAXusedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Axisistheaxistoconfigure.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroora

Page 254: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

UsethisVItoconfigureandreserveI/Olinestoreceivesignalsfromthedrive.Thefollowingdrivesignalsareavailable:In-PositionandDriveFault(ServoAlarm).

TipUseConfigureMotionI/OMapinsteadofthisVIforadditionaldrivesignalsupport.

UsetheIn-Positiondrivesignalwhenthedriveiscontrollingaservomotorandtheinputtothedriveisstep/direction.Thissignaltellsthemotioncontrollerwhenthedriveconsidersthemotortobeatthecommandedposition.

WhentheIn-Positiondrivesignalisconfigured,theMoveCompletestatusislinkedtothestateoftheIn-Positionsignal.ThemoveisnotconsideredcompleteunlesstheIn-Positionsignalisactive.

NoteRefertoWriteTrajectoryDatatoaddorremovethissignalfromthemovecompletecriteria.

UsetheDriveFaultdrivesignaltoconnectaservoalarmsignaltothemotioncontrollersothatwhenanalarmorotherdrivefaultoccurs,themotionisstoppedusingakillstop.AkillstopdisablesthecontrolloopandzeroestheDACsothatfrictionalforcesstopthemotion.

Page 255: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ConfigureInhibitOutputsSetspolarityandenablestheper-axisinhibitoutputs.

DetailsRemarks

DeviceCompatibility

Enableenables/disablesinhibitoutputontheselectedaxis.DriveModespecifieseitherOpenCollector(default)orTotemPolemode.DriveModeisavailableonlyontheNI7350andisnotconfigurableonNI7330/40/90motioncontrollers.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Axisistheaxistoconfigure.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroora

Page 256: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheConfigureInhibitOutputsVIenables/disablestheinhibitoutputs,setsthePolarity(activeloworactivehigh)oftheaxisinhibitoutputs,andsetstheDriveMode.Whenenabled,aper-axisinhibitoutputislinkedtothemotoroffstateofthecorrespondingaxis.Akilledaxis(motoroff)forcesthecorrespondinginhibitoutputOn.Whentheaxisisactive,theinhibitoutputisOff.Noticethatthisisthelogicalstate.Theactualstatedependsonthepolarityofthesystem.

Inhibitoutputsaretypicallyusedtodisabletheservoamplifierorstepperdriveforpowersaving,safety,orspecificapplicationreasons.

FormoreinformationaboutOpenCollectorandTotemPoledrivemodes,refertotheNI7350HardwareUserManual.ConfiguringDriveModeissupportedonlyon7350controllersandisnotconfigurableonNI7330/40/90motioncontrollers.

NoteKillingaservoaxisalsozerositsDACoutput.Withtorqueblockamplifiers,thismeansthatthemotorfreewheelsregardlessofwhethertheamplifierisdisabled.Withvelocityblockservoamplifiersorstepperdrives,themotordoesnotfreewheelunlesstheamplifier/driveisdisabledwiththeinhibitoutput.

Youalsocanuseinhibitoutputsasgeneral-purposeoutputs.DisabledinhibitoutputsignorethestateoftheircorrespondingaxisandcanbedirectlycontrolledthroughtheSetInhibitMOMOVI.

Youcanconfigurethepolarityofeachinhibitoutputasactiveloworactivehigh.Whenconfiguredasactivelow,theoutputisactivewhenthereisalowsignalontheoutputpin.Conversely,activehighmeansthattheoutputisactivewhenthereisahighsignalontheoutputpin.Theinhibitpolarityisalwaysineffect,whethertheinhibitislinkedtoitsaxis(enabled)ordirectlycontrolledthroughtheSetInhibitMOMOVI.

Page 257: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowingincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

ThePCI-7390doesnotsupportthePolarityparameter.TosettheactivestateonaPCI-7390useWriteDigitalI/OData.

Page 258: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

EnableHomeInputsEnables/disablesthehomeinputs.

Details

DeviceCompatibility

Homes(Disabled)isthebitmapofhomeinputstoenable:Axis1—Iftrue,homeinputisenabled.Iffalse,homeinputisdisabled(default).Axis2—Iftrue,homeinputisenabled.Iffalse,homeinputisdisabled(default).Axis3—Iftrue,homeinputisenabled.Iffalse,homeinputisdisabled(default).Axis4—Iftrue,homeinputisenabled.Iffalse,homeinputisdisabled(default).Axis5—Iftrue,homeinputisenabled.Iffalse,homeinputisdisabled(default).Axis6—Iftrue,homeinputisenabled.Iffalse,homeinputisdisabled(default).Axis7—Iftrue,homeinputisenabled.Iffalse,homeinputisdisabled(default).Axis8—Iftrue,homeinputisenabled.Iffalse,homeinputisdisabled(default).

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.

Page 259: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheEnableHomeInputsVIenables/disablesanycombinationofaxishomeinputs.Anenabledhomeinputcausesahaltstopontheaxiswhentheinputbecomesactive.YoucanconfigureeachhomeinputasactiveloworactivehighwiththeSetHomeInputPolarityVI.Youalsocanuseahomeinputasageneral-purposeinputandreaditsstatuswiththeReadHomeInputStatusVI.

HomeinputsareanenhancementontheNImotioncontrollerandarenotrequiredforbasicmotioncontrol.YoucanoperateallmotioncontrolVIswithoutenablingorusingthehomeinputsexcepttheFindReferenceVI,whichrequiresenabledlimitandhomeinputsforoperationwhentheFindReferencetypeis"home."

ToconfigurethepropertyofFindReferenceHome,suchasInitialsearchdirectionandHomeedgetostopon,usetheLoadReferenceParameterVI.

NoteAnactiveandenabledhomeinputtransitiononanaxisthatispartofavectorspacemovecausesthataxistohaltstopandtheotheraxesinthevectorspacetodeceleratetoastop.

Example

Toenablethehomeinputsforaxes2and4,calltheEnableHomeInputsVIwithHomes,asfollows.

Home1 Home2 Home3 Home4 Home5 Home6 Home7 Home8False True False True False False False False

Page 260: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

EnableLimitsEnables/disableseithertheforwardandreverselimitinputsortheforwardandreversesoftwarepositionlimits.

DetailsRemarks

DeviceCompatibility

LimitType(LimitInputs)selectsthetypeoflimittoenable,eitherthehardwarelimitswitchinputsorthesoftwarepositionlimits,asfollows.

Value Definition0 Limitinputs1 SoftwarelimitsBoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,

Page 261: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheEnableLimitsVIenables/disablesanycombinationofaxislimits.Youcanenablethephysicallimitinputs(hardware)orthelogicalpositionlimits(software)dependingupontheLimitTypeselected.Youcanenableordisableforwardandreverselimitsseparately.Toenablebothsoftwareandhardwarelimitsonanaxisoraxes,callthisVItwice.

Thelimitinputsaretypicallyconnectedtoend-of-travellimitswitchesorsensors.Anenabledlimitinputcausesahaltstopontheaxiswhentheinputbecomesactive.YoucanconfigureeachlimitinputasactiveloworactivehighwiththeSetLimitInputPolarityActivelimitinputsalsoprohibitattemptstostartmotionthatwouldcauseadditionaltravelinthedirectionofthelimit.Youalsocanuselimitinputsasgeneral-purposeinputsandreadtheirstatuswiththeReadLimitStatusVI.

NoteFortheend-of-travellimitstofunctioncorrectly,theforwardlimitswitchorsensormustbelocatedatthepositive(countup)endoftravelandthereverselimitatthenegative(countdown)endoftravel.

Similarly,softwarelimitsareoftenusedtorestricttherangeoftravelfurtherandavoideverhittingthehardwarelimitswitches.Anenabledsoftwarelimitcausestheaxistosmoothlydeceleratetoastopwhenthelimitpositionisreachedorexceeded.Toenablethesoftwarelimits,youmustfirstfindthereferencepointusingtheFindReferenceVI.

Evenwhendisabled,youcanusethehostcomputertopollthesoftwarelimitstowarnofanout-of-rangeposition.RefertotheLoadSoftwareLimitPositionsandtheReadLimitStatusVIsforinformationaboutloadingandreadingtheforwardandreversesoftwarelimits.

HardwarelimitinputsandsoftwarepositionlimitsareenhancementsontheNImotioncontrollerandarenotrequiredforbasicmotioncontrol.YoucanoperateallmotioncontrolVIswithoutenablingorusingtheselimitsexcepttheFindReferenceVI,whichrequiresenabledlimitandhomeinputsforoperation.RefertothefollowingVIsformoreinformationaboutenablinghomeinputs:SetHomeInputPolarity,EnableHomeInputsandReadHomeInputStatus.

Example

Page 262: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheEnableLimitsVIenables/disablesanycombinationofaxislimits.Youcanenablethephysicallimitinputs(hardware)orthelogicalpositionlimits(software)dependingupontheLimitTypeselected.Youcanenableordisableforwardandreverselimitsseparately.Toenablebothsoftwareandhardwarelimitsonanaxisoraxes,callthisVItwice.

Thelimitinputsaretypicallyconnectedtoend-of-travellimitswitchesorsensors.Anenabledlimitinputcausesahaltstopontheaxiswhentheinputbecomesactive.YoucanconfigureeachlimitinputasactiveloworactivehighwiththeSetLimitInputPolarityVI.Activelimitinputsalsoprohibitattemptstostartmotionthatwouldcauseadditionaltravelinthedirectionofthelimit.Youalsocanuselimitinputsasgeneral-purposeinputsandreadtheirstatuswiththeReadLimitStatusVI.

Fortheend-of-travellimitstofunctioncorrectly,theforwardlimitswitchorsensormustbelocatedatthepositive(countup)endoftravelandthereverselimitatthenegative(countdown)endoftravel.

Similarly,softwarelimitsareoftenusedtorestricttherangeoftravelfurtherandavoideverhittingthehardwarelimitswitches.Anenabledsoftwarelimitcausestheaxistosmoothlydeceleratetoastopwhenthelimitpositionisreachedorexceeded.Toenablethesoftwarelimits,youmustfirstfindthereferencepointusingtheFindReferenceVI.

Evenwhendisabled,youcanusethehostcomputertopollthesoftwarelimitstowarnofanout-of-rangeposition.RefertotheLoadSoftwareLimitPositionsandtheReadLimitStatusVIsforinformationaboutloadingandreadingtheforwardandreversesoftwarelimits.

HardwarelimitinputsandsoftwarepositionlimitsareenhancementsontheNImotioncontrollerandarenotrequiredforbasicmotioncontrol.YoucanoperateallmotioncontrolVIswithoutenablingorusingtheselimitsexcepttheFindReferenceVI,whichrequiresenabledlimitandhomeinputsforoperation.RefertothefollowingVIsformoreinformationaboutenablinghomeinputs:SetHomeInputPolarity,EnableHomeInputs,

ReadHomeInputStatus.

Page 263: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

Anactive(andenabled)limitinputtransitiononanaxisthatispartofavectorspacemovecausesthataxistohaltstopandtheotheraxesinthevectorspacetodeceleratetoastop.Ifanyaxisinavectorspacemoveexceedsanenabledsoftwarelimitposition,allaxesinthevectorspacedeceleratetoastop.

NISoftMotionControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

Anactive(andenabled)limitonanaxisthatispartofavectorspacecausesalloftheaxesinthevectorspacetohaltstop.

Page 264: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadSoftwareLimitPositionsLoadstheforwardandreversesoftwarelimitpositionsforanaxis.

Details

DeviceCompatibility

ReverseSWLimitisthereversesoftwarelimitpositionincounts(servoaxes)orsteps(stepperaxes).Softwarelimitpositionscanbeanywherewithinthe32-bitpositionrange,–(231)to+(231–1).Thedefaultvalueforthereversesoftwarelimitis–(230)counts(steps).

NoteTheForwardSWLimitcannotbelessthantheReverseSWLimit.

ForwardSWLimitistheforwardsoftwarelimitpositionincounts(servoaxes)orsteps(stepperaxes).Softwarelimitpositionscanbeanywherewithinthe32-bitpositionrange,–(231)to+(231–1).Thedefaultvaluefortheforwardsoftwarelimitis+(230)–1counts(steps).BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Axisistheaxistocontrol.InpVectindicatesthesourceofthedataforthisVI.Availableinputvectorsincludeimmediate(0xFF),variable(0x01through0x78),orindirectvariable(0x81through0xF8).RefertoInputandReturnVectorsformoredetailedinformation.

Page 265: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheLoadSoftwareLimitPositionsVIsetstheforwardandreversepositionlimitvaluesfortheselectedaxis.WhenenabledwiththeEnableLimitsVI,asoftwarelimitcausestheaxistosmoothlydeceleratetoastopwhenthelimitpositionisreachedorexceeded.

Evenwhendisabled,youcanpollthesoftwarelimitsbythehostcomputeroruseanonboardprogramtowarnofanoutofrangeposition.RefertotheReadLimitStatusVIforinformationaboutreadingthesoftwarelimitstatus.

Theforwardsoftwarelimitisconsideredactiveifthecurrentpositionisgreaterthanorequaltotheforwardsoftwarelimitposition.Thereversesoftwarelimitisconsideredactiveifthecurrentpositionislessthanorequaltothereversesoftwarelimitposition.

Softwarelimitsareoftenusedtorestricttherangeoftravelandavoidhittingthehardwareend-of-travellimitswitches.Forexample,youcantravelatahighvelocityuntilhittingthesoftwarelimitswitch,andthenmovemoreslowlyuntilhittingthehardwarelimitswitch.

CautionAfteranaxishasstoppedduetoencounteringasoftwarelimitswitch,youcanstillmovefurtherinthesamedirectionifyoucommandtheaxistodoso.Thisbehaviorisnotpossiblewithhardwarelimits,butisappropriateforsoftwarelimits.NoteIfyouaredoingonboardprogrammingandareusingInpVecttogetthedatathisVIneeds,rememberthatthisVIreadsthevariablesstartingatthememoryaddresspointedtobyInpVectinthefollowingorder:ForwardSWLimit,ReverseSWLimit.

Page 266: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadDriveSignalStatusReturnsthestatusofthedrivesignalwhenanactivesignalisdetected.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMAXusedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Axisistheaxistoconfigure.RetVectisthedestinationforthereturndata.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.Typically,sourceisthenameoftheVIinwhichtheerroroccurred.

Page 267: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

UsethisVItoreadthestatusofthedrivesignalwhenanactivedrivesignalisdetected.IfIn-Positionisactive,bit0=True.IfDriveFaultisactive,bit1=True.

TipUseReadMotionI/ODatainsteadofthisVIformoreoptions.

Page 268: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadEncoderPositionReadsthepositionofanencoder.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisorEncoderistheaxisorencodertoread.RetnVectindicatesthedestinationforthereturndatageneratedbythisVI.Availablereturnvectorsincludereturndatatothehost(0xFF),toavariable(0x01through0x78),toanindirectvariable(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroora

Page 269: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheReadEncoderPositionVIreturnsthequadraturecountvalueoftheencoderselected.Theencodermustbeenabled,eitherdirectlythroughtheEnableEncodersVIorautomatically,bybeingmappedtoanenabledaxis.

TheReadEncoderPositionVIistypicallyusedtoreadthevalueofanencoderthatisnotpartofanaxis.Thisencodercouldbeamasterencoderusedformaster-slavegearingoranindependentpositionorvelocitysensor.

Forreadingencodersmappedtoaxes,youcancallthisVIontheaxisordirectlyonitsmappedencoder.Forservoaxes,bothapproachesreturnthesamevalueastheReadPositionVI.Onstepperaxeshowever,thisVIcanreturnadditionalusefulinformation.

Duringaxissetup,youcanoperatetheclosed-loopstepperaxisinopen-loopmodeandusethisVItodirectlymeasurethecountsperrevolutionandstepsperrevolutionfortheaxis.Thesevaluesmustbeloadedinadvanceforsubsequentclosed-loopoperation.RefertotheLoadCounts/StepsperRevolutionVIformoreinformation.

YoualsocanusethisVItoreturnafinerreadingofpositionincaseswheretheencoderresolutiongreatlyexceedsthestepresolutionoftheclosed-loopstepperaxis.

Page 270: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadHomeInputStatusReadstheinstantaneousstatusofthehomeinputs.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.RetVectindicatesthedestinationforthereturndatageneratedbythisVI.Availablereturnvectorsincludereturndatatothehost(0xFF),returndatatoavariable(0x01through0x78),returndatatoanindirectvariable(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningof

Page 271: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheReadHomeInputStatusVIreturnsthelogicalstateofthehomeinputs.YoucanexecutethisVIatanytimetomonitorthehomeinputs,whethertheyareenabledornot.AhomeinputenabledwiththeEnableHomeInputsVIcausesahaltstoponanaxiswhenitshomeinputbecomesactive(True).Youalsocanuseahomeinputasageneral-purposeinputandreaditsstatuswiththisVI.ThehomeinputstatusduringaFindReferencemoveisundefined.

Todeterminethehomefoundstatus,useReadReferenceStatusandsetthereferencetypeto"home".

NoteThisVIreturnsundefinedvaluesforaxesthatarecurrentlyperformingfindreferencemoves.NoteThisVIreadsthelogicalstate(OnorOff,TrueorFalse)ofthehomeinputs.ThepolarityofthehomeinputsdetermineswhetheranOnstateisactivehighoractivelow.RefertotheSetHomeInputPolarityVIformoreinformation.

Page 272: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadLimitStatusReadstheinstantaneousstateofeitherthehardwarelimitinputsorthesoftwarelimits.

Details

DeviceCompatibility

LimitType(LimitInputs)selectsthetypeoflimitstatustoread,eitherthehardwarelimitswitchinputsorthesoftwarepositionlimits,asfollows.

Value Definition0 Limitinputs1 SoftwarelimitsBoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.RetVectcontainsthereverselimitsandforwardlimits,whicharereturnedinoneonboardvariable:0000000FFFFFFFF00000000RRRRRRRR0.

Availablereturnvectorsincludereturndatatothehost(0xFF),returndatatoavariable(0x01through0x78),returndatatoanindirectvariable(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralready

Page 273: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheReadLimitStatusVIreturnseitherthehardwarelimitinputstatusorthesoftwarepositionlimitstatus,dependingonthelimittypeselected.WhenLimitType=LimitInputs(0),thisVIreturnsthelogicalstateoftheforwardandreverselimitinputs.

NoteThisVIreturnsundefinedvaluesforaxesthatarecurrentlyperformingfindreferencemoves.NoteThepolarityofthelimitinputsdetermineswhetheranOnstateisactivehighoractivelow.RefertotheSetLimitInputPolarityVIformoreinformation.

Alternatively,whenLimitType=SoftwareLimits(1),thisVIreturnsthestateoftheforwardandreversesoftwarelimits.ATrue(On)indicatesthattheforwardorreverselimitpositionforthecorrespondingaxishasbeenreachedorexceeded.ThelimitstatusduringaFindReferencemoveisundefined.

Youcanreadthestatusofthelimitinputsandthesoftwarepositionlimitsatanytime,whetherthelimitsareenabledornot.EnabledlimitscauseaxestostopwhentheirstatetransitionsTrue.RefertotheEnableLimitsVIformoreinformation.

NoteIfyouaredoingonboardprogrammingandareusingRetnVecttowritedata,thisVIwritesthevariablesstartingatthememoryaddresspointedtobyRetnVectinthefollowingorder:ForwardLimits,ReverseLimits.

Page 274: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

SetHomeInputPolaritySetsthepolarityofthehomeinputsaseitheractivelow/activeopenoractivehigh/activeclosed.

Details

DeviceCompatibility

HomePolarityisthebitmapofactivepolaritiesforthehomeinputs:Axis1—IfTRUE,activelow/activeopen(default).IfFALSE,activehigh/activeclosed.Axis2—IfTRUE,activelow/activeopen(default).IfFALSE,activehigh/activeclosed.Axis3—IfTRUE,activelow/activeopen(default).IfFALSE,activehigh/activeclosed.Axis4—IfTRUE,activelow/activeopen(default).IfFALSE,activehigh/activeclosed.Axis5—IfTRUE,activelow/activeopen(default).IfFALSE,activehigh/activeclosed.Axis6—IfTRUE,activelow/activeopen(default).IfFALSE,activehigh/activeclosed.Axis7—IfTRUE,activelow/activeopen(default).IfFALSE,activehigh/activeclosed.Axis8—IfTRUE,activelow/activeopen(default).IfFALSE,activehigh/activeclosed.

BoardIDisauniquenumberassignedbyMeasurement&Automation

Page 275: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheSetHomeInputPolarityVIdefinestheactivestateforeachhomeinputaseitheractivelow/activeopenoractivehigh/activeclosed.

Whenconfiguredasactivelow,theinputisactivewhenthereisalowsignalontheinputpin.Conversely,activehighmeansthattheinputisactivewhenthereisahighsignalontheinputpin.

Configuringanactivestateofactiveopenoractivecloseddoesnotcorrespondtothelevelofthesignalontheinputpin.Instead,anactiveopenstatemeansthattheinputisactivewhencurrentisnotflowingthroughtheoptocoupledinput.Conversely,anactiveclosedstatemeansthattheinputisactivewhencurrentisflowingthroughtheoptocoupledinput.

YoucanenablehomeinputstocausehaltstopswhentheinputbecomesactivewiththeEnableHomeInputsVI.Youalsocanuseahomeinputasageneral-purposeinputandreaditsstatuswiththeReadHomeInputStatusVI.

Tofindthehomeinputreferenceonasystem,useFindReferenceandconfigurethesearchtypeas"home".

Example

Tosettheactivestateofthehomeinputsonaxes1,3and4asactivelowandtherestofthehomeinputsasactivehigh,calltheSetHomeInputPolarityVIwithHomePolarityasfollows.

Home1 Home2 Home3 Home4 Home5 Home6 Home7 Home8True False True True False False False False

Page 276: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

SetInhibitMOMOSetstheinhibitoutputsusingtheMustOn/MustOffprotocol.

Details

DeviceCompatibility

MustOff(False)isthebitmapofinhibitoutputstoforceoff:InhibitOutput1—Iftrue,inhibitoutputforcedoff.Iffalse,inhibitoutputunchanged(default).InhibitOutput2—Iftrue,inhibitoutputforcedoff.Iffalse,inhibitoutputunchanged(default).InhibitOutput3—Iftrue,inhibitoutputforcedoff.Iffalse,inhibitoutputunchanged(default).InhibitOutput4—Iftrue,inhibitoutputforcedoff.Iffalse,inhibitoutputunchanged(default).InhibitOutput5—Iftrue,inhibitoutputforcedoff.Iffalse,inhibitoutputunchanged(default).InhibitOutput6—Iftrue,inhibitoutputforcedoff.Iffalse,inhibitoutputunchanged(default).InhibitOutput7—Iftrue,inhibitoutputforcedoff.Iffalse,inhibitoutputunchanged(default).InhibitOutput8—Iftrue,inhibitoutputforcedoff.Iffalse,inhibitoutputunchanged(default).

MustOn(False)isthebitmapofinhibitoutputstoforceon:InhibitOutput1—Iftrue,inhibitoutputforcedon.Iffalse,inhibit

Page 277: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheSetInhibitMOMOVIcontrolsdisabledinhibitoutputsbeingusedasgeneral-purposeoutputs.YoucandirectlysettheinhibitoutputstoalogicalOnorOffstate.

NoteThisVIhasnoeffectonenabledinhibitoutputs.Theseoutputsaredirectlycontrolledbytheircorrespondingaxes.

UsingtheMustOn/MustOffprotocolallowsyoutosetorresetindividualinhibitoutputswithoutaffectingtheotherinhibitoutputs.Thisgivesyoutri-statecontrolovereachoutput:On,Off,orUnchanged.ATrueinalocationoftheMustOnbitmapturnstheinhibitOn,whileaTrueinthecorrespondinglocationoftheMustOffbitmapturnstheinhibitOff.AFalseineitherbitmaphasnoaffect,soleavingboththeMustOnandMustOffatFalseiseffectivelyahold,andthestateoftheinhibitoutputisunchanged.IfyousetboththeMustOnandMustOffbitstoTrue,itisinterpretedasaMustOnconditionandtheinhibitisturnedOn.

MustOn–>MustOff 1 0

1 On Off0 On Unchanged

NoteThisVIsetsthelogicalstateofaninhibitoutputOnorOff(TrueorFalse).ThepolarityoftheinhibitoutputsdeterminewhetheranOnstateisactivehighoractivelow.RefertotheConfigureInhibitOutputsVIformoreinformation.

TheSetInhibitMOMOVIallowsindividualcontroloftheinhibitoutputswithoutrequiringashadowvaluetorememberthestateofotheroutputsnotbeingsetorresetwiththeVI.

Example

Toturninhibitoutput1On,output4off,andleavetheotherinhibitoutputsunchanged,calltheSetInhibitMOMOVIwiththefollowingparameters:

MustOncorrespondstothefollowing:

MustOn1 MustOn2 MustOn3 MustOn4 MustOn5 MustOn6 MustOn7

Page 278: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheSetInhibitMOMOVIcontrolsdisabledinhibitoutputsbeingusedasgeneral-purposeoutputs.YoucandirectlysettheinhibitoutputstoalogicalOnorOffstate.

ThisVIhasnoeffectonenabledinhibitoutputs.Theseoutputsaredirectlycontrolledbytheircorrespondingaxes.

UsingtheMustOn/MustOffprotocolallowsyoutosetorresetindividualinhibitoutputswithoutaffectingtheotherinhibitoutputs.Thisgivesyoutri-statecontrolovereachoutput:On,Off,orUnchanged.ATrueinalocationoftheMustOnbitmapturnstheinhibitOn,whileaTrueinthecorrespondinglocationoftheMustOffbitmapturnstheinhibitOff.AFalseineitherbitmaphasnoaffect,soleavingboththeMustOnandMustOffatFalseiseffectivelyahold,andthestateoftheinhibitoutputisunchanged.IfyousetboththeMustOnandMustOffbitstoTrue,itis

MustOnconditionandtheinhibitisturnedOn.

1 0

On OffOn Unchanged

ThisVIsetsthelogicalstateofaninhibitoutputOnorOff(TrueorFalse).ThepolarityoftheinhibitoutputsdeterminewhetheranOnstateisactivehighoractivelow.

ConfigureInhibitOutputsVIformoreinformation.

TheSetInhibitMOMOVIallowsindividualcontroloftheinhibitoutputswithoutrequiringashadowvaluetorememberthestateofotheroutputsnotbeingsetorresetwiththeVI.

Toturninhibitoutput1On,output4off,andleavetheotherinhibitoutputsunchanged,calltheSetInhibitMOMOVIwiththefollowingparameters:

correspondstothefollowing:

MustOn2 MustOn3 MustOn4 MustOn5 MustOn6 MustOn7 MustOn8

Page 279: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

SetLimitInputPolaritySetsthepolarityoftheforwardandreverselimitinputsaseitheractivelow/activeopenoractivehigh/activeclosed.

Details

DeviceCompatibility

ReverseLimitPolarityisthebitmapofactivepolaritiesforthereverselimitinputs:

Axis1—IfTRUE(default),activelow/activeopen.IfFALSE,activehigh/activeclosed.Axis2—IfTRUE(default),activelow/activeopen.IfFALSE,activehigh/activeclosed.Axis3—IfTRUE(default),activelow/activeopen.IfFALSE,activehigh/activeclosed.Axis4—IfTRUE(default),activelow/activeopen.IfFALSE,activehigh/activeclosed.Axis5—IfTRUE(default),activelow/activeopen.IfFALSE,activehigh/activeclosed.Axis6—IfTRUE(default),activelow/activeopen.IfFALSE,activehigh/activeclosed.Axis7—IfTRUE(default),activelow/activeopen.IfFALSE,activehigh/activeclosed.Axis8—IfTRUE(default),activelow/activeopen.IfFALSE,active

Page 280: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheSetLimitInputPolarityVIdefinestheactivestateforeachforwardandreverselimitinputaseitheractivelow/activeopenoractivehigh/activeclosed.

Whenconfiguredasactivelow,theinputisactivewhenthereisalowsignalontheinputpin.Conversely,activehighmeansthattheinputisactivewhenthereisahighsignalontheinputpin.

Configuringanactivestateofactiveopenoractivecloseddoesnotcorrespondtothelevelofthesignalontheinputpin.Instead,anactiveopenstatemeansthattheinputisactivewhencurrentisnotflowingthroughtheoptocoupledinput.Conversely,anactiveclosedstatemeansthattheinputisactivewhencurrentisflowingthroughtheoptocoupledinput.

YoucanenablelimitinputstocausehaltstopswhentheinputbecomesactivewiththeEnableLimitsVI.Youalsocanusealimitinputasageneral-purposeinputandreaditsstatuswiththeReadLimitStatusVI.

Example

Tosettheactivestateoftheforwardandreverselimitinputsonaxes1,2,3,and4asactivelowandtheforwardandreverselimitinputsontheremainingaxesasactivehigh,calltheSetLimitInputPolarityVIwiththefollowingparameters:

ForwardLimitPolaritycorrespondstothefollowing.

Forward1

Forward2

Forward3

Forward4

Forward5

Forward6

Forward7

Forward8

True True True True False False False False

ReverseLimitPolaritycorrespondstothefollowing.

Reverse1

Reverse2

Reverse3

Reverse4

Reverse5

Reverse6

Reverse7

Reverse8

Page 281: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

BreakpointVIsPositionbreakpointsareanenhancementtotheencoderdecodersontheNImotioncontrollerandareavailablewhentheencodersoperateasaxisfeedbackorasindependentencoderresources.Breakpointfunctionalityisavailableonservoandclosed-loopstepperaxes.YoucanuseBreakpointVIstoconfigure,enable,andreadthepositionbreakpointstatus.AdvancedVIs,suchasperiodicbreakpointandbufferedbreakpointcanbeusedtoachievehigher-frequencybreakpoints.Toconfigurebuffersforbufferedbreakpoints,refertoBufferVIs.Youalsocanloadabreakpointpositionmodulus.LikeallmotionI/O,breakpointoutputsalsocanfunctionasgeneral-purposeoutputswiththeSetBreakpointOutputMOMOVI.

NoteAllbreakpointscanbeaffectedbyjitterinthemotionsystem.Forexample,ifyouhavebreakpointpositionsveryclosetoeachother,thejitterinthemotionsystemcouldcausethepositiontochangeenoughtoreachthebreakpointwhenabreakpointisnotintended.IncreasethevalueofthebreakpointwindowusingSetu32tocompensateforsystemjitter.

Refertothefollowingtableforthemaximumbreakpointratesforeachtypeofbreakpoint.Notallbreakpointsareavailableonallcontrollers.

BreakpointType MaximumFrequencySingle 150HzBuffered,PIDrateof62.5µsto250µs 2kHz

Buffered,PIDrategreaterthan250µs 1kHz

Periodic 4MHz

ClicktheiconsforVIdescriptions.

Page 282: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ConfigureBreakpoint

LoadBreakpointPosition

EnableBreakpointOutput

ReadBreakpointStatus

ConfigureBreakpointOutput

SetBreakpointOutputMOMO

LoadBreakpointModulus

Page 283: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ConfigureBreakpointConfiguresapositionbreakpointonanaxisorencoder.

Details

DeviceCompatibility

Operation(Single)selectsbetweensingleandbufferedbreakpointoperation.ValidvaluesareSINGLEandBUFFEREDoperation.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisorEncoderistheaxisorencodertocontrol.YoucanloadBreakpointPositiononencodersmappedtoaxes1through8ordirectlyonencoders0x21through0x28.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroora

Page 284: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheConfigureBreakpointVIconfiguresthebreakpointtotheappropriatemode,operation,andaction.Italsodefinestheactiontoperformwhenthebreakpointisreached—leavethebreakpointoutputunchanged,resetthebreakpointoutputtolow,setthebreakpointoutputtohigh,ortogglethestateofbreakpointoutput.RefertotheSynchronizationsectionoftheNI-MotionHelpformoreinformationaboutthetypesofbreakpointsyoucanconfigure.

NoteFormodulobreakpoints,themagnitudeofthebreakpointvaluemustbelessthanthebreakpointmodulus.Ifthisrangeisexceeded,amodalerrorisgeneratedwhenyouexecutetheEnableBreakpointOutputVI.

Enablemodedetermineshowthepreviouslyloadedbreakpointpositionisinterpreted.Absolutebreakpointscanbeanywhereinthe32-bitpositionrange.Relativebreakpointsarerelativetotheinstantaneousencoderpositionwhenthebreakpointisenabled.Modulobreakpointsareinterpretedwithintherangeoftheloadedbreakpointmodulus.Formoreinformationaboutmodulobreakpoints,refertotheLoadBreakpointModulusVI.

Whenanenabledbreakpointisreached,abreakpointeventoccurs.YoucanusetheReadBreakpointStatusVItoseeifabreakpointhasoccurred.

Abreakpointeventalsocancausethestateofthecorrespondingbreakpointoutputtochange.ActionOnBreakpointselectswhethertheoutputgoeslow,goeshigh,togglesstate,ordoesnotchangewhenthebreakpointeventoccurs.IfthebreakpointoutputispresentlyinthestatedefinedbyActionOnBreakpoint,itisforcedtotheoppositestatewhenthebreakpointisenabled.Thisguaranteesthattheappropriatetransitionoccurswhenthebreakpointisreached.

NoteNI-Motiondoesnotsupportbreakpointandhigh-speedcapturefunctionalityonanaxiswhentheprimaryfeedbackforthataxisisusedasanalogfeedback.

Absolute

Page 285: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ConfigureBreakpointOutputConfiguresthedrivemodeandpolarityofthebreakpointoutput.

DeviceCompatibility

Details

DriveModespecifieseitherOpenCollectororTotemPolemode.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisorEncoderistheaxisorencodertoconfigure.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroora

Page 286: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

UsetheConfigureBreakpointOutputVItoconfiguretheDriveModeandPolarityofthebreakpointsignal.CallthisVIatthebeginningoftheapplicationbeforeenablingthebreakpointwiththeEnableBreakpointOutputVI.

FormoreinformationaboutOpenCollectorandTotemPoledrivemodes,refertothedocumentationforyour7350device.ConfiguringDriveModeissupportedonlyon7350controllers.

Youcanconfigurebreakpointoutputasactiveloworactivehigh.Whenconfiguredasactivelow,theoutputisactivewhenthereisalowsignalontheoutputpin.Conversely,activehighmeansthattheoutputisactivewhenthereisahighsignalontheoutputpin.

Page 287: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

EnableBreakpointOutputEnablesapositionbreakpointonanaxisorencoder.

Details

DeviceCompatibility

EnableBreakpointindicateswhethertoenableordisablethebreakpointoutput.ValuesareTrueorFalse.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisorEncoderistheaxisorencodertocontrol.YoucanloadBreakpointPositiononencodersmappedtoaxes1through6ordirectlyonencoders0x21through0x24.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,

Page 288: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

ThisVIenablesordisablesthebreakpointwithconfigurationsetbytheConfigureBreakpointVI.Forsinglebreakpoints,youmustre-enableifyouwantanotherbreakpoint.Bufferedandperiodicbreakpointsonlyneedtobeenabledonce.Whenanenabledbreakpointisreached,abreakpointeventoccurs.YoucanusetheReadBreakpointStatusVItoseeifabreakpointhasoccurred.

Youcanenableonlyonebreakpointperencoderoraxisatatime.Whenanenabledbreakpointisreached,thebreakpointisautomaticallydisabled.Youmustexplicitlyre-enablethebreakpointtouseitagain.Ifyouneedtodisableapreviouslyenabledbreakpoint,runthisVIwithEnableBreakpointsettoFalse.

NoteEnabledbreakpointsarealsoautomaticallydisabledwhenyouexecuteaResetPositionorResetEncoderPositionVIonthecorrespondingaxis.

Breakpointsarefullyfunctionalonindependentencodersthatarenotmappedtoaxes.Inthiscase,youenablebreakpointsdirectlyontheencoderresource.

NoteIfyouusemodulusbreakpointsorenablethesamebreakpointrepeatedlyatlowvelocity(<50counts/sec),youmaygetabreakpointoutputimmediatelyafteryoure-enableit,becausethepositionmaynothavechangedfromthelastbreakpoint.

Toavoidthisproblem,useMAXortheSetu32VItochangethebreakpointwindow.Thebreakpointwindowisabufferaroundthebreakpointpositioninwhichabreakpointisnotenabledwhilethecurrentpositionremainsinsidethebuffer.NoteAllbreakpointscanbeaffectedbyjitterinthemotionsystem.Forexample,ifyouhavebreakpointpositionsveryclosetoeachother,thejitterinthemotionsystemcouldcausethepositiontochangeenoughtoreachthebreakpointwhenabreakpointisnotintended.IncreasethevalueofthebreakpointwindowusingSetu32tocompensateforsystemjitter.

Page 289: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadBreakpointModulusLoadthebreakpointmodulusforapositionbreakpoint.

Details

DeviceCompatibility

BreakpointModulus(0)istheperiod,forperiodicbreakpoints,orthemodulus,formodulusbreakpoints.Therangeforperiodis1to215–1.Therangeformodulusis0to231–1.Amodulusvalueof0makesamodulusbreakpointbehavethesameasanabsolutebreakpointon7330/40/90controllers.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisorEncoderistheaxisorencodertocontrol.YoucanloadBreakpointPositiononencodersmappedtoaxes1through6ordirectlyonencoders0x21through0x24.InpVectindicatesthesourceofthedataforthisVI.Availableinputvectorsincludeimmediate(0xFF),variable(0x01through0x78),orindirectvariable(0x81through0xF8).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassesthe

Page 290: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

ThisVIloadsapositionmodulus/period,dependingonthebreakpointmode.Thisvalueisdouble-bufferedinthecontrolleranddoesnottakeeffectuntilyouexecutetheEnableBreakpointOutputVI.

Modulobreakpointsareusedinapplicationsthatrequirerepetitive,equallyspacedbreakpoints.Whenusingabreakpointmodulus,itisnolongernecessarytoloadeverincreasing(ordecreasing)breakpointpositions.Itisstillnecessary,however,tore-enablethebreakpointaftereachuse.

NoteForclosed-loopsteppersystemsinwhichtheencodercounts-per-revolutiondiffersfromthesteps-per-revolution,thebreakpointpositionisloadedinencodercounts.

Whenyouenableamodulobreakpoint,twobreakpointpositions,oneinfrontandonebehindthepresentencoderposition,areenabled.

NoteIfyouusemodulusbreakpointorenablethesamebreakpointrepeatedlyatlowvelocity(<50counts/sec),youmaygetabreakpointoutputimmediatelyafteryoure-enableit,becausethebreakpointisre-enabledbeforeyouhavemovedfromthepreviousbreakpointposition.

Toavoidthisproblem,useMAXortheSetu32VItochangethebreakpointwindow.Thebreakpointwindowisabufferaroundthebreakpointpositioninwhichabreakpointisnotenabledwhilethecurrentpositionremainsinsidethebuffer.

Example

Anapplicationrequiresbreakpointsevery2,000countsoffsetat-500counts:...–4,500,–2,500,–500,1,500,3,500,andsoon.Toaccomplishthis,youloadabreakpointpositionof-500withtheLoadBreakpointPositionVIandabreakpointmodulusof2,000.Iftheinstantaneousencoderpositionis2,210countswhenyouexecutetheEnableBreakpointOutputVI(inmodulomode),

Page 291: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadBreakpointPositionLoadsthebreakpointpositionforanaxisorencoderincounts.

Details

DeviceCompatibility

BreakpointPosition(0)isthebreakpointpositioninquadraturecounts.Breakpointpositionscanbeanywherewithinthe32-bitpositionrange,–(231)to+(231)–1.Thedefaultvalueiszero(0).BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisorEncoderistheaxisorencodertocontrol.YoucanloadBreakpointPositiononencodersmappedtoaxes1through8ordirectlyonencoders0x21through0x28.InpVectindicatesthesourceofthedataforthisVI.Availableinputvectorsincludeimmediate(0xFF),variable(0x01through0x78),orindirectvariable(0x81through0xF8).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

Page 292: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheLoadBreakpointPositionVIloadsthebreakpointpositionvaluefortheaxisorencoderspecified.Thebreakpointpositionisinterpreteddifferentlydependingonthebreakpointmodeandtheencoderpositionwhenthebreakpointisenabled.Youcanspecifypositionbreakpointsaseitherabsolute,relative,orwithrespecttoamodulusrangewhenthebreakpointisenabled.Breakpointpositionisdouble-bufferedandnotactuallyuseduntilyouexecutetheEnableBreakpointOutputVI.

NoteFormodulobreakpoints,themagnitudeofthebreakpointvaluemustbelessthanthebreakpointmodulus.Ifthisrangeisexceeded,amodalerrorisgeneratedwhenyouexecutetheEnableBreakpointOutputVI.NoteToloadbreakpointpositionsforbufferedbreakpoints,refertotheWriteBufferVI.TheLoadBreakpointPositionVIdoesnothaveanyaffectonbufferedbreakpoints.

Whenthebreakpointpositionisreached,abreakpointeventisgeneratedandtheassociatedhigh-speedbreakpointoutputimmediatelytransitions.

High-speedbreakpointfunctionalityisperformedbytheencoderresourcesthemselves.WhenthisVIissenttoanaxis,itisactuallybeingsenttothemappedencoderresource.

Whenthesamebreakpointpositionisusedonarepetitivebasis,itisnotnecessarytoreloadthepositioneachtime.Itisnecessary,however,tore-enablethebreakpointaftereachuse.

NoteForclosed-loopsteppersystemsinwhichtheencodercounts-per-revolutiondiffersfromthesteps-per-revolution,thecapturedpositionisinencodercounts.

Page 293: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadBreakpointStatusReadsthebreakpointstatusforallaxesorencoders.

NoteYoucannotusethisVItoreadthestatusofbufferedbreakpoints.UseCheckBuffertogetthestatusofthebuffer.

Details

DeviceCompatibility

BreakpointType(Position)isareservedinputthatmustbesettoPositionBreakpoint(0).BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisorEncoderistheaxiscontrolorencodercontrolselector.Formulti-axisstatus,use0(zero).Formulti-encoderstatus,use0x20.RetVectindicatesthedestinationforthereturndatageneratedbythisVI.Availablereturnvectorsincludereturndatatothehost(0xFF),returndatatoavariable(0x01through0x78),returndatatoanindirectvariable(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralready

Page 294: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

ThisVIallowsyoutoseeifabreakpointhasoccurredorispending.Whenyouenableabreakpoint,thecorrespondingstatusbitisresettoindicatethatthebreakpointispending.Forsinglebreakpoints,thisstatusissetwhenabreakpointoccurs.Periodicbreakpointsonlysetthebreakpointstatusafterthefirstbreakpointhasoccurred,andthestatusremainsassertedacrossthesubsequentbreakpoints.Whenthebreakpointpositionisreached,itsstatusbitissettoTrue(1).

Example

ExecutingtheReadBreakpointStatusVIwithAxisorEncoder=0x20andBreakpointType=0returnsBreakpointStatus,whichcorrespondstothefollowingbitmap.

Axis/Encoder1

Axis/Encoder2

Axis/Encoder3

Axis/Encoder4

Axis/Encoder5

Axis/Encoder6

Axis/Encoder7

Axis/Encoder8

True False False True False False False False

Onencoders1and4,breakpointshaveoccurred,butonencoders2and3,breakpointsarependingorwereneverenabled.

NoteReadBreakpointsStatusreturnsthebreakpointstatusforeitherallaxesorallencoders,basedonwhichvalueispassedintoAxisorEncoder.

Page 295: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

SetBreakpointOutputMOMOSetsthebreakpointoutputsusingtheMustOn/MustOffprotocol.

Details

DeviceCompatibility

MustOffisthebitmapofbreakpointoutputstoforceOff:1—Iftrue,breakpointoutputisforcedOff.Iffalse,breakpointoutputisunchanged(default).2—Iftrue,breakpointoutputisforcedOff.Iffalse,breakpointoutputisunchanged(default).3—Iftrue,breakpointoutputisforcedOff.Iffalse,breakpointoutputisunchanged(default).4—Iftrue,breakpointoutputisforcedOff.Iffalse,breakpointoutputisunchanged(default).5—Iftrue,breakpointoutputisforcedOff.Iffalse,breakpointoutputisunchanged(default).6—Iftrue,breakpointoutputisforcedOff.Iffalse,breakpointoutputisunchanged(default).7—Iftrue,breakpointoutputisforcedOff.Iffalse,breakpointoutputisunchanged(default).8—Iftrue,breakpointoutputisforcedOff.Iffalse,breakpointoutputisunchanged(default).

MustOnisthebitmapofbreakpointoutputstoforceOn:

Page 296: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheSetBreakpointOutputMOMOVIdirectlycontrolsthebreakpointoutputsandsetsthemhighorlow.YoucanusethisVItosetbreakpointoutputstoaknownstateortocontrolthemasgeneral-purposeoutputsinnon-breakpointapplications.YoucanonlycontroltheoutputusingthisVIifthebreakpointisdisabled.

NoteTheSetBreakpointOutputMOMOVIonlyaffectstheoutputstateofthebreakpoint.Itdoesnotchangethebreakpointstatus.

Breakpointfunctionalityisperformedbytheencoderresourcesthemselves.WhenthisVIissenttoaxes,theNI-Motionfirmwareconsultsthemappingofaxestoencodersandactuallysendsthecommandtothemappedencoderresources.Breakpointsareonlyavailableonencoderresources.RefertoEncodersforencoderresourceIDs.

UsingtheMustOn/MustOffprotocolallowsyoutosetorresetindividualbreakpointoutputswithoutaffectingtheotherbreakpointoutputs.Thisgivesyoutri-statecontrolovereachoutput:On,Off,orUnchanged.ATrueinalocationoftheMustOnbitmapsetsthebreakpointhigh,whileaTrueinthecorrespondinglocationoftheMustOffbitmapresetsthebreakpointlow.AFalseineitherbitmaphasnoeffect,soleavingboththeMustOnandMustOffbitsatzeroiseffectivelyahold,andthestateofthebreakpointoutputisunchanged.IfyousetboththeMustOnandMustOffbitstoTrue,itisinterpretedasaMustOnconditionandthebreakpointissethigh.

NoteIfthebreakpointisenabledusingtheEnableBreakpointOutputVI,youcannotchangetheoutputvalueusingSetBreakpointOutputMOMO.Thecommandisignoredbythemotioncontroller.NoteThefirstinputvectorsourceindicatesthevaluefortheMustOninputandthesecondvectorsourceindicatesthevaluefortheMustOffinput.Itisnotabitmapofthebreakpointoutput.

IfyouaredoingonboardprogrammingandareusingInpVecttogetthedatathisVIneeds,rememberthatthisVIreadsthevariablesstartingatthe

Page 297: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

High-SpeedCaptureVIsHigh-speedcaptureinputsareanenhancementtotheencoderFPGAandareavailablewhentheencodersareoperatingasaxisfeedbackorasindependentencoderresources.High-speedcapturefunctionalityisavailableonservoandclosed-loopstepperaxes.

YoucanuseHigh-SpeedCaptureVIstoconfigure,enable,andreadthestatusofhigh-speedinputs.Bufferedhigh-speedcaptureisalsoavailableontheNI-7350motioncontrollers.Bufferedcaptureisamoreadvanceduseofhigh-speedcapturewherethecapturedpositionsarestoredinapreviously-configuredbuffer.Thishelpsthehigh-speedcaptureperformathighercapturefrequencies.RefertotheBufferedOperationsOverviewfordetailsonbufferoperationsinbufferedhigh-speedcaptureforthe7350controller.

Thehigh-speedcaptureinputsalsocanfunctionaslatchinggeneral-purposeinputs.Configuretheinputsasyouwouldforhigh-speedcaptureoperation,butignorethecapturedposition.Youcanthenreadthestateofthelatchedinputs.

ClicktheiconsforVIdescriptions.

ConfigureHigh-SpeedCapture

EnableHigh-SpeedCapture

ReadCapturedPosition

ReadHigh-SpeedCaptureStatus

Page 298: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ConfigureHigh-SpeedCaptureConfiguresthehigh-speedcaptureinputfortheappropriatesignalbehavior.

DetailsRemarks

DeviceCompatibility

Operation(Single)selectsbetweensingleandbufferedhigh-speedcapture.CaptureModeselectsamongthefollowingvaluestospecifythemannerinwhichtheincominghigh-speedcapturesignalisinterpreted:Non-InvertingLevelInvertingLevelLow-to-HighEdgeHigh-to-LowEdgeNon-InvertingDigitalInputInvertingDigitalInput

Non-InvertingLevel,InvertingLevel,Low-to-HighEdge,andHigh-to-LowEdgemodesdefinethestateoftheinputsignalthatresultsinahigh-speedcaptureevent.Non-InvertingLevelmeansthatanactivehighinputcausesacapturetooccur.Conversely,InvertingLevelmeansthatanactivelowinputcausesacapturetooccur.Noticethatifthesignalisalreadyatthespecifiedlevelwhenhigh-speedcaptureisenabled,the

Page 299: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

Afterconfiguringthehigh-speedcaptureinput,youenablethehigh-speedcapturecircuitrywiththeEnableHigh-SpeedCaptureVI.TheReadHigh-SpeedCaptureStatusVItellsyouwhenthecaptureeventhasoccurred.Finally,youreadthecapturedvaluewiththeReadCapturedPositionVI.

High-speedcaptureinputsareanintegralpartoftheencoderresources.YoucanexecutethisVIindirectlyonaxesordirectlyonencoderresources.

Thecontrollercapturestheinstantaneousencoderpositionwhentheinputbecomesactive,asdefinedintheCaptureModeparameter.

High-speedcapturefunctionalityisavailableinbothsingleandbufferedmode.Insinglehigh-speedcapture,theinputtriggerisconfiguredtocaptureasingleencoderposition,andmustbere-enabledaftereachcapture.Youcanusebufferedhigh-speedcapturetosupporthighercapturefrequencies.Bufferedhigh-speedcaptureallowscapturespositionstobestoredintoabufferandautomaticallyre-enabledbythecontroller.Toconfigureabufferforhigh-speedcapture,refertotheConfigureBufferVI.

Youcanuseahigh-speedcaptureinputasageneral-purposeinputandreaditsstatuswiththeReadHigh-SpeedCaptureStatusVI.InNon-InvertingLevel,InvertingLevel,Low-to-HighEdge,andHigh-to-LowEdgemodes,theinputhaslatchingbehavior,meaningthatafterthehigh-speedcaptureinputisenabled,iftheinputsignaleverbecomesactive(asdefinedbytheCaptureModeparameter),thehigh-speedcapturestatusistrueuntiltheinputisreenabled.InNon-InvertingDigitalInputandInvertingDigitalInputmodes,theinputssimplyreflectthecurrentstateoftheinputsignal.Theinputdoesnotneedtobeenabledorreenabledatanytimeinthesemodes.

NoteNI-Motiondoesnotsupportbreakpointandhigh-speedcapturefunctionalityonanaxiswhentheprimaryfeedbackforthataxisisusedasanalogfeedback.NoteWhenconfiguredasadigitalinput,EnableHigh-SpeedCaptureandReadCapturedPositionhavenoeffect.Thehigh-speedcaptureinputis

Page 300: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

YoucansynchronizeNI73xxmotioncontrollerswithotherNationalInstrumentsdevicesusingtheRTSIbus.RefertotheSelectSignalVIforinformationaboutusingtheRTSIbusasthehigh-speedcapturetrigger.NI73xxcontrollersdonotsupportmultiplesimultaneoushigh-speedcapturesperaxis.

NISoftMotionControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

TheNISoftMotionControllersupportsmultiplesimultaneoushigh-speedcapturesperaxis.

TousethisVItoconfiguretheNISoftMotionControllerformultiplehigh-speedcapturesonanaxis,settheupperfourbitsoftheresourceIDtothefollowing.

Type ValuePrimaryHSCapture 0X0SecondaryHSCapture 0XA0

Forexample,toconfigureprimaryhigh-speedcaptureonaxis1,settheresourceIDto0X01.Toconfiguresecondaryhigh-speedcaptureonaxis

Page 301: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

EnableHigh-SpeedCaptureEnablesordisablesthespecifiedhigh-speedcaptureinput.

DetailsRemarks

DeviceCompatibility

High-SpeedCaptureindicateswhethertoenableordisablethehigh-speedcaptureinput.ValuesareTrueorFalse.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisorEncoderistheaxisorencoderselector.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.

Page 302: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheEnableHigh-SpeedCaptureVIenableshigh-speedcaptureinputstocaptureinstantaneousencoderpositionwhenaninputbecomesactive.Thepositioncaptureisimplementedintheencoderresourcetoreducecapturelatencytothesub-100nanosecondrange.

NoteIfyourapplicationusestheSelectSignalVItoroutethehigh-speedcapturesource,youmustcalltheSelectSignalVIbeforeenablingthehigh-speedcapture.

High-speedcapturefunctionalityisperformedbytheencoderresourcesthemselves.WhenthisVIissenttoanaxis,itisactuallybeingsenttothemappedencoderresource.

Thehigh-speedinputshaveprogrammablepolarityandedgebehavior.YoucansetthepolarityoftheinputwiththeConfigureHigh-SpeedCaptureVI.Youcandeterminetheresultsofthehigh-speedcapturefromtheReadHigh-SpeedCaptureStatusandReadCapturedPositionVIs.

Forsinglehigh-speedcapture,youcanenableonlyonehigh-speedcaptureperaxisorencoderatatime.Whenanenabledeventiscaptured,thehigh-speedcaptureisautomaticallydisabled.Youmustexplicitlyre-enablehigh-speedcapturetouseitagain.Todisableapreviouslyenabledoperation,runthisVIagainwithHigh-SpeedCapturesettoFalse.

Forbufferedhigh-speedcapture,youneedtoenabletheinputtriggeronlyonce.Subsequenthigh-speedcapturesareautomaticallyre-enabledbythecontroller.ThisVIhasnoeffectwhentheinputtriggerisconfiguredasadigitalinput.

Ifyouareusingbufferedhigh-speedcapture,ensurethatthebufferisconfiguredbeforeyouexecutethisVI.RefertoConfigureBufferformoreinformation.

High-speedcaptureisusefulinregistrationandsynchronizationapplications.Youcancalculatesubsequentmovesrelativetothecapturedposition.Referto

Page 303: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

Ifyourapplicationincludesahigh-speedcapturethattakesplaceafteraFindReferencemovethatfindsanindex,youmustenablethehigh-speedcaptureafterthefindreferencemove.Ifyourapplicationincludesabufferedhigh-speedcapture,youmustalsoconfigurethebufferafterthefindreferencemove.NI73xxcontrollersdonotsupportmultiplesimultaneoushigh-speedcapturesperaxis.

NISoftMotionControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

TheNISoftMotionControllersupportsmultiplesimultaneoushigh-speedcapturesperaxis.

TousethisVItoconfiguretheNISoftMotionControllertoenablemultiplehigh-speedcapturesonanaxis,settheupperfourbitsoftheresourceIDtothefollowing.

Type ValuePrimaryHSCapture 0X0SecondaryHSCapture 0XA0

Forexample,toenabletheprimaryhigh-speedcapturestatusonaxis1,set

Page 304: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadCapturedPositionReadsacapturedpositionvaluefromanaxisorencoder.

DetailsRemarks

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisorEncoderistheaxisorencodertoread.RetVectindicatesthedestinationforthereturndatageneratedbythisVI.Availablereturnvectorsincludereturndatatothehost(0xFF),returndatatoavariable(0x01through0x78),returndatatoanindirectvariable(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,

Page 305: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheReadCapturedPositionVIreturnsthevalueinthehigh-speedcaptureregisteroftheaxisorencoderselected.Thisvaluewascapturedwhenanenabledhigh-speedcaptureinputwentactive.

High-speedcapturefunctionalityisperformedbytheencoderresourcesthemselves.WhenthisVIissenttoanaxis,thevaluereturnedisactuallyfromthemappedencoderresource.

Forbufferedhigh-speedcapture,thecapturedpositionsarestoredinabuffer.UseReadBuffertoreadthecapturedpositions.

RefertotheEnableHigh-SpeedCaptureandReadHigh-SpeedCaptureStatusVIsformoreinformationaboutthehigh-speedcaptureinputsandtypicalapplications.

NoteForclosed-loopsteppersystemsinwhichtheencodercounts-per-revolutiondiffersfromthesteps-per-revolution,thecapturedpositionisinencodercounts.

Page 306: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

NI73xxcontrollersdonotsupportmultiplesimultaneoushigh-speedcapturesperaxis.

NISoftMotionControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

TheNISoftMotionControllersupportsmultiplesimultaneoushigh-speedcapturesperaxis.

TousethisVItoreadmultiplehigh-speedcapturepositionsonanaxis,settheupperfourbitsoftheresourceIDtothefollowing.

Type ValuePrimaryHSCapture 0X0SecondaryHSCapture 0XA0

Forexample,toenabletheprimaryhigh-speedcapturestatusonaxis1,settheresourceIDto0X01.Toenablethesecondaryhigh-speedcapturestatusonaxis1,settheresourceIDto0XA1.

Page 307: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadHigh-SpeedCaptureStatusReadsthehigh-speedpositioncapturestatusforallaxesorencoders.

NoteYoucannotusethisVItoreadthestatusofbufferedhigh-speedcaptures.UseCheckBuffertogetthestatusofthebuffer.

DetailsRemarks

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.AxisorEncoderistheaxiscontrolorencodercontrolselector.Formulti-axisstatus,use0(zero).Formulti-encoderstatus,use0x20.RetVectindicatesthedestinationforthereturndatageneratedbythisVI.Availablereturnvectorsincludereturndatatothehost(0xFF),returndatatoavariable(0x01through0x78),returndatatoanindirectvariable(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassesthe

Page 308: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheReadHigh-SpeedCaptureStatusVIallowsyoutoseeifapositioncapturehasoccurredorispending.Whenconfiguredasasinglehigh-speedcapture,thecorrespondingstatusbitissetwhenaninputtriggerbecomesactive,asconfiguredinConfigureHigh-SpeedCapture.Thestatusbit,alongwiththecapturedencoderposition,islatcheduntiltheinputtriggerisre-enabled.Whenthepositioncaptureoccurs,itsstatusbitissettoTrue(1).RefertotheReadCapturedPositionVIforinformationaboutretrievingthecapturedpositionvalue.

Example

ExecutingtheReadHigh-SpeedCaptureStatusVIwithAxisorEncoder=0returnsHighSpeedCaptureStatus,asshowninthefollowingtable.

Axis1 Axis2 Axis3 Axis4 Axis5 Axis6 Axis7 Axis8False True True False False False False False

Onencodersmappedtoaxes2and3,high-speedcaptureshaveoccurred,butallothercapturesarependingorwereneverenabled.

Page 309: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

Thehigh-speedcapturecircuitryisalsousedduringFindIndexexecution.Whenanindexisfoundsuccessfully,thecapturestatusforthecorrespondingencoderandaxisissettoTrueasasideeffect.ExecutingtheFindReferenceIndexVIautomaticallyleavesthecorrespondinghigh-speedcaptureinputdisabledaftertheindexisfound.

Page 310: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

FindReferenceVIsYoucanusetheseVIstoinitializethemotionsystemandestablisharepeatablereferenceposition.

Typicalclosed-loopmotionsystemsuseincrementalfeedbacktokeeptrackofposition.Atpower-up,thispositionismeaninglessuntilazeroreferencepositionisestablished.Open-loopsteppersystemsmustalsobeinitializedatpower-up.

NI-Motionprovidestwobuilt-inVIs,FindReferenceandWaitReference,toaccomplishthesetasks.FindReferenceperformssearchsequencestofindandstoponaspecificedgeofthehomeinput,findthenextinstanceoftheencoderindex,findthecenteroftravelbetweenforwardandreverselimits,orfindtheforward/reverselimit.WaitReferencereturnswhenaninitiatedfindhascompleted.Inthiswayarepeatablereferencepositionthatisaccuratetooneencodercountisestablished.

ClicktheiconsforVIdescriptions.

FindReference

CheckReference

WaitReference

ReadReferenceStatus

LoadReferenceParameter

GetReferenceParameter

Page 311: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

CheckReferenceChecksthestatusofasearchsequenceinitiatedbyFindReference.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Axis/VSMap(Disabled)isthebitmapofaxesorvectorspaces(coordinatespaces)tousewiththisVI.ItisonlyrequiredwhenmultipleaxesorvectorspacesareselectedwiththeAxisorVectorSpaceparameter.Otherwise,thisparameterisignored.

Whensearchingonmultipleaxes(AxisorVectorSpace=AxisControl):

Axis1—IfTRUE,checkreferenceonthespecifiedaxis.IfFALSE,donotcheckreferenceonthespecifiedaxis.Axis2—IfTRUE,checkreferenceonthespecifiedaxis.IfFALSE,donotcheckreferenceonthespecifiedaxis.Axis3—IfTRUE,checkreferenceonthespecifiedaxis.IfFALSE,donotcheckreferenceonthespecifiedaxis.Axis4—IfTRUE,checkreferenceonthespecifiedaxis.IfFALSE,donotcheckreferenceonthespecifiedaxis.Axis5—IfTRUE,checkreferenceonthespecifiedaxis.IfFALSE,donotcheckreferenceonthespecifiedaxis.Axis6—IfTRUE,checkreferenceonthespecifiedaxis.IfFALSE,

Page 312: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

ThisVIreturnswhetherthereferenceontheindicatedaxesisfound.Thereisnoneedtospecifywhattypeoffindtowaitforbecausethecontrollerknowswhatsearchesarebeingdoneonwhataxes.ThisVIwaitsforandreportsonthesuccessofthecurrentorlastexecutedfindonanaxis,vectorspace,oragivensetofaxesorvectorspacesasawhole.

IfaFindReferenceisexecutedwiththeRunSequenceoptiontheCheckReferenceVIdoesnotrequireanAxisorVectorSpaceorAxis/VSMap.WhenwaitingonaRunSequence,theCheckReferenceVIreturnsthestatusoftheentiresequence.TheFoundReferenceBooleanreturnsTrueonlyifandwhenalloftheoperationsinthesequencearesuccessful.

WaituntiltheFindingReferenceparameterisfalsebeforecheckingthestatusoftheFoundReferenceparameter.ThestatusoftheFoundReferenceparameterisundefinedwhenFindingReferenceistrue.TheWaitReferenceVIdoesthisforyou,butyoucannotexecuteanyotherVIswhileWaitReferenceisrunning.

Example

YouinitiatedaFindHomeonAxis1,andFindCenteronAxis2andAxis3,andyouwanttocheckifallaxeshavefoundtheirreference.CallCheckReferencewiththefollowingparameters:

AxisorVectorSpace=AxisControl(0)Axis/VSMap=00001110(axis1,2,&3enabled)

Page 313: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

FindReferenceExecutesasearchoperationtofindareferenceposition:

homeindex

forwardlimitreverselimit

centerrunsequence

DetailsRemarks

DeviceCompatibility

SearchTypeisthetypeofsearchexecutedbytheFindReferenceVI.

Value Definition Description

0 FindHome ExecutesaFindHomeonthegivensetofaxes.

1 FindIndex ExecutesaFindIndexonthegivensetofaxes.

2 FindCenter Findsthecenteroftravelonagivensetofaxes.

3 FindForwardLimit Findstheforwardlimitonagivensetofaxes.

4 FindReverseLimit Findsthereverselimitonagivensetofaxes.

5 RunSequence RunstheloadedFindSequence.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfrom

Page 314: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

ThisVIreturnsimmediatelyafterstartingthegivenfindoperation.UsethisVIinconjunctionwithWaitReferencetodeterminewhenthefindoperationcompletesandifthefindwassuccessful.

YoucanmanuallystopasearchoperationusingMAXorbycallingtheStopMotionVI.Whenencounteringalimitorhomeinput,asearchoperationperformsahaltstopandthencontinuesbasedontheSearchType.Anunexpectedlimitconditionduringafindstopsthesequenceandgeneratesamodalerror.RefertoErrorsandErrorHandlingforinformationabouterrors.

NoteYoumustsetunusedlimitandhomeinputstotheirinactivestateusingMAXorwiththeEnableLimitsandEnableHomeInputsVIs.NoteForwardisdefinedasthedirectionofincreasingposition.TheForwardandReverseLimitsmustbelocatedattheproperendsoftravelforFindReferencetofunctionproperly.

YoucanaccesssettingsforFindReferencethroughMAX,LoadReferenceParameterandGetReferenceParameter.ForadetaileddescriptiononhowthesesettingsaffectagivenSearchType,refertothesectiononeachtype.Mostofthesesettingsareonaper-SearchTypebasis.

NoteIfyoustartacoordinate(vector)space,FindReferenceactuallystartstheaxesindividually,soitisnotacoordinatedvectormove.

Page 315: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

SearchTypes

FindHome

FindIndex

FindCenter

FindForwardandReverseLimits

RunSequence

Page 316: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

Ifyourapplicationincludesahigh-speedcapturethattakesplaceafteraFindReferencemovethatfindsanindex,youmustenablethehigh-speedcaptureafterthefindreferencemove.Ifyourapplicationincludesabufferedhigh-speedcapture,youmustalsoconfigurethebufferafterthefindreferencemove.WhenperformingaresetpositionaspartofaFindReferenceoperation,addatleastoneofthefollowingtothemovecompletecriteriatoensurethatthemotorisnotmovingwhentheresetpositionexecutes:

Addadelayaftertheprofilecompletestatusistruetoallowsufficienttimebetweentheoutputandresetpositionforthemotortostop.UseConfigureMoveCompleteCriteriatoconfigureadelay.Usethein-positionsignalasacriteriaformovecomplete.TheNIPCI-7390controllerusesthissignalbydefault.ToaddthissignaltothemovecompletecriteriaforcontrollersotherthantheNIPCI-7390,useConfigureMotionI/OMaptomapthesignaltoapinandthenuseWriteTrajectoryDatatoaddin-positiontothemovecompletecriteria.Inaddition,configurethein-positionrangeonthedrivetoasmallenoughnumbertoensurethatthetargetpositionisreached.Refertoyourdrivedocumentationforinformationaboutconfiguringthein-positionrangeonthedrive.

Page 317: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

GetReferenceParameterGetsthevalueforthespecifiedfindreferenceparameter.

DetailsRemarks

DeviceCompatibility

ParameterTypeisthetypeofparametertoget.Validvaluesare:InitialSearchDirectionFinalApproachDirectionEdgeToStopOnSmartEnableEnableResetPositionOffsetPositionPrimaryResetPositionSecondaryResetPositionApproachVelocityPercentSequenceSearchOrderEnableSearchDistanceSearchDistancePhaseAReferenceStatePhaseBReferenceStateSearchTypeisthetypeofreferencetoget.PossibleSearchTypevaluesareFindHome,FindIndex,FindCenter,andFindForward&Reverse

Page 318: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

UsethisVItogettheparametersforFindReference.

InitialSearchDirection—If1,searchreverse.If0(default),searchforward.FinalApproachDirection—1istrueand0isfalse(default).ThefollowingtableliststhebehavioroftheFinalApproachDirectionparameterforeachtypeoffind:

FindType FinalApproachDirectionisTrue(1)

FinalApproachDirectionisFalse(0)

FindHome reverseapproach forwardapproachFindCenterFindForwardLimitFindReverseLimit

oppositetodirectionoftravelintolimit

sameasthedirectionoftravelintolimit

FindIndex N/A N/A

NoteForFindCenter,thisvaluereferstohowthecontrollerbehaveswhenapproachingandmarkingthepositionofthelimitstofindtheircenter.

EdgetoStopOn—AppliesonlytoFindHome.If1,reverseedge.If0(default),forwardedge.ApproachVelocityPercent—Thepercentoftheloadedvelocitythatagivenaxisusestoperformfinaladjustments.RefertotheRemarkssectionforvalidvalues.

FindIndexusesthispercentvelocitythroughouttheentiresearchroutine.SmartEnable—If1,appropriatelyenablesordisablesthelimitsandhomeinputbeforeexecutingafind.Thelimitsandhomeinputarereturnedtotheiroriginalstateafterthefindoperationiscomplete.TodeterminewhatstateSmartEnablesetsthelimitsorhomeinputto,refertotheappropriateSearchTypedescription.If0,youmustmanually

Page 319: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

TheresolutionofApproachVelocityPercentisapproximately0.4%FortheNI73xxcontrollers,ApproachVelocityPercentisasingle-precisionfloating-pointvaluefrom0.4%to150%.Thisvaluedirectlyscalestheprogrammedvelocity.Thedefaultvalueis20%.

NISoftMotionControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

SecondaryResetPositionisnotsupportedbytheNISoftMotionController.PhaseAReferenceStateandPhaseBReferenceStatearenotsupportedonCANopendevices.PrimaryResetPositionmustbesetto0whenyouareusingtheNISoftMotionControllerfortheCopleyControlsCANopendrives,AccelnetandXenus.TheNISoftMotionControllersupportsthefull64-bitfloatingpointrangefortheApproachVelocityPercentparameter.TheNISoftMotionControllerrequiresSearchDistance,andthus,EnableSearchDistanceisalways1(true).

Page 320: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadReferenceParameterLoadsthevalueforthespecifiedfindreferenceparameter.

DetailsRemarks

DeviceCompatibility

ParameterTypeisthetypeofparametertoload.Validvaluesare:

InitialSearchDirectionFinalApproachDirectionEdgeToStopOnSmartEnableEnableResetPositionOffsetPositionPrimaryResetPositionSecondaryResetPositionApproachVelocityPercentSequenceSearchOrderEnableSearchDistanceSearchDistancePhaseAReferenceStatePhaseBReferenceState

SearchTypeisthetypeofreferencetoload.PossibleSearchTypevaluesareFindHome,FindIndex,FindCenter,andFindForward&ReverseLimits.

Page 321: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

UsethisVItoloadtheparametersforFindReference.ThefollowingarevalidvaluesforeachParameterType:

InitialSearchDirection—Enter1tosearchinthereversedirection.Enter0(default)tosearchintheforwarddirection.FinalApproachDirection—Enter1fortrueand0forfalse(default).ThefollowingtableliststhebehavioroftheFinalApproachDirectionparameterforeachtypeoffind:

FindType FinalApproachDirectionisTrue(1)

FinalApproachDirectionisFalse(0)

FindHome reverseapproach forwardapproachFindCenterFindForwardLimitFindReverseLimit

oppositetodirectionoftravelintolimit

sameasthedirectionoftravelintolimit

FindIndex N/A N/A

NoteForFindCenter,thisvaluereferstohowthecontrollerbehaveswhenapproachingandmarkingthepositionofthelimitstofindtheircenter.

EdgetoStopOn—AppliesonlytoFindHome.Enter1tostoponthereverseedge.Enter0(default)tostopontheforwardedge.ApproachVelocityPercent—Thepercentoftheloadedvelocitythatagivenaxisusestoperformfinaladjustments.RefertotheRemarkssectionforvalidvalues.

FindIndexusesthispercentvelocitythroughouttheentiresearchroutine.SmartEnable—Avalueof1(true)appropriatelyenablesordisablesthelimitsandhomeinputbeforeexecutingafind.Thelimitsandhomeinputarereturnedtotheiroriginalstateafterthefindoperationiscomplete.TodeterminewhatstateSmartEnablesetsthelimitsorhomeinputto,refer

Page 322: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

TheresolutionofApproachVelocityPercentisapproximately0.4%FortheNI73xxcontrollers,ApproachVelocityPercentisasingle-precisionfloating-pointvaluefrom0.4%to150%.Thisvaluedirectlyscalestheprogrammedvelocity.Thedefaultvalueis20%.

NISoftMotionControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

SecondaryResetPositionisnotsupportedbytheNISoftMotionController.PhaseAReferenceStateandPhaseBReferenceStatearenotsupportedonCANopendevices.PrimaryResetPositionmustbesetto0whenyouareusingtheNISoftMotionControllerfortheCopleyControlsCANopendrives,AccelnetandXenus.TheNISoftMotionControllersupportsthefull64-bitfloatingpointrangefortheApproachVelocityPercentparameter.TheNISoftMotionControllerrequiresSearchDistance,andthus,EnableSearchDistanceisalways1(true).

Page 323: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadReferenceStatusReadsthecurrentlyselectedreferencestatusforthegivensetofaxesorcoordinate(vector)space.

Details

DeviceCompatibility

StatusTypeistheselectorforthetypeofreferencestatustoread.

Youcanchoosefromthefollowingstatustypes:

StatusType Description

HomeFound returnsTrueifthelastFindHomeexecutedsuccessfully

IndexFound returnsTrueifthelastFindIndexexecutedsuccessfully

CenterFound returnsTrueifthelastFindCenterexecutedsuccessfully

ForwardLimitFound

returnsTrueifthelastFindForwardLimitexecutedsuccessfully

ReverseLimitFound returnsTrueifthelastFindReverseLimitexecutedsuccessfully

ReferenceFound returnsTrueifthelastFindReferenceexecutedsuccessfully

Page 324: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

ThisVIreadsthecurrentlyselectedreferencestatusforthegivensetofaxesorcoordinate(vector)space.

Ifmultipleaxesinacoordinatespaceareselectedusingtheaxisbitmap,allaxesmusthavesuccessfullyfoundtheirlastreferenceforHomeFound,IndexFound,CenterFound,ForwardLimitFound,ReverseLimitFound,andReferenceFoundtobetrue.

IfanyoftheselectedaxesarecurrentlyexecutingaFindReference,FindingReferenceistrue.WaituntilFindingReferenceisfalsebeforecheckingthestatusofanyotherattribute.ThestatusoftheHomeFound,IndexFound,CenterFound,ForwardLimitFound,ReverseLimitFound,andReferenceFoundstatustypesareundefinedwhenFindingReferenceistrue.TheWaitReferenceVIdoesthisforyou,butyoucannotexecuteanyotherVIswhileWaitReferenceisrunning.

Page 325: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

WaitReferenceWaitsforasearchsequenceinitiatedbyFindReferencetocompleteandreturnsthestatus.WaitReferencealsocanbeusedtoquerythestatusofasearch.

Details

DeviceCompatibility

Timeout(ms)specifieshowlong,inmilliseconds,theWaitReferencecallwaitsbeforereturning.IfthetimeoutisreachedbeforethesearchcompletestheWaitReferenceReturns.Inthismanner,WaitReferencecanbeusedtocheckthestatusofasearchbypassingatimeoutof0.Bydefault,thetimeoutis4294967295or0xFFFFFFFF.Thisvalueishandleddifferently,signifyinganinfinitewaittime.Axis/VSMap(Disabled)isthebitmapofaxesorvectorspaces(coordinatespaces)tousewiththisVI.ItisonlyrequiredwhenmultipleaxesorvectorspacesareselectedwiththeAxisorVectorSpaceparameter.Otherwise,thisparameterisignored.

Whensearchingonmultipleaxes(AxisorVectorSpace=AxisControl):

Axis1—IfTRUE,waitonthespecifiedaxis.IfFALSE,donotwaitonthespecifiedaxis.Axis2—IfTRUE,waitonthespecifiedaxis.IfFALSE,donotwaitonthespecifiedaxis.Axis3—IfTRUE,waitonthespecifiedaxis.IfFALSE,donotwaitonthespecifiedaxis.

Page 326: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

ThisVIreturnswhenthefindontheindicatedaxesfinishesorthetimeoutisreached,whicheveroccursfirst.Thereisnoneedtospecifywhattypeoffindtowaitforbecausethecontrollerknowswhatsearchesarebeingdoneonwhataxes.ThisVIwaitsforandreportsonthesuccessofthecurrentorlastexecutedfindonanaxis,vectorspace,oragivensetofaxesorvectorspacesasawhole.

IfaFindReferenceisbeingexecutedwiththeRunSequenceoptiontheWaitReferenceVIdoesnotrequireanAxisorVectorSpaceorAxis/VSMap.WhenwaitingonaRunSequence,theWaitReferenceVIreturnswhentheentiresequencehasfinished.TheFoundReferenceBooleanreturnsTrueonlyifalloftheoperationsinthesequenceweresuccessful.

NoteYoucannotexecuteanyotherprocesseswhiletheWaitReferenceVIisrunning.UseCheckReferenceorReadReferenceStatusifyouwanttorunotherprocessessimultaneously.

Example

YouinitiatedaFindHomeonAxis1,andFindCenteronAxis2andAxis3,andyouwanttowaitforallfindsequencestofinishbeforeproceedingwiththerestoftheprogram.SimplycallWaitReferencewiththefollowingparameters:

AxisorVectorSpacesettoAxisControl(0)AxisMapsetto00001110(axis1,2,&3enabled)TimeoutisUnwired

Page 327: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Analog&DigitalI/OVIsYoucanusetheanaloganddigitalI/OVIstocontrolthegeneral-purposeanaloganddigitalI/OresourcesontheNImotioncontroller.Theseresourcesincludeupto32bitsofgeneral-purposedigitalI/O,PWMoutputs,RTSIlines,andanyextraencoders,ADCchannels,andDACoutputsthatarenotmappedtoanaxis.

The32bitsofdigitalI/OareavailableontheDigitalI/OConnector.Thesebitsareorganizedinto8-bitportsthatyoucanconfigureasinputsoroutputsonaport-wisebasis,oronabitwisebasis.Eachbithasindividuallyprogrammablepolaritythatyoucanconfigureasactiveloworactivehigh.Youcanusethegeneral-purposedigitalI/Oforsystemintegrationapplicationsincludingoperatorpanelswitchinputsandoutputs,relayandsolenoidactivation,triggerI/Obetweenothercontrollersand/orinstrumentsinthesystem,andsoon.

Youcanuseencoders,ADCchannels,andDACoutputsthatarenotmappedtoanaxisforgeneral-purposeI/O.Typicalusesforencoderinputsincludevelocitymonitoring,mastersformaster-slavegearing,anddigitalpotentiometerapplications.

YoucanuseunusedADCinputsandDACoutputsforanyanalogI/Othatiswithintheirspecifications.Typicalanaloginputapplicationsincludeanalogjoysticks,potentiometers,force,pressure,levelandstrainsensors,andsoon.Analogoutputapplicationsvaryfromheaterelementcontroltolaserintensitymodulation.

ClicktheiconsforVIdescriptions.

Page 328: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

SetI/OPortDirection EnableEncodersSetI/OPortPolarity ReadEncoderPositionSetI/OPortMOMO ResetEncoderPositionReadI/OPort ConfigureEncoderFilterEnableADCs ConfigureEncoderPolarityReadADC ConfigurePWMOutputSetADCRange LoadPWMDutyCycleLoadDAC SelectSignal

Page 329: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ConfigureEncoderFilterSelectsthemaximumcountfrequencyforanencoderchannelbyconfiguringitsdigitalfilter.

Details

DeviceCompatibility

Frequency(1.6MHz)selectsthemaximumcountfrequencyforthespecifiedencoder.

FrequencyValue MaximumCountFrequency0 25.6MHz1 12.8MHz2 6.4MHz3 3.2MHz4 1.6MHz(default)5 800kHz6 400kHz7 200kHz8 100kHz9 50kHz10 25kHz11 DisabledBoardIDisauniquenumberassignedbyMeasurement&Automation

Page 330: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

Settingthemaximumallowablecountfrequencyforanencoderisusefulforreducingtheeffectofnoiseontheencoderlines.Noiseontheencoderlinescanbeinterpretedasextraencodercounts.Bysettingthefrequencytothelowestpossiblesettingrequiredforthemotionapplication,youcanensurethehighestdegreeofaccuracyinpositioning.Inchoosingtheappropriatevalue,youmusttakeintoaccountthecountsperrevolutionoftheencoderandthemaximumvelocityfortheaxisinquestion.

Forexample,witha20,000countsperrevolutionencoderandamaximumvelocityof3,000RPM(50revolutionspersecond),theencodersignalcouldbeashighas1,000,000countspersecond.Afrequencyvalueof4,whichwouldcorrespondtoamaximumcountfrequencyof1.6MHzwouldbeappropriateinthiscase.

IfyounevercallthisVI,adefaultvalueof4(1.6MHz)isused.

TipWhentheencoderfilterischanged,resetthepositiontopreventanerroneouscount.

Page 331: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ConfigureEncoderPolarityConfigurestheencoderPhaseA,PhaseB,andIndexlinepolarities.

Details

DeviceCompatibility

PhaseAsetsthepolarityforencoderPhaseAtoactiveloworactivehigh.

Encoder1—Iftrue,activehigh(default).Iffalse,activelow.Encoder2—Iftrue,activehigh(default).Iffalse,activelow.Encoder3—Iftrue,activehigh(default).Iffalse,activelow.Encoder4—Iftrue,activehigh(default).Iffalse,activelow.Encoder5—Iftrue,activehigh(default).Iffalse,activelow.Encoder6—Iftrue,activehigh(default).Iffalse,activelow.Encoder7—Iftrue,activehigh(default).Iffalse,activelow.Encoder8—Iftrue,activehigh(default).Iffalse,activelow.

IndexsetsthepolarityfortheencoderIndextoactiveloworactivehigh.Encoder1—Iftrue,activehigh(default).Iffalse,activelow.Encoder2—Iftrue,activehigh(default).Iffalse,activelow.Encoder3—Iftrue,activehigh(default).Iffalse,activelow.Encoder4—Iftrue,activehigh(default).Iffalse,activelow.Encoder5—Iftrue,activehigh(default).Iffalse,activelow.Encoder6—Iftrue,activehigh(default).Iffalse,activelow.Encoder7—Iftrue,activehigh(default).Iffalse,activelow.Encoder8—Iftrue,activehigh(default).Iffalse,activelow.

BoardIDisauniquenumberassignedbyMeasurement&Automation

Page 332: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheConfigureEncoderPolarityVIconfiguresthepolaritiesfortheencoderPhaseA,PhaseB,andIndexlines.ConfigureencoderpolaritiesbeforecallingtheEnableEncodersVI.

Youcanconfiguretheencoderpolarityasactiveloworactivehigh.Whenconfiguredasactivelow,theinputisactivewhenthereisalowsignalontheinputpin.Conversely,activehighmeansthattheinputisactivewhenthereisahighsignalontheinputpin.

NoteSettingPhaseAandPhaseBincorrectlycausesthefeedbacktoappeartomoveintheoppositedirection.Forexample,ifPhaseAorPhaseBisthewrongpolaritywhenmovingintheforwarddirection,thepositionappearstomoveinthereversedirection.Theoppositeoccurswhenmovinginthereversedirection.Ifbotharesetincorrectly,motionoccursinthecorrectdirectionbuttheindexmightnotworkcorrectly.

Page 333: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ConfigurePWMOutputEnablesanddisablesPWMoutputs,andsetsthePWMclockfrequency.

Details

DeviceCompatibility

ClockFrequencyspecifiestheclockfrequencyforthePWMoutput.

ThebaseclockfrequencyforthePWMoutputsis24.81MHzonthe7340and7330controllers,24.58MHzonthe7350controller,and20.48on7334/42/44controllers.Thisbaseclockfrequencyisdivideddowndependingontheclockvalueselected.

ThefollowingtabledescribesthePWMclockfrequencysettings:

ClockDividerValue

ClockValue*

7334/42/44ClockFrequency

7330/40ClockFrequency

7350ClockFrequency

512 0 40.00kHz 48.46kHz 48.01kHz1K 1 20.00kHz 24.23kHz 24.00kHz2K 2 10.00kHz 12.11kHz 12.00kHz4K 3 5.00kHz 6.06kHz 6.00kHz8K 4 2.50kHz 3.03kHz 3.00kHz16K 5 1.25kHz 1.51kHz 1.50kHz33K 6 625.00Hz 757.14Hz 750.09Hz

Page 334: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ConfigurePWMOutputEnablesanddisablesPWMoutputs,andsetsthePWMclockfrequency.

Details

DeviceCompatibility

ClockFrequencyspecifiestheclockfrequencyforthePWMoutput.

ThebaseclockfrequencyforthePWMoutputsis24.81MHzonthe7340and7330controllers,24.58MHzonthe7350controller,and20.48on7334/42/44controllers.Thisbaseclockfrequencyisdivideddowndependingontheclockvalueselected.

ThefollowingtabledescribesthePWMclockfrequencysettings:

ClockDividerValue

ClockValue*

7334/42/44ClockFrequency

7330/40ClockFrequency

7350ClockFrequency

512 0 40.00kHz 48.46kHz 48.01kHz1K 1 20.00kHz 24.23kHz 24.00kHz2K 2 10.00kHz 12.11kHz 12.00kHz4K 3 5.00kHz 6.06kHz 6.00kHz8K 4 2.50kHz 3.03kHz 3.00kHz16K 5 1.25kHz 1.51kHz 1.50kHz33K 6 625.00Hz 757.14Hz 750.09Hz

Page 335: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

ThePWMoutputsontheNImotioncontrolleraredigitalpulse-trainoutputsthathaveafrequencyspecifiedbytheclockparameterofthisVIandadutycyclespecifiedbytheLoadPWMDutyCycleVI.TheseoutputscanbeusedtocontroldevicesthatrequireaPWMinput,suchasalaserwhoseintensityiscontrolledbyaPWMsignal,orcanbeusedtogenerateisolatedanalogoutputsbypassingthePWMoutputthroughanoptocoupler,andthenfilteringthedigitalpulsetraintoproduceananalogoutputvoltage.

WhenyouconfigureaPWMoutput,theclockfrequencyappliestobothPWMoutputs.IfyouconfigureonePWMoutputforaclockvalueof3,andthenthesecondPWMoutputforaclockvalueof4,thevalueof4appliestobothPWMoutputs.

TheonlyexceptioniswhentheclocksettingsforthetwoPWMoutputsare0and8,1and9,2and10,andsoon,inwhichcaseeachoutputhasadifferentfrequency.Thisisbecauseclockvalues0–7and8–15arepaired.Clockvalues0and8usethecommontimebaseof10.24MHz(12.8MHzonthe7350).Thefrequencyofclockvalue0isfoundbydividingthetimebaseby256,whileclockvalue8isfoundbydividingthetimebaseby32768.IfyouhaveanNI7344controllerandyouswitchchannelBtoclockvalue10,thetimebasechangesto2.56MHz.ThischangealsoswitcheschannelAto2.56/256=10kHz.Therefore,ifthevalueinonesetchanges,itswitchestheotherchanneltothepairingclockvalue.Ifthetwovaluesareinthesamegroup,thetwochannelshavethesamefrequency.

Touseanexternalclock(clockvaluesof7or15),connecttheexternalclocksignaltothePCLKinputontheDigitalI/Oconnector.

Page 336: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

EnableADCsEnablesoneormoreoftheunmappedADCchannels.

Details

DeviceCompatibility

ADCMap(Enabled)isthebitmapofADCchannelstoenable:IfADCMap0isTRUE(default)theADCchannelisenabled.IfitisFALSEtheADCchannelisdisabled.IfADCMap1isTRUE(default)theADCchannelisenabled.IfitisFALSEtheADCchannelisdisabled.IfADCMap2isTRUE(default)theADCchannelisenabled.IfitisFALSEtheADCchannelisdisabled.IfADCMap3isTRUE(default)theADCchannelisenabled.IfitisFALSEtheADCchannelisdisabled.IfADCMap4isTRUE(default)theADCchannelisenabled.IfitisFALSEtheADCchannelisdisabled.IfADCMap5isTRUE(default)theADCchannelisenabled.IfitisFALSEtheADCchannelisdisabled.IfADCMap6isTRUE(default)theADCchannelisenabled.IfitisFALSEtheADCchannelisdisabled.IfADCMap7isTRUE(default)theADCchannelisenabled.IfitisFALSEtheADCchannelisdisabled.

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.errorin(noerror)describeserrorconditionsthatoccurbeforethisVI

Page 337: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheEnableADCsVIenablesoneormoreindependentADCchannelsforuseasgeneral-purposeanaloginputs.ThecontrollerreturnsanerrorifyouattempttoenableordisableanADCbeingusedasanaxisfeedbackwhentheaxisisenabled.Thesefeedbackchannelsareautomaticallyenabled/disabledwhenyouenableordisabletheircorrespondingaxiswiththeEnableAxesVI.Youmustfirstdisabletheaxisusinganalogfeedback,thenenableordisableADCs.

TheNI-MotionAnalog-to-DigitalConverter(ADC)multiplexesbetweenchannelswithascanrateofapproximately40µsperchannelforthe7340motioncontroller,and25µsperchannelforthe7350motioncontroller.Therefore,thetimebetweensamplesforaspecificADCchannelisasfollows:

7330/40:ADCsampletime=40µs/channel×(numberofenabledchannels)

7350:ADCsampletime=25µs/channel×(numberofenabledchannels)

Bydefault,allchannelsareenabledatpower-up.Youmustdisableunusedchannelstoincreasethescanrateanddecreasethesampletime.

The40µs/channelscanrateisfastenoughtosupportanalogfeedbackatthefastestPIDupdateratesaslongasnoadditionalADCchannelsareenabled.

Example

ToenableADCchannels1,3,5,and7onthe7350motioncontroller,calltheEnableADCsVIwithAxisMap,asfollows.

0(ADC1)

1(ADC2)

2(ADC3)

3(ADC4)

4(ADC5)

5(ADC6)

6(ADC7)

7(ADC8)

True False True False True False True False

Undernormalconditions,becauseADCchannels2,4,6,and8aresettoFalse,theyaredisabledwhenyouexecutethisVI.However,ifADCchannel2is

Page 338: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

EnableEncodersEnablesoneormoreoftheunmappedencoderresources.

Details

DeviceCompatibility

EncoderMap(Disabled)isthebitmapofencoderresourcestoenable.Encoder1—Iftrue,theencoderisenabled.Iffalse,theencoderisdisabled(default).Encoder2—Iftrue,theencoderisenabled.Iffalse,theencoderisdisabled(default).Encoder3—Iftrue,theencoderisenabled.Iffalse,theencoderisdisabled(default).Encoder4—Iftrue,theencoderisenabled.Iffalse,theencoderisdisabled(default).Encoder5—Iftrue,theencoderisenabled.Iffalse,theencoderisdisabled(default).Encoder6—Iftrue,theencoderisenabled.Iffalse,theencoderisdisabled(default).Encoder7—Iftrue,theencoderisenabled.Iffalse,theencoderisdisabled(default).Encoder8—Iftrue,theencoderisenabled.Iffalse,theencoderisdisabled(default).

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.errorin(noerror)describeserrorconditionsthatoccurbeforethisVI

Page 339: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheEnableEncodersVIenablesoneormoreindependentencoderchannelsforuseasgeneral-purposeencoderinputs.Ithasnoeffectonencodersthataremappedtoaxesandbeingusedforaxisfeedback.Thesefeedbackencodersareautomaticallyenabled/disabledwhentheircorrespondingaxisisenabledordisabledwiththeEnableAxesVI.Bitlocationscorrespondingtomappedencodersareignored,asareencoderresourcesthatdonotexist.Forexample,encoderresources5through8areignoredforcontrollersthatsupportamaximumoffouraxes.

Typicalusesforindependentencoderinputsincludevelocitymonitoring,mastersformaster-slavegearing,anddigitalpotentiometerapplications.

Example

Toenableencoders3and4onthemotioncontroller,calltheEnableEncodersVIwiththefollowingEncoderMap.

Encoder1 Encoder2 Encoder3 Encoder4 Encoder5 Encoder6 Encoder7 Encoder8False False True True False False False False

Normally,becauseencoders1,2,5,and6aresettoFalse,theyisdisabledwhenyouexecutethisVI.However,ifencoder2isalreadybeingusedasfeedbackforaxis2andaxis1isnotbeingused,thedisableFalseforEncoder2isignoredresultinginthefollowingenabledencoders.

Encoder1 Encoder2 Encoder3 Encoder4 Encoder5 Encoder6 Encoder7 Encoder8False True True True False False False False

Thereisalimitonthenumberofenabledencoderssupportableatthefasterupdaterates.Attemptingtoenabletoomanyencodersgeneratesanerror.RefertotheEnableAxesformoreinformationaboutupdateratelimitations.

Page 340: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheEnableEncodersVIenablesoneormoreindependentencoderchannelsforuseasgeneral-purposeencoderinputs.Ithasnoeffectonencodersthataremappedtoaxesandbeingusedforaxisfeedback.Thesefeedbackencodersareautomaticallyenabled/disabledwhentheircorrespondingaxisisenabledordisabledwiththeEnableAxesVI.Bitlocationscorrespondingtomappedencodersareignored,asareencoderresourcesthatdonotexist.Forexample,encoderresources5through8areignoredforcontrollersthatsupportamaximumoffouraxes.

Typicalusesforindependentencoderinputsincludevelocitymonitoring,mastersformaster-slavegearing,anddigitalpotentiometerapplications.

Toenableencoders3and4onthemotioncontroller,calltheEnableEncodersVIwiththefollowingEncoderMap.

Encoder1 Encoder2 Encoder3 Encoder4 Encoder5 Encoder6 Encoder7 Encoder8False True True False False False False

Normally,becauseencoders1,2,5,and6aresettoFalse,theyisdisabledwhenyouexecutethisVI.However,ifencoder2isalreadybeingusedasfeedbackforaxis2andaxis1isnotbeingused,thedisableFalseforEncoder2isignoredresultinginthefollowingenabledencoders.

Encoder1 Encoder2 Encoder3 Encoder4 Encoder5 Encoder6 Encoder7 Encoder8True True True False False False False

Thereisalimitonthenumberofenabledencoderssupportableatthefasterupdaterates.Attemptingtoenabletoomanyencodersgeneratesanerror.RefertotheEnableAxesVIformoreinformationaboutupdateratelimitations.

Page 341: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadDACLoadsanoutputvaluetoanunmappedDACresource.

DetailsRemarks

DeviceCompatibility

DACValue(0)isthevaluesenttotheDAC.Theparameterrangeis-32,768to+32,767,correspondingtothefull±10Voutputrange.

NoteDACtorquelimitsandoffsetsdonotapplywhendirectlyloadingaDAC.

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.DACistheDACtocontrol.InpVectindicatesthesourceofthedataforthisVI.Availableinputvectorsincludeimmediate(0xFF),variable(0x01through0x78),orindirectvariable(0x81through0xF8).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.

Page 342: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheLoadDACVIisusedtosendavaluedirectlytoanunmappedDACresource.DACsnotmappedasservoaxisoutputsareavailableforgeneral-purposeanalogoutputapplications.

CautionYoumustnotexecutethisVIonaDACmappedtoanaxis.DoingsocausestheDACoutputtoglitchmomentarilybeforereturningtoaxiscontrol.

Page 343: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NISoftMotionControllerConsiderations

ThefollowingincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

Iftheaxisisenabled,thecontrolloophasownershipofthedrivecommandoutput,andthevaluethatthisVIsendsisignored.

Page 344: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadPWMDutyCycleSetsthedutycycleforaPWMoutput.

Details

DeviceCompatibility

DutyCycle(0)isavaluebetween0and255thatspecifiestheamountoftimethePWMoutputishigh.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.PWMOutputselectsthePWMOutputtoconfigure(1or2).InpVectindicatesthesourceofthedataforthisVI.Availableinputvectorsincludeimmediate(0xFF),variable(0x01through0x78),orindirectvariable(0x81through0xF8).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.

Page 345: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheDutyCycledeterminestheamountoftimethePWMoutputishigh.ADutyCycleof0correspondstoa0Voutput,andaDutyCycleof255correspondstoapulsetrainthatishighfor255/256=99.6%ofthetime.UsetheConfigurePWMOutputVItosetthefrequencyofthePWMoutputsignal.

YoucansettheDutyCyclebeforeorafterconfiguringaPWMoutput.Bydefault,theDutyCycleis0,soifyoucalltheConfigurePWMOutputVItoconfigureaPWMoutput,theoutputislowuntilyousettheDutyCycledifferently.IfyousettheDutyCyclefirst,thePWMoutputreflectsthisDutyCycleimmediatelyaftercallingtheConfigurePWMOutputVI.

NoteIfyouaredoingonboardprogrammingandareusingInpVecttogetthedatathisVIneeds,rememberthatthisVIreadsthevariablesstartingatthememoryaddresspointedtobyInpVectinthefollowingorder:PWMOutput,DutyCycle.

Page 346: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadADCsReadstheconvertedvaluefromanADCinputchannel.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.ADCistheAnalog-to-DigitalConverterchanneltoread.ValidADCresourcesare0x51(81)through0x5F(95).RetVectindicatesthedestinationforthereturndatageneratedbythisVI.Availablereturnvectorsincludereturndatatothehost(0xFF),returndatatoavariable(0x01through0x78),returndatatoanindirectvariable(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroora

Page 347: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheReadADCVIreturnstheconvertedvoltagefromanyoftheanaloginputchannels.YoucanonlyreadvaluesfromchannelsthathavebeeneitherdirectlyenabledbytheEnableADCsVIorautomaticallyenabledbybeingmappedtoanenabledaxis.

ForanADCchannelmappedtoanaxis,thisVIreturnstheactualADCvalue.Incontrast,theReadPositionVIexecutedontheowneraxisreturnsanADCvaluethathasbeenoffsetbyaresetvaluestoredwhentheResetPositionVIwasexecuted.ADCchannelsareneverinternallyresetsotheirDCvaluesarepreserved.

Page 348: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadI/OPortReadsthelogicalstateofthebitsinanI/Oport.

DetailsRemarks

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Port(1)isthegeneral-purposeI/Oport(1–8)orRTSIsoftwareport(9)toread.RetnVectindicatesthedestinationforthereturndatageneratedbythisVI.Availablereturnvectorsincludereturndatatothehost(0xFF),toavariable(0x01through0x78),toanindirectvariable(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroora

Page 349: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheReadI/OPortVIreadsthelogicalstateofthebitsinthegeneral-purposeI/Oportselected.YoucanexecutethisVIatanytimetomonitorthesignalsconnectedtoaninputport.ReadsofportsconfiguredasoutputsreturnthelastvaluewrittentotheportwiththeSetI/OPortMOMOVI.

NoteThisVIreadsthelogicalstate(OnorOff,TrueorFalse)ofthebitsinaport.ThepolarityofthebitsintheportdetermineswhetheranOnstateisactivehighoractivelow.RefertotheSetI/OPortPolarityVIformoreinformation.NoteRefertoVIExecutionTimesforbenchmarktiminginformationaboutyourcontroller.

Page 350: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowingincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxcontroller:

ThePCI-7390hasdedicateddirectionI/Oports.Referto73xxControllerGeneral-PurposeI/OPortIDsfortheappropriateportnumbertouseforPort.

Forexample,toreadthestateofinputport3,Portis0x03(3).Toreadthevaluepreviouslysetonoutputport2,Portis0x82(130)WhenreadingtheRTSIport,thevaluereadisthelatcheddata,soyoucandetectactivepulsesontheRTSIbus.Afterreadingthelatcheddatavalue,theVIresetsthelatch.UsetheSetI/OPortPolarityVItospecifythepolarity—andthereforetheactivestate—forlatching.

NISoftMotionControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

TheNISoftMotionControllerhasdedicateddirectionI/Oports.RefertoNISoftMotionControllerGeneral-PurposeI/OPortIDsfortheappropriateportnumbertouseforPort.

Forexample,toreadthestateofoutputport2,Portis0x82(130).Toreadthestateofinputport3,Portis0x03(3).TheRTSIportisnotsupportedbytheNISoftMotionController.

Page 351: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ResetEncoderPositionResetsthepositionofanunmappedencodertothespecifiedvalue.

Details

DeviceCompatibility

ResetPosition(0)istheresetvaluefortheencoderresource.Youcanresetpositiontoanyvalueinthetotalpositionrangeof-(231)to+(231–1).BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Encoderisencodertoreset.InpVectindicatesthesourceofthedataforthisVI.Availableinputvectorsincludeimmediate(0xFF),variable(0x01through0x78),orindirectvariable(0x81through0xF8).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.If

Page 352: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheResetEncoderPositionVIresetsthepositionoftheselectedencoder.Youcanresetpositiontozeroortoanyvalueinthe32-bitpositionrange.Normally,thisVIisonlyusedonindependentencodersthatarenotmappedtoaxes.Forencodersmappedtoaxes,usetheResetPositionVIinstead.

NoteAttemptingtoresetanencoderthatismappedtoanaxisgeneratesanerror.

EnabledbreakpointsarealsoautomaticallydisabledwhenyouexecuteResetEncoderPositiononthecorrespondingaxis.

Encoderpositioncanberesetatanytime.However,itisrecommendedthatyouresetpositiononlywhiletheencoderisstopped.Anencoderresetwhileitismovingdoesnothavearepeatablereferenceposition.

NoteNon-zeroresetvaluesareusefulfordefiningapositionreferenceoffset.

Page 353: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

SelectSignalSpecifiesthesourceanddestinationforvariousmotionsignals:

triggerinputshigh-speedcapturecircuitsbreakpointoutputs

RTSIlinesRTSIsoftwareports

Details

DeviceCompatibility

SourceisthesourceofthesignaltoroutetoDestination.

ForaDestinationvalueofHigh-speedCapture[1..8],thevalidSourcevaluesareasfollows.

Source CommentsRTSI[0..7] RTSIlines0through7PXIStarTrigger PXIstartriggerlineTriggerInput Triggerinputforthecorrespondingaxis

NoteYoumustroutesignalsfromtheRTSIlinesbeforeyouenable

Page 354: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

WhenthedestinationisRTSI[0..7]orPXIStarTrigger,themotioncontrollerdrivestheRTSIlineasanoutput.WhenthedestinationisHigh-speedCapture[1..8],theRTSIlineservesasaninputforthehigh-speedcapturecircuitry.ThisVIisusedtosetthedirectionoftheRTSIlines.TheRTSIlinescanalwaysbereadusingtheReadI/OPortVI,regardlessofthewaytheyarecurrentlyconfigured.

TomanuallysetthestateoftheRTSIlines,settheSourcefortheRTSIlinetobeRTSISoftwarePort.UsetheSetI/OPortMOMOVItosetthestateofthelines.

ThesignalseenontheRTSI4pinisahighpulseof120to150nsduration.TheactionspecifiedintheEnableBreakpointOutputVIonlyappliestothebreakpointoutputpinonthemotionI/Oconnector,nottoRTSIpins.

Example1

TousethesignalcominginonRTSIpin3totriggerthehigh-speedcaptureonencoder/axis1,connectDestinationtoHigh-SpeedCapture1andSourcetoRTSI3.

Thepolarityofthehigh-speedcaptureinputisspecifiedbytheConfigureHigh-SpeedCaptureVI.

Example2

Tooutputthebreakpointsignalforaxis2onRTSIpin4,connectDestinationtoRTSI4andSourcetoBreakpoint2.

Example3

TodriveRTSIpin5withthecorrespondingbit(bit5)oftheRTSIsoftwareport,connectDestinationtoRTSI5andSourcetoRTSISoftwarePort.TosetthestateoftheRTSIsoftwareport,usetheSetI/OPortMOMOVI.

Page 355: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

SetADCRangeSetsthevoltagerangefortheanalogtodigitalconverters,onaper-channelbasis.

Details

DeviceCompatibility

Range(–10to+10)specifiestheinputvoltagerangeoverwhichtheADCconvertsinputvoltagestodigitalvalues.Voltagesoutsideoftherangeclampsattheextremes,whichare–2048or+2047(7330/40)and–32,768to+32,767(7350)forthe–5to+5Vand–10to+10Vranges,and0to4,096(7330/40)and0to+65,535(7350)forthe0to+5Vand0to+10Vranges.Youcanchoosefromthefollowingvaluesfortherange:

BinaryValuesRangeValues 7350 7330/400to5 0to+65,535 0to+4,095–5to+5 –32,768to+32,767 –2,048to+2,0470to+10 0to+65,535 0to+4,095–10to+10(default) –32,768to+32,767 –2,048to+2,047BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.ADCistheanalog-to-digitalconverterchanneltoconfigure.ValidADCresourcesare0x51through0x5F.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIruns

Page 356: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

IfyoudonotcallthisVI,therangedefaultsto–10to+10V.Ifyouknowthattheinputvoltagefallswithinamorerestrictiverange,youcaneffectivelyincreasetheresolutionofthemeasurementsbyselectinganappropriaterangefromthepreviouslist.

NoteWiththe7350motioncontroller,changingtherangeofanADCchangesallotherADCstothesamerange.OtherNImotioncontrollerscansettherangeindependentofotherADCs.

Forexample,ifyouareusinga7340motioncontroller,theinputsignalrangesfrom–3to+3V,andyouselectthe–5to+5Vrange,the4,096discretevaluesfortheADCare2.44mVapartinsteadofthe4.88mVapartwhenusingthe–10to+10Vrange.Ifyouareusinga7350motioncontroller,theinputsignalrangesfrom–3to+3V,andyouselectthe–5to+5Vrange,the65,536discretevaluesfortheADCare152µVapartinsteadofthe305µVapartwhenusingthe–10to+10Vrange.

ADCrangescannotbechangedonanyADCwhileanaxisthatisusinganalogfeedbackisenabled.Youmustfirstdisabletheaxisusinganalogfeedback,thenchangetherange.

Formoreinformation,refertotheReadADCsandEnableADCsVIs.

Page 357: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

SetI/OPortDirectionSetsthedirectionofageneral-purposeI/Oportasinputoroutput.

Details

DeviceCompatibility

Direction(Input)isthebitmapofdirectionsforthebitsintheI/Oport:IfDirectionBit0isTRUE(default)thebitissettoinput.IfitisFALSEthebitissettooutput.IfDirectionBit1isTRUE(default)thebitissettoinput.IfitisFALSEthebitissettooutput.IfDirectionBit2isTRUE(default)thebitissettoinput.IfitisFALSEthebitissettooutput.IfDirectionBit3isTRUE(default)thebitissettoinput.IfitisFALSEthebitissettooutput.IfDirectionBit4isTRUE(default)thebitissettoinput.IfitisFALSEthebitissettooutput.IfDirectionBit5isTRUE(default)thebitissettoinput.IfitisFALSEthebitissettooutput.IfDirectionBit6isTRUE(default)thebitissettoinput.IfitisFALSEthebitissettooutput.IfDirectionBit7isTRUE(default)thebitissettoinput.IfitisFALSEthebitissettooutput.

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfrom

Page 358: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheSetI/OPortDirectionVIconfiguresthebitsinageneral-purposeI/Oportasinputoroutput.Aftersettingthedirection,usetheReadI/OPortVItoreadtheport,theSetI/OPortMOMOVItowritetotheport,andtheSetI/OPortPolarityVItosetthepolarityofeachbitintheporttoactivehighoractivelow.

NoteThedirectionofbitsintheRTSIsoftwareport(port9)iscontrolledwiththeSelectSignalVI.

Page 359: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

SetI/OPortMOMOSetsanI/OportvalueusingtheMustOn/MustOffprotocol.

DetailsRemarks

DeviceCompatibility

MustOffisthebitmapofI/Oportbitstoforceoff.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.MustOnisthebitmapofI/Oportbitstoforceon.InpVectindicatesthesourceofthedataforthisVI.Availableinputvectorsincludeimmediate(0xFF),variable(0x01through0x78),orindirectvariable(0x81through0xF8).RefertoInputandReturnVectorsformoredetailedinformation.Port(1)isthegeneral-purposeI/Oport(1–8)orRTSIsoftwareport(9)tocontrol.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.If

Page 360: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheSetI/OPortMOMOVIsetsthelogicalstateofbitsinthegeneral-purposeI/Oportselected.

UsingtheMustOn/MustOffprotocolallowsyoutosetorresetindividualbitswithoutaffectingotheroutputbitsintheport.Thisgivesyoutri-statecontrolovereachbit:on,offorunchanged.ATrueinabitlocationoftheMustOnbitmapturnsthebiton,whileaTrueinthecorrespondinglocationoftheMustOffbitmapturnsthebitoff.AFalseineitherbitmaphasnoeffect,soleavingboththeMustOnandMustOffbitsatzeroiseffectivelyaholdandthestateofthebitisunchanged.IfyousetboththeMustOnandMustOffbitstoTrue,itisinterpretedasaMustOnconditionandthebitisturnedon.

NoteThisVIsetsthelogicalstateofabitOnorOff(TrueorFalse).ThepolarityofthebitsintheportdetermineswhetheranOnstateisactivehighoractivelow.RefertothePortPolarityVIformoreinformation.NoteWhenexecutingtheSetI/OPortMOMOVIinaLabVIEWprogram,theremaybeadelayofupto0.5msbeforetheoutputlinesarephysicallyupdated.TheLabVIEWprogramflowcontinues,eventhoughtheoutputmaynotbeupdatedyet.NoteIfthemotioncontrollerisprogrammedtousetheportforoutputwhenithasbeenconfiguredforinput,theactionisignored.

TheSetI/OPortMOMOVIallowsindividualcontrolofgeneral-purposeoutputbitswithoutrequiringashadowvalueorareadoftheporttorememberthestateofotherbitsnotbeingsetorresetwiththeVI.

Example

TipThissectionappliestoallNImotioncontrollers.

InI/Oport2,tosetbits1and3On,bits0and5Off,andtoleavetheotherbits(2,4,6,and7)unchanged,callthisVIwiththefollowingparameters:

Port=2MustOncorrespondstothevaluesshowninthefollowingtable.

MustOn0 MustOn1 MustOn2 MustOn3 MustOn4 MustOn5 MustOn6

Page 361: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheSetI/OPortMOMOVIsetsthelogicalstateofbitsinthegeneral-purposeI/Oportselected.

UsingtheMustOn/MustOffprotocolallowsyoutosetorresetindividualbitswithoutaffectingotheroutputbitsintheport.Thisgivesyoutri-statecontrolovereachbit:on,offorunchanged.A

inabitlocationoftheMustOnbitmapturnsthebiton,whileaTrueinthecorrespondingMustOffbitmapturnsthebitoff.AFalseineitherbitmaphasnoeffect,soMustOnandMustOffbitsatzeroiseffectivelyaholdandthestateofthebit

isunchanged.IfyousetboththeMustOnandMustOffbitstoTrue,itisinterpretedasaMustOnconditionandthebitisturnedon.

ThisVIsetsthelogicalstateofabitOnorOff(TrueorFalse).ThepolarityofthebitsintheportdetermineswhetheranOnstateisactivehighoractivelow.RefertotheSetI/O

VIformoreinformation.WhenexecutingtheSetI/OPortMOMOVIinaLabVIEWprogram,theremaybea

delayofupto0.5msbeforetheoutputlinesarephysicallyupdated.TheLabVIEWprogramflowcontinues,eventhoughtheoutputmaynotbeupdatedyet.

Ifthemotioncontrollerisprogrammedtousetheportforoutputwhenithasbeenconfiguredforinput,theactionisignored.

TheSetI/OPortMOMOVIallowsindividualcontrolofgeneral-purposeoutputbitswithoutrequiringashadowvalueorareadoftheporttorememberthestateofotherbitsnotbeingsetorresetwiththeVI.

ThissectionappliestoallNImotioncontrollers.

InI/Oport2,tosetbits1and3On,bits0and5Off,andtoleavetheotherbits(2,4,6,and7)unchanged,callthisVIwiththefollowingparameters:

correspondstothevaluesshowninthefollowingtable.

MustOn1 MustOn2 MustOn3 MustOn4 MustOn5 MustOn6 MustOn7

Page 362: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

AlineconfiguredforinputisnotaffectedbythisVI.YoucanalwayswritetotheRTSIsoftwareport,buttheactualRTSIlinesonthephysicalRTSIportareonlyaffectediftheRTSIlinehasbeenconfiguredproperlybyusingtheSelectSignalVI.Bydefault,noneoftheRTSIlinesareconfiguredtooutputtheircorrespondingbitsintheRTSIsoftwareport;youmustconfigureeachRTSIlineindividuallyusingtheSelectSignalVI,ratherthantheSetI/OPortDirectionVI.ThePCI-7390hasdedicateddirectionI/Oports.Referto73xxControllerGeneral-PurposeI/OPortIDsfortheappropriateportnumbertouseforPort.

Forexample,tosetthestateofoutputport2,Portis0x82(130).Tosetthestateofinputport3,Portis0x03(3).

NISoftMotionControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

RefertoGeneral-PurposeI/OPortsforinformationabouthowtheNISoftMotionControllersupportsdigitalinputandoutputlinesforeachaxis.ForInpVect,theNISoftMotionControllersupportsonlytheimmediatevector(0XFF).TheNISoftMotionControllerhasdedicateddirectionI/Oports.RefertoNISoftMotionControllerGeneral-PurposeI/OPortIDsfortheappropriateportnumbertouseforPort.

Page 363: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

SetI/OPortPolaritySetsthebitpolarityinageneral-purposeI/Oport.

DetailsRemarks

DeviceCompatibility

IOPolarityisthebitmapofactivepolaritiesfortheI/Oport:IfIOPolarityBit0isTRUE(default)thebitissettoactivelow/activeopen.IfitisFALSEthebitissettoactivehigh/activeclosed.IfIOPolarityBit1isTRUE(default)thebitissettoactivelow/activeopen.IfitisFALSEthebitissettoactivehigh/activeclosed.IfIOPolarityBit2isTRUE(default)thebitissettoactivelow/activeopen.IfitisFALSEthebitissettoactivehigh/activeclosed.IfIOPolarityBit3isTRUE(default)thebitissettoactivelow/activeopen.IfitisFALSEthebitissettoactivehigh/activeclosed.IfIOPolarityBit4isTRUE(default)thebitissettoactivelow/activeopen.IfitisFALSEthebitissettoactivehigh/activeclosed.IfIOPolarityBit5isTRUE(default)thebitissettoactivelow/activeopen.IfitisFALSEthebitissettoactivehigh/activeclosed.IfIOPolarityBit6isTRUE(default)thebitissettoactive

Page 364: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheSetI/OPortPolarityVIsetsthepolarity(activestate)ofthegeneral-purposeI/Oportonanindividualbitbasis.

Whenconfiguredasactivelow,theinputoroutputisactivewhenthereisalowsignalonthepin.Conversely,activehighmeansthattheinputoroutputisactivewhenthereisahighsignalonthepin.

Configuringanactivestateofactiveopenoractivecloseddoesnotcorrespondtothelevelofthesignalontheinputoroutputpin.Instead,anactiveopenstatemeansthattheinputoroutputisactivewhencurrentisnotflowingthroughtheoptocoupledinput.Conversely,anactiveclosedstatemeansthattheinputoroutputisactivewhencurrentisflowingthroughtheoptocoupledinput.

Typically,portsandtheirpinsareconfiguredfordirectionandpolarity(activestate)atinitialization.Afterconfiguration,youcanthenreadorwritelogicalstates(TrueorFalse,OnorOff)toportswithoutworryingaboutthephysicalstatesofsignalsontheportpins.

NoteRefertoVIExecutionTimesforbenchmarktiminginformationaboutyourcontroller.

Page 365: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

ThepolarityalsodefinesthelatchingbehaviorfortheRTSIport.InordertodetectshortpulsesonRTSIlines,thehardwarelatchesactive-goingsignalsandholdsthatstateuntiltheportisread.Forexample,ifyouconfigureabitforactivelowpolarity,atransitionfromhightolowislatcheduntilread,evenifthesignalgoeshighagain.Ifthesignalstartslow,itisalsolatcheduntilread,evenifthesignalishighwhenyoureadthebit.ThePCI-7390hasdedicateddirectionI/Oports.Referto73xxControllerGeneral-PurposeI/OPortIDsfortheappropriateportnumbertouseforPort.

Forexample,toconfigurethepolarityoftheoutputportonaxis2,Portis0x82(130).Toconfigurethepolarityoftheinputportonaxis3,Portis0x03(3).

NISoftMotionControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

TheNISoftMotionControllerhasdedicateddirectionI/Oports.RefertoNISoftMotionControllerGeneral-PurposeI/OPortIDsfortheappropriateportnumbertouseforPort.

Forexample,toconfigurethepolarityoftheoutputportonaxis2,Portis0x82(130).Toconfigurethepolarityoftheinputportonaxis3,Portis

Page 366: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Error&UtilityVIsYoucanusetheerrorhandlingVIsandutilityVIstogetinformationaboutthemotioncontroller.RefertoErrorsandErrorHandlingformoreinformationabouterrors.

ClicktheiconsforVIdescriptions.

GetMotionBoardInformation

Getu32

Setu32

SelectResource

SelectMOMO

MotionErrorHandler

ErrorMonitor

Page 367: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Subpalette

AdvancedError&UtilityVIs

Page 368: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ErrorMonitorDisplaystheerrorsreturnedbytheNI-Motionsoftwareandcontroller.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.stopisusedtocontrolthemonitoringprocess.BdIDOutisprovidedforflowcontrol.YoucanstringtogetherNI-MotionVIsbywiringtheBdIDOutterminalofoneVItotheBoardIDterminalofthenextVI.

Page 369: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

ThisVIcanbemadetoruncontinuouslyinthebackgroundasaseparateVItomonitorthemotioncontrollerforerrors.

Page 370: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

GetMotionBoardInformationGetsinformationaboutthepropertiesandfeaturesofthemotioncontroller.

DetailsRemarks

DeviceCompatibility

Desiredinformationrepresentsthetypeofinformationyouwanttoretrieveaboutthemotioncontroller.Thefollowingtablehasacompletelistofinformationvalues,aswellasoutputparametersrelevantforeachtypeofinformationreturned.

DesiredInformation

RelevantOutputTerminal

PossibleOutputValues

BoardFamily(0)

Numericout,Valueout

NI-MotionFamily(0)

BoardName(1)

Stringout Nameofcontroller

PCI_7344(28)PXI_7344(27)PCI_7342(37)

PCI_7340(61)PXI_7340(62)

Page 371: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

ThisVIreturnsselectedinformationaboutNImotioncontrollersincludingcontrollertypeandfamily,bustype,numberofaxes,andsoon.

NI-MotionalsohasfourinformationtypesforretrievingtheversionnumbersandreleasedatesofthefirmwaresegmentsloadedintheonboardFlashROM.AllfirmwaresegmentsarefieldupgradableusingtheUpdateFirmwareoptioninMeasurement&AutomationExplorer.Versionsarereturnedinaversion-buildcodeformat:

Version-buildcode=MMmmbbbb,whereMMisthemajorversionnumber,mmistheminorversionnumber,andbbbbisthebuildnumber.

Page 372: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NISoftMotionControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

TheNISoftMotionControllerdoesnotsupportthefollowingenumerationsfortheDesiredInformationparameter:

FirmwareVersionDSPVersionFPGAVersionFPGA2Version

Page 373: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Getu32Getsthegeneralsoftwaresettings.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.ResourceistheAxis,VectorSpace,ADC,orEncoderyouwiredintotheVI.UseResourceOutputtopasstheresourcetoanotherVIand/ortodisplayinformationaboutthedevice.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.Typically,sourceisthenameoftheVIinwhichtheerroroccurred.

Attributeistheselectorforthetypeofinformationyouwanttoretrieve.

Page 374: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheGetu32VIreturnsselecteddataaboutsoftwaresettings.ThisVIcanretrievevaluesstoredinintegerformat.

Attribute Resource Description PossibleValues

BreakpointWindow

Axisorencoder

Aftertheaxisencountersabreakpoint,theaxismustmoveoutsidethebreakpointwindowbeforeitcanrearmforanotherbreakpoint.Thisisusedtopreventoscillationfromsendingmultiplebreakpointoutputsfromthesamebreakpointposition.Thedefaultis0.

0to255

ProgramAutoStart N/A

Usethisattributetoreturntheonboardprogramthatisenabledforautostart. —

GearingEnableStatus

Axiscontroloraxis

Usethisattributetoreadthegearingenablestatusonanindividualaxisoronaxesonethrougheightusingtheaxiscontrolresource.Readingthestatusonaxesonethrougheightreturnsabitmapwherebit0isthestatusforaxis1andsoon.Readingthestatusonanindividualaxisreturnsabitmapthatismaskedforthataxis.

Foreachbitinthebitmap:1=gearingenabled0=gearingdisabled

UsingUnlistedResources

CompletethefollowingstepstousethisVIonresourcesthatarenotinthedrop-downlist:

1. OpentheVIinLabVIEW.2. Viewtheblockdiagram.3. Right-clicktheResourceterminalandselectCreate»Constant.4. Clickthedrop-downarrowontheResourceconstantandselectOther.

Page 375: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

MotionErrorHandlerChecksformodalerrorsonthecontroller.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.Typically,sourceisthenameoftheVIinwhichtheerroroccurred.

Page 376: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

IfthemodalerrorseverityinputisTRUE(error),modalerrorsaretreatedaserrors.Thefirstmodalerroristhenpassedoutthroughtheerroroutterminal.IfthisinputisFALSE(warning),modalerrorsaretreatedaswarnings.

WhenusingsubVIsthatincorporatetheerrorin/errorout(orerrorI/O)structure,placethishandlerwhereyouwanttoinformtheuserofanerror,typicallyattheendoftheI/Odatapath,asthelastactionoftheprogram.IftheerrorinstatusisTRUE(aredX),thehandlercreatesamessagedescribingtheerroranditssource.

IftheTypeofDialoginputis1(default),themessageisdisplayedtotheuser,whocanonlyacknowledgeit.Ifthisinputis2,theusercanacknowledgethemessageorabortexecution.Iftheinputis0,nomessageisdisplayed;usethisvaluetoprocesstheerrorprogrammatically.

ThisVIalwayschecksformodalerrorsonthecontroller.IftheModalErrorSeverityinputisTRUE(error),modalerrorsaretreatedaserrors.Thefirstmodalerroristhenpassedoutthroughtheerroroutterminal.IfthisinputisFALSE(warning),modalerrorsaretreatedaswarnings.

IftheModalErrorRetrievalModeinputisTRUE(single),onlyonemodalerrorisreadfromthecontroller'serrorstack.IfthisinputisFALSE(all),allofthemodalerrorsonthecontrollerareread.ModalerrorsthatarereadfromthecontrollerareplacedintotheModalError(s)Outoutputarray.

Page 377: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

SelectResourceThisutilityVIisusedtocombineresourceIDsfromanarrayintoasinglebitmap.

Details

DeviceCompatibility

ResourceistheAxis,VectorSpace,ADC,orEncoderyouwiredintotheVI.UseResourceOutputtopasstheresourcetoanotherVIand/ortodisplayinformationaboutthedevice.Bitmapisthebitmapcorrespondingtothecombinationoftheresourcesselected.

Page 378: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

SelectResourceVIisusedtogenerateinputbitmapsforVIsthatoperateonmultipleresources.

ThisVIreturnsabitmapbasedontheresourceIDswiredin.Theorderoftheresourceswiredindoesnotmatter.Thetrue/falsestateofabitinthebitmapiscontrolledbytheresourceIDandnotbythewireposition.

ThisVIisusefulwhenusedwithStart,Stop,andBlendVIs.

Page 379: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

SelectMOMOThisutilityVIisusedtocombineresourceIDsintoasinglebitmap.

Details

DeviceCompatibility

ResourceistheAxis,VectorSpace,ADC,orEncoderyouwiredintotheVI.UseResourceOutputtopasstheresourcetoanotherVIand/ortodisplayinformationaboutthedevice.MustOn/OffThebitmapcorrespondingtothecombinationoftheresourcesselectedinMustOn/MustOffformat.

Page 380: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

SelectMOMOVIisusedtogenerateinputbitmapsforVIsthatusetheMustOn/MustOffformatprotocol.

ThisVIreturnsabitmapbasedontheresourceIDswiredin.Theorderoftheresourceswiredindoesnotmatter.Thetrue/falsestateofabitinthebitmapiscontrolledbytheresourceIDandnotbythewireposition.

ThisVIisusedtogenerateinputbitmapsforVIsthatusetheMustOn/MustOffformatprotocol.

Page 381: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Setu32Setsthegeneralsoftwaresettings.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.ResourceistheAxis,VectorSpace,ADC,orEncoderyouwiredintotheVI.UseResourceOutputtopasstheresourcetoanotherVIand/ortodisplayinformationaboutthedevice.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.Typically,sourceisthenameoftheVIinwhichtheerroroccurred.

Valueistheselectorforthetypeofdatayouwanttoset.

Page 382: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheSetu32VIsetsselectedsoftwaresettingsasspecifiedbyAttribute.ThisVIcansetvaluesstoredinintegerformat.

Thefollowingtableshowstheattributesyoucanset,theirdescriptions,andpossiblevalues:

Attribute Resource Constant Description Values

BreakpointWindow

Axisorencoder 0x0200

Aftertheaxisencountersabreakpoint,theaxismustmoveoutsidethebreakpointwindowbeforeitcanrearmforanotherbreakpoint.Thisisusedtopreventoscillationfromsendingmultiplebreakpointoutputsfromthesamebreakpointposition.Thedefaultis0.

NoteThebreakpointwindowmustbesmallerthanthebreakpointmodulusorperiod.Amodalerrorisgeneratedwhenthebreakpointwindowislargerthantheloadedbreakpointmodulusorperiod.

0to255

Pull-inWindow Axis 0x0400

Forclosed-loopstepperaxes,anareaaroundthetargetpositionthatdetermineswhetherornottodoanymorepull-inmoves.Oncewithinthearea,themotioncontrollerstopsdoingpull-intries.Thedefaultis1.

0to32,767

Pull-inTries Axis 0x0401

Themaximumnumberoftimestheclosed-loopstepperaxistriestoreachthetargetposition.Itwilltryuntilitiswithintherangespecified 0to

32,767

Page 383: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingUnlistedResources

CompletethefollowingstepstousethisVIonresourcesthatarenotinthedrop-downlist:

1. OpentheVIinLabVIEW.2. Viewtheblockdiagram.3. Right-clicktheResourceterminalandselectCreate»Constant.4. Clickthedrop-downarrowontheResourceconstantandselectOther.5. Typetheappropriateresourcenumber,indecimal,fortheresourceyou

wanttoconfigure.RefertoAxes,VectorSpaces,ADCChannels,andEncodersforresourcenumbers.

6. Right-clicktheAttributeterminal,selectCreate»Constant,andselecttheappropriateattributefromthedrop-downlist.

Page 384: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

AdvancedError&UtilityVIsClicktheiconsforVIdescriptions.

ReadErrorMessage

GetLastError

GetErrorDescription

Page 385: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

GetErrorDescriptionGetsanerror,command,and/orresourcedescriptionstring.

Details

DeviceCompatibility

DescriptionType(Combined)istheselectorforthetypeofdescriptionstringtoreturn,asfollows:

Value Description0 ErrorOnly1 CommandNameOnly2 ResourceNameOnly3 CombinedDescriptionResourceIDistheresourceIDofanaxis,vectorspace,encoder,ADC,DAC,orotherresource.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowing

Page 386: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheGetErrorDescriptionVIreturnsastringdescriptionofanerror.YoucanusethisVItogenerateastringfordisplayingaVI'sname,aresource'sname,anerrorcodedescription,oracompleteerrordescriptionstringinresponsetoanerrorcodereturnedfromcallingtheReadErrorMessageVI.

Notallinputparametersarerequiredforeachdescriptiontype.Thefollowingparametersarerequiredtoreturnanaccuratedescriptionstring.

DescriptionType ErrorCode CommandID ResourceIDErroronly required notrequired notrequiredVInameonly notrequired required notrequiredResourcenameonly notrequired required requiredCombineddescription required required required

BecauseresourceIDsarenotunique(forexample,axis1andprogram1bothareresource1),theCommandIDisrequiredtosetthecontextandallowthisVItogeneratetheproperresourcenamestring.

Page 387: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

GetLastErrorGetsdetailedinformationaboutthelasterrorgeneratedbyahigh-levelNI-MotionVIinthecourseofexecutingotherNI-MotionVIs.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.Typically,sourceisthenameoftheVIinwhichtheerroroccurred.

ResourceistheAxis,VectorSpace,ADC,orEncoderthatgeneratedthe

Page 388: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

IftheInitializeControllerVIreturnsanerror,youcancalltheGetLastErrorVItodeterminethespecificNI-MotionVIandresourcegeneratingtheerror.YoucanthencalltheGetErrorDescriptionVI,whichformatsastringforyouwiththeVIname,resourceIDanderrordescription.

Page 389: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadErrorMessageReadsthemostrecentmodalerrorfromtheErrorMessageStack.

DetailsRemarks

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.Typically,sourceisthenameoftheVIinwhichtheerroroccurred.

ResourceistheAxis,VectorSpace,ADC,orEncoderyouwiredintothe

Page 390: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheReadErrorMessageVIretrievesthemostrecentmodalerrorfromthecontrollerandreturnsthecommandIDandresourceIDthatcausetheerror,alongwiththeerrorcode.

NoteSeeErrorCodes,foradescriptionoferrorcodesandpossiblecauses.

Whenamodalerroroccurs,thecommandID,resourceID,anderrorcodeareautomaticallystoredinalast-infirst-outstackandtheErrorMessage(ErrMsg)bitintheCommunicationStatusRegisterissettoindicatethatoneormoreerrorsarepresentonthestack.

ModalerrorsaredefinedaserrorsthatarenotdetectedatthetimeofVIexecution.Foracompletedescription,refertoErrorsandErrorHandling.AcommonsourceofmodalerrorsisimproperlyconstructedVIcallsstoredinanonboardprogram.Whentheprogramisrun,theerrorsgeneratemodalerrormessages.

Becausetheerrormessagesarestoredinalast-in-first-out(LIFO)buffer,themostrecenterrorisavailableimmediately.YoucanreadoldererrorswithadditionalcallstothisVI.Whenthestackisempty,theErrorMessage(ErrMsg)bitintheCommunicationStatusRegisterisreset.YoucangetastringdescriptionoftheerrorbyusingtheGetErrorDescriptionVI.

Normally,iftheapplicationprogramisfunctioningcorrectly,errorsarenotgenerated.Readingtheerrormessagesfromtheboardisusefulduringdebuggingandforhandlingspecialconditions.

Example

AnapplicationprogramrunningonthehostcomputermonitorstheCommunicationStatusRegistertocheckforerrors.IftheErrorMessagebitisset,theprogramsendsaReadErrorMessageVItothecontrollerandthenreactstotheerrorinformationreturned.Dependinguponthetypeoferror

Page 391: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NISoftMotionControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

TheCommandIDreadinisalwayszero(0).TheerrorsstackisalwaysinFIFOmode.

Page 392: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

OnboardProgrammingVIsYoucanuseOnboardProgrammingVIstoload,execute,andsaveonboardprograms.NI-MotionoffersasetofprogrammingVIsandfeaturesthatallowyoutowriteandcontrolautonomousprogramsthatarecompletelyindependentfromthehostcomputer.Youcanexecuteupto10onboardprogramssimultaneously.Thesizeandnumberofprogramsiscompletelyflexible.Itisultimatelylimitedbythe32totalmemoryobjectsintheObjectRegistryorbytotalavailablememory,whicheverisreachedfirst.RefertoBeginProgramStorageformoreinformation.Onboardprogramsruninatime-slicedmanner.RefertotheOnboardProgramssectionoftheNI-MotionHelpformoreinformation.

Onboardprogramssupportbasicmathanddataoperationfunctionsongeneral-purposevariables.Onboardprogramsalsoofferevent-basedVIssuchasJumptoLabelonConditionandWaitonCondition,whichallowyoutocontrolprogramexecution.Programscanevenstartandstopotherprograms.

Implementingpartorallofthemotionapplicationasanonboardprogramorprogramsoffloadsthehostcomputerfromhandlingthesereal-timeevents.Onboardprogramsalsocanisolatetheapplicationfromthehostcomputernon-real-timeoperatingsystem.Onlybuspowerisrequiredtocorrectlyexecuteanonboardprogramafteritisstarted.

ProgramscanberunfromRAMoroptionallysavedtonon-volatileFlashROM.Savedprogramsarethereforeavailableforexecutionatanyfuturetime,evenafterpowercycles.UsetheReadObjectRegistryVItodeterminethesizeofanonboardprogram.RefertoBufferedOperationsVIsforinformationaboutthetotalamountRAMandROMoneachcontroller.

OnboardProgrammingVIsincludeObjectManagementandDataOperationsVIs.YoucanuseOnboardProgrammingVIstobeginandendprogramstorageandtocontrolprogramexecution.YoucanuseObjectManagementVIstoorganize,annotate,andsaveprogramobjectstoROM.DataOperationsVIsincludebasicmathVIsanddataoperations.

SeveralVIsaretypicallyrunfromthehosttocontroltheonboardprogram

Page 393: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

execution,suchastheRunProgram,Pause/Resume,andStopProgramVIs.Whenrunasahostcommand,theseVIsinterrupttheonboardprogramandchangetheprogramstatusaccordingly.

NoteTheOnboardProgrammingVIsarecompatiblewithNI7340/44andNI7350controllersonly.

ClicktheiconsforVIdescriptions.

BeginProgramStorage JumptoLabelonConditionEndProgramStorage SetUserStatusMOMORunProgram WaitonConditionPause/ResumeProgram LoadProgramDelayStopProgram ReadProgramStatusInsertLabel LoadProgramTimeSlice

Page 394: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Subpalettes

ObjectManagementVIs

DataOperationsVIs

Page 395: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

BeginProgramStorageBeginsaprogramstoragesession.

Subsequentcallsarestoredaspartoftheonboardprogram.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Program(1)istheonboardprogramtoreadthestatusof.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.Typically,sourceisthenameoftheVIinwhichtheerroroccurred.

Page 396: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheBeginProgramStorageVIinitiatesprogramstorageinRAM.Aftertheybegin,allsubsequentVIsarestoredinanobjectbufferandnotexecuteduntiltheprogramisrunwiththeRunProgramVI.ThismemorystoragecontinuesuntilyouexecutetheEndProgramStorageVI.Youcanstoreonlyoneprogramatatime.

Thesizeandnumberofprogramsiscompletelyflexible.Itisultimatelylimitedbythe32totalmemoryobjectsintheObjectRegistryorbytotalavailablememory,whicheverisreachedfirst.

The7350and7340havethefollowingonboardmemory:

RAM ROM7340 164ksector 264ksectors7350 264ksectors 464ksectors

YoucanrunprogramsfromeitherRAMorROM,butyoucannotsplitprogramsbetweenthetwo,andyoucannotsplitprogramsbetweenthetwo64KBROMsectors.Withanaveragecommandsizeof10bytes,asingleprogramcanbeaslargeas6,400commands.Asanotherexample,the7350and7340controllerscanexecute10programssimultaneously,fivefromRAMandfivefromROM,witheachprogramupto1,280commandslong.

Notes

Attemptingtostoremorethan32programsgeneratesanerror.Similarly,anerrorisgeneratedifyourunoutofmemoryduringprogramstorage.Bothofthesecasesareextremelyunlikely.DonotstoreonboardprogramswhileotherNI-MotionVIsarerunning.Doingsocanresultinincorrectprogramstorage.Topreventunexpectedinterference,otherapplicationsrunningwithdifferentprocessesarenotabletocommunicatewiththecontrollerduringprogramstorage.

Page 397: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

EndProgramStorageEndsaprogramstoragesession.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Program(1)istheonboardprogramtoreadthestatusof.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.Typically,sourceisthenameoftheVIinwhichtheerroroccurred.

BdIDOutisprovidedforflowcontrol.YoucanstringtogetherNI-MotionVIsbywiringtheBdIDOutterminalofoneVItotheBoardID

Page 398: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheEndProgramStorageVIendsmemorystorageoftheprogram.AllsubsequentVIsareexecutednormally.Youcansaveaprogramtonon-volatilememory(ROM)usingtheObjectMemoryManagementVI.

ThisVImaytakelongerthan62mstoprocess,soitisnotguaranteedtobecompatiblewithreal-timeexecution.

Page 399: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

InsertLabelInsertsalabelinaprogram.

Details

DeviceCompatibility

LabelNumber(1)isanyarbitrarylabelnumberfrom1to65,535.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.Typically,sourceisthenameoftheVIinwhichtheerroroccurred.

BdIDOutisprovidedforflowcontrol.YoucanstringtogetherNI-MotionVIsbywiringtheBdIDOutterminalofoneVItotheBoardIDterminalofthenextVI.erroroutcontainserrorinformation.Iferrorinindicatesanerror,error

Page 400: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheInsertProgramLabelVImarksalocationinthesequenceofaprogram.ThelabelnumberidentifiesthislocationandusesitintheJumptoLabelonConditionVI.Labelnumbersarearbitraryanddonothavetofollowanumericalsequence.

Page 401: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

JumptoLabelonConditionInsertsaconditionaljumpinaprogram.

Details

DeviceCompatibility

MustOff(False)isthebitmapofbitsthatmustbeFalsetosatisfythecondition:

MustOn0—Iftrue,bitmustbefalse.Iffalse,donotcare(default).MustOn1—Iftrue,bitmustbefalse.Iffalse,donotcare(default).MustOn2—Iftrue,bitmustbefalse.Iffalse,donotcare(default).MustOn3—Iftrue,bitmustbefalse.Iffalse,donotcare(default).MustOn4—Iftrue,bitmustbefalse.Iffalse,donotcare(default).MustOn5—Iftrue,bitmustbefalse.Iffalse,donotcare(default).MustOn6—Iftrue,bitmustbefalse.Iffalse,donotcare(default).MustOn7—Iftrue,bitmustbefalse.Iffalse,donotcare(default).MustOn8—Iftrue,bitmustbefalse.Iffalse,donotcare(default).

MustOn(False)isthebitmapofbitsthatmustbeTruetosatisfythecondition:

MustOn0—Iftrue,bitmustbetrue.Iffalse,donotcare(default).MustOn1—Iftrue,bitmustbetrue.Iffalse,donotcare(default).MustOn2—Iftrue,bitmustbetrue.Iffalse,donotcare(default).MustOn3—Iftrue,bitmustbetrue.Iffalse,donotcare(default).

Page 402: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheJumptoLabelonConditionVIcontrolstheflowofexecutioninastoredprogrambydefiningaconditionaljumptoanylabelwithintheprogram.InadditiontoconditioncodessetastheresultofapreviousdataoperationsVI,youcantestvirtuallyanyinstantaneousstatusofaxesorresourcestodecidewhethertojumpornot.

Therearetwodistinctgroupsofconditions.Thefirstgroup,conditions0through5,testtheresultofthemostrecentlogical,mathematical,ordatatransferoperationsVI.RefertotheDataOperationsVIsinformationaboutmathematicalordatatransferoperations.Theseconditioncodestestwhethertheresultofthelatestlogical,mathematical,ordatatransferVIislessthanzero,equaltozero,lessthanorequaltozero,greaterthanzero,notequaltozero,orgreaterthanorequaltozero.Fortheseconditions,theResource,MustOn,MustOff,andMatchTypeparametersarenotrequiredandtheirvaluesareignored.

NoteYoucanprogramunconditionaljumpsbysettingtheconditiontoTrue(6).

Thesecondgroup,conditions7andabove,testaspecificmulti-axis,multi-encoder,program,motionI/O,orgeneral-purposeI/Ostatus.Whereapplicable,youcanselecttheappropriateresourcewiththeresourceparameter.

ProgramCompleteissimilartothefirstconditiongroupinthatMustOn,MustOff,andMatchTypeparametersarenotrequiredandtheirvaluesareignored.Yousetresourceequaltotheappropriateprogramnumbertotest.ThebalanceoftheconditionsinthisgroupteststatusbitmapsandVIssimilartoeachotherasdescribedintheremainderofthissection.

TheMustOn,MustOff,andMatchTypeparametersworktogethertodefineabitmapofTrueandFalsebitsthatmustbematchedtosatisfythecondition.TheMatchTypeparameterallowsyoutoselectbetweenanORmatch,whereanymatchingbitissufficient,andanANDmatch,whereallstatusbitsmustmatchtheTrue/FalsebitmapdefinedbyMustOnandMustOff.

UsingtheMustOn/MustOffprotocolgivesyoutri-statecontrolovereachmatchbit:True,False,orDon'tcare.ATrueinabitlocationoftheMustOnbitmapsetsthematchbittoTrue,whileaTrueinthecorrespondinglocationoftheMustOffbitmapresetsthematchbittoFalse.AFalseineitherbitmaphasnoaffect,soleavingboththeMustOnandMustOffbitsatFalsedefinesthebitasdonotcare.IfyousetboththeMustOnandMustOffbitstoTrue,itisinterpretedasaMustOnconditionandthematchbitissettoTrue.

Page 403: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

TheJumptoLabelonConditionVIcontrolstheflowofexecutioninastoredprogrambydefiningaconditionaljumptoanylabelwithintheprogram.InadditiontoconditioncodessetastheresultofapreviousdataoperationsVI,youcantestvirtuallyanyinstantaneousstatusofaxesorresourcestodecidewhetherto

Therearetwodistinctgroupsofconditions.Thefirstgroup,conditions0through5,testtheresultofthemostrecentlogical,mathematical,ordatatransferoperationsVI.RefertotheDataOperationsVIsformoreinformationaboutmathematicalordatatransferoperations.Theseconditioncodestestwhethertheresultofthelatestlogical,mathematical,ordatatransferVIislessthanzero,equaltozero,lessthanorequaltozero,greaterthanzero,notequaltozero,orgreaterthanorequaltozero.Fortheseconditions,theResource,MustOn,MustOff,andMatchTypeparametersarenotrequiredandtheirvaluesareignored.

YoucanprogramunconditionaljumpsbysettingtheconditiontoTrue(6).

Thesecondgroup,conditions7andabove,testaspecificmulti-axis,multi-encoder,program,motionI/O,orgeneral-purposeI/Ostatus.Whereapplicable,youcanselecttheappropriateresourcewiththeresource

ProgramCompleteissimilartothefirstconditiongroupinthatMustOn,MustOff,andMatchTypeparametersarenotrequiredandtheirvaluesareignored.Yousetresourceequaltotheappropriateprogramnumbertotest.ThebalanceoftheconditionsinthisgroupteststatusbitmapsandVIssimilartoeachotherasdescribedintheremainderofthissection.

TheMustOn,MustOff,andMatchTypeparametersworktogethertodefineabitmapofTrueandFalsebitsthatmustbematchedtosatisfythecondition.TheMatchTypeparameterallowsyoutoselectbetweenanORmatch,whereanymatchingbitissufficient,andanANDmatch,whereallstatusbitsmustmatchtheTrue/FalsebitmapdefinedbyMustOnandMustOff.

UsingtheMustOn/MustOffprotocolgivesyoutri-statecontrolovereachmatchbit:True,False,orDon'tcare.ATrueinabitlocationoftheMustOnbitmapsetsthematchbittoTrue,whileaTrueinthecorrespondinglocationoftheMustOffbitmapresetsthematchbittoFalse.AFalseineitherbitmaphasnoaffect,soleavingboththeMustOnandMustOffbitsatFalsedefinesthebitasdonotcare.IfyousetboththeMustOnandMustOffbitstoTrue,itisinterpretedasaMustOnconditionandthematchbitissetto

Page 404: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadProgramDelayLoadsadelayintoaprogramsequence.

Details

DeviceCompatibility

DelayValue(1ms)isthedelayinmilliseconds.Therangeisfrom1to231–1ms.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.Typically,sourceisthenameoftheVIinwhichtheerroroccurred.

Page 405: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheLoadProgramDelayVIsuspendsprogramexecutionforthenumberofmillisecondsloaded.Programexecutionresumesafterthedelay.Delayscanbeasshortasoneortwomillisecondsoraslongashundredsofhours.

Page 406: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadProgramTimeSliceSpecifiestheminimumtimeanonboardprogramhastorunperwatchdogperiod.

Details

DeviceCompatibility

TimeSlice(ms)istheexecutiontimefortheonboardprogramperwatchdogperiod.Defaultis2ms.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Programistheprogramnumber.Validprogramnumbersare1through255(0x01through0xFF).InpVectindicatesthesourceofthedataforthisVI.Availableinputvectorsincludeimmediate(0xFF),variable(0x01through0x78),orindirectvariable(0x81through0xF8).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,or

Page 407: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

LoadProgramTimeSlicespecifiestheminimumtimeanonboardprogramhastorunperwatchdogperiod.

NoteThisVIcanonlyberunasapartofonboardprogram;thehostcannotchangethetimesliceofaprogramdirectly.

Somethingstorememberwhenchangingthetimesliceofanonboardprogram:

Atotalof20msisallowedforallrunningonboardprograms.Everyonboardprogramloadswithadefault2mstimesliceunlessLoadProgramTimeSliceisexecutedatthebeginningoftheonboardprogram.Thedefaultvalueof2msiscalculatedbasedonmaximum10onboardprogramsrunningsimultaneouslywithequaltimeslice.Youcanassigndifferenttimeslicesforeachstoredonboardprogramaslongasthetotaloftimeslicefortherunningonboardprogramdoesnotexceed20msatanygiventime.

Forexample,supposeyouhavethefollowingonboardprogramscurrentlystored:

1. Onboardprogram1,timeslice=10ms2. Onboardprogram2,timeslice=10ms3. Onboardprogram3,timeslice=5ms4. Onboardprogram4,timeslice=4ms5. Onboardprogram5,timeslice=1ms

Youcouldrunprograms1and2simultaneouslywithouterror,becausethetotaltimeslicesofthetworunningprogramsis20ms.Ifyouthenstartprogram3,anNIMC_invalidTimeSlicemodalerroroccursbecausethenewtotaltimesliceis25ms.Theavailabletimesliceforanonboardprogramalsodependsontheorderinwhichtheprogramsarerun,becauseauser-definedtimeslicetakeseffectonlywhentheonboardprogramactuallyruns,andnotwhenitisstored.

Page 408: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Pause/ResumeProgramPausesarunningprogramorresumesexecutionofapausedprogram.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Program(1)istheonboardprogramtoreadthestatusof.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.Typically,sourceisthenameoftheVIinwhichtheerroroccurred.

Page 409: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

ThePause/ResumeProgramVIsuspendsexecutionofarunningprogramorresumesexecutionofapausedprogram.

Aprogramcanpauseorresumeexecutionofanotherprogram,andalsocanpause(butnotresume)itself.

NotePausingaprogramdoesnotaffectamovealreadystartedandinprogress.ItdoesnotimplementaStopMotionVI.

Anyrun-time(modal)errorinaprogramautomaticallypausestheprograminadditiontogeneratingtheerrormessage.RefertotheReadErrorMessageVIandErrorsandErrorHandlingforinformationabouterrors.

AprogramalsocanautomaticallypauseifyouexecuteaStopMotionVIfromthehostcomputeronanaxisoraxesundercontroloftheonboardprogram.Inthesecases,theprogrampauseswhenitattemptstoexecuteaStartMotionorBlendMotionVIonthestoppedaxes.Thisautomaticpausealsoapplieswhenthestopisduetoalimit,home,softwarelimit,orfollowingerrorcondition.

Youcaneffectivelysingle-stepthroughanonboardprogrambyhavingtheprogrampauseaftereveryVI,andthenresumingtheprogramfromthehostcomputer.

Systemtimedoesnotpausewhenyoupauseaprogram.PausingmerelystopsthenextVIfromexecuting.ThismeansthatadelaycounterfromLoadProgramDelaykeepscountingdownevenwhiletheonboardprogramispaused.Forexample,ifyouloadbothadelayoffivesecondsandthenpausetheprogramfor10seconds,youhaveatotalofonly10secondsbeforeexecutionoftheonboardprogramresumes.

Page 410: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadProgramStatusReadsthestatusofanonboardprogram.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Program(1)istheonboardprogramtoreadthestatusof.RetnVectindicatesthedestinationforthereturndatageneratedbythisVI.Availablereturnvectorsincludereturndatatothehost(0xFF),toavariable(0x01through0x78),toanindirectvariable(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,

Page 411: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

YoucanusethisVItodeterminethestateofanonboardprogram.Youcanonlyreadthestateofotherprogramsfromanonboardprogram.

Page 412: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

RunProgramRunsapreviouslystoredprogram.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Program(1)istheonboardprogramtoreadthestatusof.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.Typically,sourceisthenameoftheVIinwhichtheerroroccurred.

BdIDOutisprovidedforflowcontrol.YoucanstringtogetherNI-MotionVIsbywiringtheBdIDOutterminalofoneVItotheBoardIDterminalofthenextVI.ResourceOutistheAxis,VectorSpace,ADC,orEncoderyouwiredinto

Page 413: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheRunProgramVIinitiatesexecutionoftheVIsstoredintheselectedprogram.YoucanrunprogramsoutofeitherRAMorROM.Youcanrunuptoten(10)programssimultaneously.

Aprogramcanrunanotherprogrambutyoucannothaveaprogramrunitself.AttemptingtostorearecursiveRunProgramVIinaprogramgeneratesanerroranddoesnotstoretheVI.

Page 414: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

SetUserStatusMOMOControlstheuserstatusbitsintheMCSregister.

Details

DeviceCompatibility

MustOffisthebitmapofuserstatusbitstoforceFalse:Motionstatusregister13—Iftrue,userstatusbitforcedfalse.Iffalse,userstatusbitunchanged(default).Motionstatusregister14—Iftrue,userstatusbitforcedfalse.Iffalse,userstatusbitunchanged(default).Motionstatusregister15—Iftrue,userstatusbitforcedfalse.Iffalse,userstatusbitunchanged(default).

MustOnisthebitmapofuserstatusbitstoforceTrue:Motionstatusregister13—Iftrue,userstatusbitforcedtrue.Iffalse,userstatusbitunchanged(default).Motionstatusregister14—Iftrue,userstatusbitforcedtrue.Iffalse,userstatusbitunchanged(default).Motionstatusregister15—Iftrue,userstatusbitforcedtrue.Iffalse,userstatusbitunchanged(default).

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralready

Page 415: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheSetUserStatusMOMOVIcontrolstheupperthreebitsintheMCSregisterusingtheMustOn/MustOffprotocol.YoucanusethisVIinprogramstoreportspecialconditionsbacktothehostcomputerbysettingandresettingoneormoreofthesebits.RefertotheReadMoveCompleteStatusVIformoreinformationaboutusingtheMCSregisterforhigh-speedpolling.

UsingtheMustOn/MustOffprotocolallowsyoutosetorresetindividualuserstatusbitswithoutaffectingtheotheruserstatusbits.Thisgivesyoutri-statecontrolovereachbit:True,False,orUnchanged.ATrueinabitlocationoftheMustOnbitmapsetstheuserstatusbithigh,whileaTrueinthecorrespondinglocationoftheMustOffbitmapresetstheuserstatusbitlow.AFalseineitherbitmaphasnoaffect,soleavingboththeMustOnandMustOffbitsatzeroiseffectivelyahold,andthestateoftheuserstatusbitisunchanged.IfyousetboththeMustOnandMustOffbitstoTrue,itisinterpretedasaMustOnconditionandtheuserstatusbitissethigh.

Example

Afteraconditionaljumpinaprogram,youwanttheprogramtoflagthehostwithasuccesscode.ThiscanbeaccomplishedbystoringtheSetUserStatusMOMOwithMustOnandMustOffasfollows.

MustOn13 MustOn14 MustOn15True False TrueMustOff13 MustOff14 MustOff15False True False

Thisforcesuserstatusbits13and15Trueanduserstatusbit14low.AsubsequentpolloftheMCSregisterreturnsMoveCompleteStatuswiththerelevantbitssetasfollows.

Status13 Status14 Status15True False True

Page 416: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

StopProgramStopsarunningprogram.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Program(1)istheonboardprogramtostop.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.Typically,sourceisthenameoftheVIinwhichtheerroroccurred.

BdIDOutisprovidedforflowcontrol.YoucanstringtogetherNI-MotionVIsbywiringtheBdIDOutterminalofoneVItotheBoardIDterminalofthenextVI.ResourceOutistheAxis,VectorSpace,ADC,orEncoderyouwiredinto

Page 417: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheStopProgramVIterminatesexecutionofarunningprogram.Youcannotresumeastoppedprogrambutyoucanre-runtheprogramfromthebeginning.

Aprogramcanstopanotherprogrambutyoucannothaveaprogramstopitself.AttemptingtostorearecursiveStopProgramVIinaprogramgeneratesanerroranddoesnotstoretheVI.

NoteStoppingaprogramdoesnotaffectamovealreadystartedandinprogress.ItdoesnotimplementaStopMotionVI.

Page 418: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

WaitonConditionInsertsaconditionalwaitinaprogram.

Details

DeviceCompatibility

Timeout(1)isthewaittimeoutvaluein100millisecondincrements.Therangeis0to65,534.Ifyouspecifyatimeoutof65,535,itistreatedasaninfinitetimeout,andwillwaituntiltheconditionismet.MustOffisthebitmapofbitsthatmustbeFalsetosatisfythecondition:

MustOff0—Iftrue,bitmustbefalse.Iffalse,donotcare(default).MustOff1—Iftrue,bitmustbefalse.Iffalse,donotcare(default).MustOff2—Iftrue,bitmustbefalse.Iffalse,donotcare(default).MustOff3—Iftrue,bitmustbefalse.Iffalse,donotcare(default).MustOff4—Iftrue,bitmustbefalse.Iffalse,donotcare(default).MustOff5—Iftrue,bitmustbefalse.Iffalse,donotcare(default).MustOff6—Iftrue,bitmustbefalse.Iffalse,donotcare(default).MustOff7—Iftrue,bitmustbefalse.Iffalse,donotcare(default).MustOff8—Iftrue,bitmustbefalse.Iffalse,donotcare(default).

MustOnisthebitmapofbitsthatmustbeTruetosatisfythecondition:MustOn0—Iftrue,bitmustbetrue.Iffalse,donotcare(default).MustOn1—Iftrue,bitmustbetrue.Iffalse,donotcare(default).MustOn2—Iftrue,bitmustbetrue.Iffalse,donotcare(default).MustOn3—Iftrue,bitmustbetrue.Iffalse,donotcare(default).

Page 419: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheWaitonConditionVIcontrolstheflowofexecutioninastoredprogram.Itsuspendsprogramexecutionandwaitsuntilthespecifiedconditionismetorthetimeoutexpires.Whentheconditionismet,programexecutionisresumedwiththenextVIaftertheWaitonCondition.Eventhoughtheprogramissuspended,theprogramstatusreadusingReadProgramStatusisstillrunning.

Ifthetimeoutexpiresbeforetheconditionismet,anerrorisgeneratedandtheprogramgoesintothepausedstate.RefertothePause/ResumeProgramVIforinformationaboutresumingapausedprogram.

Ifyousetatimeoutofzero,theconditionmustalreadybetrueoranerrorisgenerated.

Youcanwaitonvirtuallyanyinstantaneousstatusofaxes,encoders,programs,motionI/O,orgeneral-purposeI/O.Whereapplicable,youcanselectthespecifiedresourcewiththeresourceparameter.

WhenwaitingonaprogramwiththeProgramCompletedcondition,MustOn,MustOff,andMatchTypeparametersarenotrequiredandtheirvaluesareignored.Yousetresourceequaltotheprogramnumbertowaiton.ThebalanceoftheconditionsteststatusbitmapsandVIsimilartoeachotherasdescribedintheremainderofthissection.

TheMustOn,MustOff,andMatchTypeparametersworktogethertodefineabitmapofTrueandFalsebitsthatmustbematchedtosatisfythecondition.Dependingonthetypeofevent,theMustOnandMustOffbitmapsareeitheronebasedorzerobased.IftheeventistiedtoanI/Oportresourcethebitmapsstartatbit0tocorrespondwithline0onanI/Oport.Iftheeventistiedtoanaxis-basedresource,suchasanencoderoranaxis,thebitmapsstartatbit1tocorrespondwithaxis1.TheMatchTypeparameterallowsyoutoselectbetweenanORmatch,whereanymatchingbitissufficient,andanANDmatch,whereallstatusbitsmustmatchtheTrue/FalsebitmapdefinedbyMustOnandMustOff.

UsingtheMustOn/MustOffprotocolgivesyoutri-statecontrolovereach

Page 420: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

DataOperationsVIsDataOperationVIsincludetheavailablemathVIsongeneral-purposevariables.Variablescanbeloaded,added,multiplied,ANDed,andsoonbeforebeingusedasdatainamotioncontrolVI.

General-purposevariablesare32bitslongandcanbeusedeithersigned(i32)orunsigned(u32).AllDataOperationVIsoperateon32-bitvaluesandreturn32-bitvalues.Youmustbecarefultoavoidoverflowandunderflowconditions.Forexample,multiplyingtwo32-bitvariablesandreturningtheresulttoa32-bitvariablemightoverflowandwraparound.

Smallersizeddataisrightalignedwithina32-bitvariable.BitwiselogicalVIsalwaysassumethisalignmentandreturnsimilarlyalignedresults.

ManyNI-MotionVIscantakeinputdatafromageneral-purposevariablebypointingtothevariablewiththeinputvectorparameter.Similarly,allreadVIscanreturndatatoageneral-purposevariablebyusingthereturnvectorparameter,refertoInputandReturnVectors.

AlldataoperationVIssetconditioncodes(lessthan,equaltoorgreaterthanzero)dependingontheresultoftheoperation.YourprogramcantesttheseconditionswiththeJumptoLabelonConditionVI.ExecutingadataoperationsVIwithareturnvectorofzero(0)tellstheprogramtosettheconditioncodeandthenthrowtheresultingdataaway.Inthisway,youcanuseallthedataoperationsVIsastestsforconditionalbranching.

YoucanuseindirectvariablesasvariableinputsorreturnvectorswithalldataoperationVIs.

ClicktheiconsforVIdescriptions.

Page 421: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

AddVariables ExclusiveORVariablesSubtractVariables InvertVariableMultiplyVariables LogicalShiftVariableDivideVariables LoadConstanttoVariableANDVariables ReadVariableORVariables

Page 422: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

AddVariablesAddsthevaluesinthetwovariablesandreturnstheresult.

Details

DeviceCompatibility

Var2isthevariableholdingthesecondoperand.Validinputsarevariables(0x01through0x78)andindirectvariables(0x81through0xF8).Var1isthevariableholdingthefirstoperand.Validinputsarevariables(0x01through0x78)andindirectvariables(0x81through0xF8).BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.RetVectindicatesthedestinationforthereturndatageneratedbythisVI.Availablereturnvectorsincludereturndatatothehost(0xFF),returndatatoavariable(0x01through0x78),returndatatoanindirectvariable(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.

Page 423: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheAddVariablesVIaddsthevaluesinthetwovariablesandreturnstheresulttothedestinationspecifiedbytheRetVect.

V1+V2=Result

where:V1isthevalueatVar1.V2isthevalueatVar2.ResultisstoredinthelocationpointedtobyRetVect.

Theresultcanbereturnedtoanewvariableoroneofthetwoinputvariables,returnedtothehostcomputer,orthrownaway.Inallcasestheconditioncodesaresetaccordingtotheresultingvalue.Thisvalueiscomparedwith0,andtheappropriateconditioncodeisset:GREATERTHAN,LESSTHAN,orEQUALtozero.

NoteBecarefulwhenaddingtwolargevalues.Theresultcouldoverflowandwraparound.Noerrorgenerateswhenanoverflowoccurs.

Page 424: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ANDVariablesPerformsabitwiseANDofthevaluesinthetwovariablesandreturnstheresult. DeviceCompatibility

Var2isthevariableholdingthesecondoperand.Validinputsarevariables(0x01through0x78)andindirectvariables(0x81through0xF8).Var1isthevariableholdingthefirstoperand.Validinputsarevariables(0x01through0x78)andindirectvariables(0x81through0xF8).BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.RetVectindicatesthedestinationforthereturndatageneratedbythisVI.Availablereturnvectorsincludereturndatatothehost(0xFF),returndatatoavariable(0x01through0x78),returndatatoanindirectvariable(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,or

Page 425: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheANDVariablesVIperformsabitwiselogicalANDofthevaluesinthetwovariablesandreturnstheresulttothedestinationspecifiedbytheRetVect.

V1ANDV2=Result

where:V1isthevalueatVar1.V2isthevalueatVar2.ResultisstoredinthelocationpointedtobyRetVect.

Theresultcanbereturnedtoanewvariableoroneofthetwoinputvariables,returnedtothehostcomputer,orthrownaway.Theresultingvalueiscomparedtozero,andtheappropriateconditioncodeisset:GREATERTHAN,LESSTHAN,orEQUALtozero.TheEQUALconditioncodeissetTrueiftheresultequalszero(allbitslow)andFalseifanybitisset.TheGREATERTHANandLESSTHANcodesarealsosetbutcanbeconfusingafterlogicalbitwiseoperations.

Example

IfthevaluesinVar1andVar2are0x00001234and0x0000EEEE,respectively,theresultofthebitwiseANDis0x00000224whichisNOTEQUALtozero.

Page 426: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

DivideVariablesDividesthevalueinthefirstvariablebythevalueinthesecondvariableandreturnstheresult.

Details

DeviceCompatibility

Var2isthevariableholdingthesecondoperand.Validinputsarevariables(0x01through0x78)andindirectvariables(0x81through0xF8).Var1isthevariableholdingthefirstoperand.Validinputsarevariables(0x01through0x78)andindirectvariables(0x81through0xF8).BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.RetVectindicatesthedestinationforthereturndatageneratedbythisVI.Availablereturnvectorsincludereturndatatothehost(0xFF),returndatatoavariable(0x01through0x78),returndatatoanindirectvariable(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowing

Page 427: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheDivideVariablesVIdividesthevalueinthefirstvariablebythevalueinthesecondvariableandreturnstheresulttothedestinationspecifiedbytheRetVect.

V1/V2=Result

where:V1isthevalueatVar1.V2isthevalueatVar2.ResultisstoredinthelocationpointedtobyRetVect.

Theresultcanbereturnedtoanewvariableoroneofthetwoinputvariables,returnedtothehostcomputerorthrownaway.Inallcasestheconditioncodesaresetaccordingtotheresultingvalue.Theresultingvalueiscomparedtozero,andtheappropriateconditioncodeisset:GREATERTHAN,LESSTHAN,orEQUALtozero.

NoteThisVIdoesanintegerdivideandtheremainderislost.NoteIfV2=0theVIreturnstheinvalidfunctiondatamodalerror(-70078).

Page 428: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ExclusiveORVariablesPerformsabitwiseExclusiveOR(XOR)ofthevaluesinthetwovariablesandreturnstheresult.

Details

DeviceCompatibility

Var1isthevariableholdingthefirstoperand.Validinputsarevariables(0x01through0x78)andindirectvariables(0x81through0xF8).Var2isthevariableholdingthesecondoperand.Validinputsarevariables(0x01through0x78)andindirectvariables(0x81through0xF8).BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.RetVectindicatesthedestinationforthereturndatageneratedbythisVI.Availablereturnvectorsincludereturndatatothehost(0xFF),returndatatoavariable(0x01through0x78),returndatatoanindirectvariable(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

Page 429: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheExclusiveORVariablesVIperformsabitwiselogicalXORofthevaluesinthetwovariablesandreturnstheresulttothedestinationspecifiedbytheRetVect.

V1XORV2=Result

where:V1isthevalueatVar1.V2isthevalueatVar2.ResultisstoredinthelocationpointedtobyRetVect.

Theresultcanbereturnedtoanewvariableoroneofthetwoinputvariables,returnedtothehostcomputerorthrownaway.Theresultingvalueiscomparedtozero,andtheappropriateconditioncodeisset:GREATERTHAN,LESSTHAN,orEQUALtozero.TheEQUALconditioncodeissetTrueiftheresultequalszero(allbitslow)andFalseifanybitisset.TheGREATERTHANandLESSTHANcodesarealsosetbutcanbeconfusingafterlogicalbitwiseoperations.

Example

IfthevaluesinVar1andVar2are0x5A5A1234and0xFFFF4321,respectively,theresultofthebitwiseXORis0xA5A55115whichisNOTEQUALtozero.

Page 430: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

InvertVariablePerformsabitwiseinversion(NOT)onthevalueinavariableandreturnstheresult.

Details

DeviceCompatibility

Var1isthelocationofthevariabletoinvert.Validinputsarevariables(0x01through0x78)andindirectvariables(0x81through0xF8).BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.RetVectindicatesthedestinationforthereturndatageneratedbythisVI.Availablereturnvectorsincludereturndatatothehost(0xFF),returndatatoavariable(0x01through0x78),returndatatoanindirectvariable(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroora

Page 431: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheInvertVariableVIperformsabitwiselogicalNOTonthevalueintheselectedvariableandreturnstheresulttothedestinationspecifiedbytheRetVect.

~(V1)=Result

where:V1isthevalueatVar1.ResultisstoredinthelocationpointedtobyRetVect.

Theresultcanbereturnedtoanewvariableortotheinputvariable,returnedtothehostcomputer,orthrownaway.Inallcasestheconditioncodesaresetaccordingtotheresultingvalue.Theresultingvalueiscomparedtozero,andtheappropriateconditioncodeisset:GREATERTHAN,LESSTHAN,orEQUALtozero.TheEQUALconditioncodeissettoTrueiftheresultequalszero(allbitslow)andFalseifanybitisset.TheGREATERTHANandLESSTHANcodesarealsosetbutcanbeconfusingafterlogicalbitwiseoperations.

Example

IfthevalueinVar1is0x00005A5A,theresultofthebitwiseNOTis0xFFFFA5A5.TheEQUALconditioncodeissettoFalse.

Page 432: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadConstanttoVariableLoadsaconstantvalueintoavariable.

Details

DeviceCompatibility

Value(0)isthevaluetoloadintothevariable.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Varisthevariabletoload.Validinputsarevariables(0x01through0x78)andindirectvariables(0x81through0xF8).errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.

Page 433: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheLoadConstanttoVariableVIloadsaconstantvalueintotheselectedvariable.

Theconditioncodesaresetaccordingtotheloadedvalue,GREATERTHAN,LESSTHAN,orEQUALtozero.

Page 434: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LogicalShiftVariablePerformsalogicalshiftonthevalueinavariableandreturnstheresult.

Details

DeviceCompatibility

LogicalShiftisthenumberofbitstoshift.ApositiveLogicalShiftvalueshiftsVar1totheleftandanegativevalueshiftsVar1totheright.Theshiftrangeis-31through+31bits.Var1isthevariableholdingthevaluetoshift.Validinputsarevariables(0x01through0x78)andindirectvariables(0x81through0xF8).BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.RetVectindicatesthedestinationforthereturndatageneratedbythisVI.Availablereturnvectorsincludereturndatatothehost(0xFF),returndatatoavariable(0x01through0x78),returndatatoanindirectvariable(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowing

Page 435: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheLogicalShiftVariableVIperformsalogicalshiftonthevalueintheselectedvariableandreturnstheresulttothedestinationspecifiedbytheRetVect.

ForpositiveLogicalShiftvalues:

V1«LogicalShift=Result

FornegativeLogicalShiftvalues:

V1»LogicalShift=Result

where:V1isthevalueatVar1.ResultisstoredinthelocationpointedtobyRetVect.

Theresultcanbereturnedtoanewvariableortotheinputvariable,returnedtothehostcomputerorthrownaway.Inallcasestheconditioncodesaresetaccordingtotheresultingvalue,GREATERTHAN,LESSTHAN,orEQUALtozero.

ThisVIactuallyperformsanarithmeticratherthanlogicalshiftifthevariableisasigned32-bitvalue(i32).Negativevaluesaresign-extendedwhenshiftedtotheright.YoucanusethisVItoperformdivisionorscalingofsignedorunsignednumbers.InthiscasetheVIeffectivelyperformsthefollowing:

V1×2(LogicalShift)=Result

Example1

IfthevalueinVar1is0x0000F002andLogicalShift=–1,thisVIreturns0x00007801.

Example2

Page 436: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

MultiplyVariablesMultipliesthevaluesinthetwovariablesandreturnstheresult.

Details

DeviceCompatibility

Var2isthevariableholdingthesecondoperand.Validinputsarevariables(0x01through0x78)andindirectvariables(0x81through0xF8).Var1isthevariableholdingthefirstoperand.Validinputsarevariables(0x01through0x78)andindirectvariables(0x81through0xF8).BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.RetVectindicatesthedestinationforthereturndatageneratedbythisVI.Availablereturnvectorsincludereturndatatothehost(0xFF),returndatatoavariable(0x01through0x78),returndatatoanindirectvariable(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,or

Page 437: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheMultiplyVariablesVImultipliesthevaluesinthetwovariablesandreturnstheresulttothedestinationspecifiedbytheRetVect.

V1×V2=Result

where:V1isthevalueatVar1.V2isthevalueatVar2.ResultisstoredinthelocationpointedtobyRetVect.

Theresultcanbereturnedtoanewvariableoroneofthetwoinputvariables,returnedtothehostcomputerorthrownaway.Inallcasestheconditioncodesaresetaccordingtotheresultingvalue.Theresultingvalueiscomparedtozero,andtheappropriateconditioncodeisset:GREATERTHAN,LESSTHAN,orEQUALtozero.

NoteBecarefulwhenmultiplyingtwolargevalues.Theresultcanoverflowandwraparound.Anerrorisnotgeneratedwhenanoverflowoccurs.

Page 438: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ORVariablesPerformsabitwiseORofthevaluesinthetwovariablesandreturnstheresult.

Details

DeviceCompatibility

Var2isthevariableholdingthesecondoperand.Validinputsarevariables(0x01through0x78)andindirectvariables(0x81through0xF8).Var1isthevariableholdingthefirstoperand.Validinputsarevariables(0x01through0x78)andindirectvariables(0x81through0xF8).BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.RetVectindicatesthedestinationforthereturndatageneratedbythisVI.Availablereturnvectorsincludereturndatatothehost(0xFF),returndatatoavariable(0x01through0x78),returndatatoanindirectvariable(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.If

Page 439: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheORVariablesVIperformsabitwiselogicalORofthevaluesinthetwovariablesandreturnstheresulttothedestinationspecifiedbytheRetVect.

V1ORV2=Result

where:V1isthevalueatVar1.V2isthevalueatVar2.ResultisstoredinthelocationpointedtobyRetVect.

Theresultcanbereturnedtoanewvariableoroneofthetwoinputvariables,returnedtothehostcomputerorthrownaway.Theresultingvalueiscomparedtozero,andtheappropriateconditioncodeisset:GREATERTHAN,LESSTHAN,orEQUALtozero.TheEQUALconditioncodeissetTrueiftheresultequalszero(allbitslow)andFalseifanybitisset.TheGREATERTHANandLESSTHANcodesarealsosetbutcanbeconfusingafterlogicalbitwiseoperations.

Example

IfthevaluesinVar1andVar2are0x5A5A1234and0x82820000,respectively,theresultofthebitwiseORis0xDADA1234whichisNOTEQUALtozero.

Page 440: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadVariableReadsthevalueofavariableandreturnstheresult.

Details

DeviceCompatibility

Varisthevariabletoread.Validinputsarevariables(0x01through0x78)andindirectvariables(0x81through0xF8).BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.RetVectindicatesthedestinationforthereturndatageneratedbythisVI.Availablereturnvectorsincludereturndatatothehost(0xFF),returndatatoavariable(0x01through0x78),returndatatoanindirectvariable(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningof

Page 441: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheReadVariableVIreadsthevalueoftheselectedvariableandreturnsittothedestinationspecifiedbytheRetVect.

IfthevalueofRetnVectissettoReturntoHost(0xFF),thisVIalsoreadsthevaluefromthereturndatabufferandpassesitbackasoutput.

Theconditioncodesaresetaccordingtothevalueread:GREATERTHAN,LESSTHANorEQUALtozero.

Page 442: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

SubtractVariablesSubtractsthevalueofsecondvariablefromthevalueofthefirstvariableandreturnstheresult.

Details

DeviceCompatibility

Var2isthevariableholdingthesecondoperand.Validinputsarevariables(0x01through0x78)andindirectvariables(0x81through0xF8).Var1isthevariableholdingthefirstoperand.Validinputsarevariables(0x01through0x78)andindirectvariables(0x81through0xF8).BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.RetVectindicatesthedestinationforthereturndatageneratedbythisVI.Availablereturnvectorsincludereturndatatothehost(0xFF),returndatatoavariable(0x01through0x78),returndatatoanindirectvariable(0x81through0xF8),anddonotreturndata(0).RefertoInputandReturnVectorsformoredetailedinformation.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

Page 443: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheSubtractVariablesVIsubtractsthevalueofsecondvariablefromthevalueofthefirstvariableandreturnstheresulttothedestinationspecifiedbytheRetVect.

V1–V2=Result

where:V1isthevalueatVar1.V2isthevalueatVar2.ResultisstoredinthelocationpointedtobyRetVect.

Theresultcanbereturnedtoanewvariableoroneofthetwoinputvariables,returnedtothehostcomputerorthrownaway.Inallcasestheconditioncodesaresetaccordingtotheresultingvalue.Thisvalueiscomparedwith0,andtheappropriateconditioncodeisset:GREATERTHAN,LESSTHAN,orEQUALtozero.

ThisVIisoftenusedtocomparetwovaluespriortoexecutingaconditionaljumpwiththeJumptoLabelonConditionVI.Inthiscase,theresultistypicallythrownawaybysettingRetVect=0.

Page 444: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ObjectManagementVIsYoucanuseObjectManagementVIstoorganize,annotate,andsaveprogramorbufferobjectstoflashROM.TheseadvancedVIsareprimarilyusedforapplicationsthatrequirenon-volatileprogramstorage.YoucanrunprogramsoutofRAMandcreateandusebuffersinRAMwithoutusinganyoftheseVIs.

ClicktheiconsforVIdescriptions.

ObjectMemoryManagement

LoadMemoryObjectDescription

ReadMemoryObjectDescription

ReadObjectRegistry

Page 445: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

LoadMemoryObjectDescriptionLoadsanASCIItextdescriptionforaprogramorbufferobject.

Details

DeviceCompatibility

DescriptionisanASCIIcharacterarrayofupto32charactersthatdescribestheobject.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Object(1)isaprogramorbufferstoredinonboardRAM.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningof

Page 446: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheLoadMemoryObjectDescriptionVIloadsatextdescriptionforaprogramorbufferobject.TheASCIItextdescriptionisusefulasaquickreminderofthecontentsorpurposeofanobjectstoredinmemory.

NoteThisVImustbeexecutedwhiletheobjectisstillinRAM.AftertheobjectissavedtoROM,itsdescriptioncannotbechanged.

Thedescriptionislimitedto32characters;extracharactersareignored.YoucanretrievethestoreddescriptionwiththeReadMemoryObjectDescriptionVI.

Page 447: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ObjectMemoryManagementSaves,deletes,orfreesprogramsorbuffersinRAMandROM.

Details

DeviceCompatibility

Operationistheoperationtoperformonthememoryobject,asfollows:

Value Definition0 Save1 Delete2 FreeBoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Object(1)isaprogramorbufferstoredinonboardRAM.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.

Page 448: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheObjectMemoryManagementVIisusedtosavetoROM,deletefromROM,orfreefromRAM,aprogramorbufferobject.Objectssavedtonon-volatileFlashROMareavailableforuseatanyfuturetime,evenafterpowercycles.

TosaveanobjecttoROM,callthisVIwithOperation=Save.TheobjectiscopiedtoROMandexistsinbothRAMandROMuntilthenextpowercycle,whentheRAMimageiserased.

ToremoveanobjectfromROM,callthisVIwithOperation=Delete.TheobjectisdeletedfrombothROMandRAM(ifitstillexistsinRAM).

AfteryouhavesavedanobjecttoROM,youcanfreeupitsspaceinRAMbycallingthisVIwithOperation=Free.ThishasnoeffectonthecopyinROMbutdeletestheimageinRAM,makingmorememoryavailableforstoringadditionalprogramsorotherobjects.

NoteYoucannotsaveordeleteanobjectwhileanyprogramisrunningoranybufferisinuse.Also,youcannotfreeaprogramorbufferwhileitisrunning.Inaddition,youcannotsaveordeleteanobjectwhenanymotorismoving.AttemptingtoexecutethisVIinthesecasesgeneratesanerror.

Youcandeleteabufferthatisactive,suchasahigh-speedcapturebufferthatiswaitingforatrigger,butNI-Motionreturnsanerrorinthiscase.TipSavingordeletinganobjecttakes2to4seconds.

The7340controllerhas64KBofRAMplus128KBofROM(dividedintotwo64KBsectors)forprogramandbufferstorage.YoucanrunprogramsfromeitherRAMorROM,butyoucannotsplitprogramsbetweenthetwo,andyoucannotsplitprogramsbetweenthetwo64KBROMsectors.Withanaveragecommandsizeof10bytes,asingleprogramcanbeaslargeas6,400commands.Asanotherexample,the7340controllercansimultaneouslyexecute10programs,fivefromRAMandfivefromROM,witheachprogramupto1,280commandslong.

Page 449: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadMemoryObjectDescriptionReadstheASCIItextdescriptionforaprogramorbufferobject.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.Object(1)isaprogramorbufferstoredinonboardRAM.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.

Page 450: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheReadMemoryObjectDescriptionVIreturnstheASCIItextdescriptionforaprogramorbufferobject.TheASCIItextdescription,previouslyloadedwiththeLoadMemoryObjectDescriptionVI,isusefulasaquickreminderofthecontentsorpurposeofanobjectstoredinmemory.

Page 451: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadObjectRegistryReadsadatarecordforamemoryobjectfromtheObjectRegistry.

Details

DeviceCompatibility

Indexistheregistryrecordnumber.Therangeforindexis0to31.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.Typically,sourceisthenameoftheVIinwhichtheerroroccurred.

RegistryRecordisthedatarecordcontainingobjectinformation.Object

Page 452: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheReadObjectRegistryVIreturnsaregistryrecordforanobjectfromtheObjectRegistry.TheObjectRegistrycontainsinformationaboutallobjectsstoredinmemory.Youcanstoreupto32objectsinRAMand/orROM.Eachtimeanobjectisstored,anewrecordiscreatedtokeeptrackofit.

NoteIfanobjectexistsbothinRAMandROM,thisVIreportstheobjectasexistinginRAM.ToseetheobjectinROM,youmustfirstfreetheobjectfromRAM.

On7330and7340motioncontrollers,objectsareinRAMifPStart0x100000,andinROMifPStart<0x100000.Onthe7350controller,objectsareinRAMifPStart 0x200000,andinROMifPStart<0x200000.

RegistryrecordsarereferencedbyindexandeachcalltothisVIreturnsinformationaboutthereferencedobject.Theindexisnotthesameastheobjectnumber.Youcanuseupto255uniqueobjectnumbers(0x01through0xFF)butonly32objectscanbestoredinmemoryatonetime.

Page 453: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

AdvancedVIsYoucanusetheadvancedVIstocontrolthecommunicationsbetweenthehostcomputerandNImotioncontroller.TheseVIsallowyoutocheckthestatusofcommunications,cleartheRDB,andmanagethelow-levelcommunicationstothecontroller.YoutypicallydonothavetouseanyoftheseVIsbecausethedefaultconfigurationiscorrectforalmostallapplications.TheseVIsareavailabletohandlespecialapplications.

TheadvancedVIsincludespecializedReadandWriteVIsforquicklyviewingaxisorcoordinatedataorstatusinformation,configuringI/Olines,andsoon.

TheadvancedVIsalsoincludeadvancedmethodsandtwoutilityVIsthatareregularlyusedbutaredifferentfromtherestoftheNI-MotionAPIinthattheyarenottypicallyincludedinapplicationcode:ClearPowerUpStatusandSaveDefaultParameters.

ClicktheiconsforVIdescriptions.

ReadCommunicationStatus ReadBoardTemperatureFlushReturnDataBuffer ReadReturnDataBufferClearPowerUpStatus EnableAutoStartResetDefaultParameters EnableShutdownSaveDefaultParameters

Page 454: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Subpalettes

AdvancedReadVIs

AdvancedWriteVIs

AdvancedMethods

Page 455: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ClearPowerUpStatusClearsthePower-Upstatusbitandbootsupthecontroller,makingitreadytoacceptcommands.

DetailsRemarks

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.Typically,sourceisthenameoftheVIinwhichtheerroroccurred.

BdIDOutisprovidedforflowcontrol.YoucanstringtogetherNI-

Page 456: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

Wheneverthemotioncontrollerisresetbyapowercycle,watchdogtimeout,orothermeans,thecontrollerissuspendedinapower-upstateandaPower-UpstatusbitintheCommunicationsStatusRegister(CSR)isset.TheClearPowerUpStatusVIisusedtoclearthisbitandreadythecontrollerformotioncontrolcommunications.

YoucannotexecutemostoftheothermotioncontrolVIsuntilthePower-UpstatusbitisclearedbythisVI.Thislockoutensuresthatyouareawareoftheoccurrenceofanunexpectedreset,asinthecaseofawatchdogtimeout.

YoucanincludethisVIonetimeatthebeginningofaninitializationroutine,buttoavoidthepossibilityofrestartinganapplicationunexpectedlyafterapowercycleorwatchdogtimeout,youmustnotincludeitinotherroutines.TheInitializeControllerVIautomaticallycallsthisVI.

NoteIfyouarerunningaNI-MotionstartupapplicationonETS(PharLap)systems,thefirstVIinyourapplicationmustbeeithertheClearPowerUpStatusorInitializeControllerVI.CallinganyotherVIfirstmayresultinerror–70012(NIMC_badBoardIDError)becausethedrivermaynothaveloadedbeforeaNI-MotionVIiscalled.

Page 457: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowingincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

WhenthemotioncontrollerisinthePower-Upstate,theMCSregistercontainsapower-upcodethatdescribeswhythecontrollerisinthePower-Upstate.Toaccessthiscode,executetheReadMoveCompleteStatusVI.Thefollowingtabledescribesthepower-upcodes.

Code ResetType Cause0x80 Busreset NormalPCpowercycle

0x40 Power-Upreset NormalPCpowercycle

0x20 Watchdogtimeout Fatalinternalerror

0x08 Shutdown Shutdown(E-Stop)inputactive;refertotheEnableShutdownVI

0x02 Softwarereset Firmwaredownload

NISoftMotionControllerConsiderations

ThefollowingincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

Thepower-upcodesdonotapplytotheNISoftMotionController.

Page 458: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

EnableAutoStartAllowsyoutoautomaticallyrunaprogramwhenthecontrollerpowersup.

Details

DeviceCompatibility

ProgramToExecute(1)istheonboardprogramthecontrollerexecutesiftheautostartfeatureisenabled.Thismustbeavalidprogramnumber(1-255),thatisstoredtoFLASHusingtheObjectMemoryManagementVI.EnableAutoStartenablesordisablestheautostartfeature.SetthistoEnable(true)toenableautostartandDisable(false)todisableautostart.BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,

Page 459: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheEnableAutoStartVIconfiguresthecontrollertoautomaticallystartanonboardprogramonpowerup.Afterautostartisenabled,thecontrollerautomaticallyexecutestheonboardprogramspecifiedwhenthecontrollerispoweredon.TheonboardprogramtoexecutemustbesavedtoFLASHusingtheObjectMemoryManagementVIbeforethecontrollerispowereddown.Ifthecontrollerdoesnotfindavalidprogramthatitcanload,NIMC_autoStartFailedErrorisgenerated.IftheonboardprogramisremovedfromFLASHmemory,theautostartfunctionalityisdisabled.

NoteThisVIwritestoonboardFLASHmemoryandhenceitisnotsafetoexecutewhenmotorsareinmotion.DoingsogeneratesaNIMC_wrongModeError.

ThisVImaytakelongerthan62mstoprocess,soitisnotguaranteedtobecompatiblewithreal-timeexecution.

Page 460: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

EnableShutdownEnablestheshutdown(E-Stop)functionalityofthecontroller.

DetailsRemarks

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.Typically,sourceisthenameoftheVIinwhichtheerroroccurred.

BdIDOutisprovidedforflowcontrol.YoucanstringtogetherNI-MotionVIsbywiringtheBdIDOutterminalofoneVItotheBoardIDterminalofthenextVI.

Page 461: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheEnableShutdownVIenablesthecontrollertoreacttotheshutdown(E-Stop)input.Whentheshutdown(E-Stop)inputtransitionsfromlowtohigh,thecontrollergoesintoashutdownstate.Thefollowingactionstakeplaceintheshutdownstate:

Alltheaxesarekilled.Onservoaxes,thecontrolloopisdisabledandtheoutputDACsarezeroed,allowingfrictionalforcesalonetostopthemotion.Onstepperaxes,thestepperpulsegenerationisstopped.Onbothaxistypes,thereisnotrajectoryprofile.Ifenabled,theinhibitoutputisactivatedtoinhibit(disable)theservoamplifierorstepperdriver.YoucanenabletheinhibitoutputsandsettheirpolarityasactivehighoractivelowwiththeConfigureInhibitOutputsVI.Alltheaxes,encoders,andADCsaredisabled.AllthedigitalI/Oisre-initializedtodefaults.IftheuserhassaveddefaultsusingtheSaveDefaultParametersVI,thedigitalI/Oisre-initializedtotheuserdefaults.Otherwise,thedigitalI/Oisre-initializedtothefactorydefaults.Allcurrentlyexecutingonboardprogramsarestopped.Thecontrollerdoesnotacceptanycommands,exceptforthefollowingones:

GetMotionBoardInformationReadErrorMessageEnableAutoStart

Theshutdownfunctionalityisdisabledbydefaultonpowerup.Thisfunctionalityhastobeenabledeverytimethecontrollerispoweredup.Youmustenablethisfeatureonlyaftertheshutdown(E-Stop)circuitisproperlyconfiguredandconnectedtothecontroller.Aftershutdown(E-Stop)isenabled,itcanbedisabledonlybyresettingorpowercyclingthecontroller.

NoteAfterthecontrollerhasshutdown,youhavetoresetitorcycleitspowerbeforeitcanbeusedagain.NoteTheactivestateoftheshutdown(E-Stop)lineislow.Topreventthecontrollerfromshuttingdownprematurely,thelinemustbehigh(inactive)

Page 462: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NISoftMotionControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

AllreadVIsareavailablewhentheNISoftMotionControllerisinashutdownstate.AllwriteVIs,includingStartMotionandStopMotion,areunavailablewhentheNISoftMotionControllerisinashutdownstate.

Page 463: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

FlushReturnDataBufferClearstheReturnDataBuffer(RDB)bydeletingallofthebuffereddata.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.Typically,sourceisthenameoftheVIinwhichtheerroroccurred.

BdIDOutisprovidedforflowcontrol.YoucanstringtogetherNI-MotionVIsbywiringtheBdIDOutterminalofoneVItotheBoardID

Page 464: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheFlushReturnDataBufferVIclearstheReturnDataBufferbyrepeatedlyreadingtheRDBuntilthebufferisempty.AllreturndatapacketsintheRDBaredeletedandthisVIreturnsnothing.

YoutypicallyusetheFlushReturnDataBufferVIafteranerrorconditionwhenthedataintheReturnDataBufferisnolongervalidorrelevant.ThisVIisalsousefulforflushingtheRDBafteraprogrammingerrorhascausedthebuffertobecomeskewed.BufferskewiswhenthedatareturnedbyareadVIusingthedefaultinputvectorof0xFFdoesnotreturntheexpecteddatabutratherreturnsdatarequestedbyapreviousVI.

Refertothemotioncontrollerdocumentationformoreinformationaboutlow-levelcommunicationsprotocolsandreturndatapackets.

Page 465: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadBoardTemperatureReadsthetemperaturefromthemotioncontroller.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.Typically,sourceisthenameoftheVIinwhichtheerroroccurred.

Temperatureisthetemperaturereadfromthetemperaturesensoronthemotioncontrollerin°C.BdIDOutisprovidedforflowcontrol.YoucanstringtogetherNI-MotionVIsbywiringtheBoardIDOutterminalofoneVItotheBoardIDterminalofthenextVI.erroroutcontainserrorinformation.Iferrorinindicatesanerror,erroroutcontainsthesameerrorinformation.Otherwise,itdescribestheerrorstatusthatthisVIproduces.

Page 466: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheReadBoardTemperatureVIreadsthetemperaturein°Cfromthetemperaturesensoronthemotioncontroller.Youcanusethecurrenttemperaturesensorreadingtodeterminewhetherthedevicerequiresrecalibration.

NoteOnly7350controllerssupporttheReadBoardTemperatureVI.

Page 467: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadCommunicationStatusReadsthecommunicationstatusregister(CSR)whichrepresentsthestateofthecontroller.

DetailsRemarks

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.Typically,sourceisthenameoftheVIinwhichtheerroroccurred.

CommunicationsStatusRegisteristhebitmapofcommunicationstatus

Page 468: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

Onpowerup,thecontrollerisinapower-upresetstate.RefertoClearPowerUpStatusforinformationaboutclearingtheresetcondition.

NoteRefertoVIExecutionTimesforbenchmarktiminginformationaboutyourcontroller.

Page 469: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

ThisVIperformsadirectreadoftheCommunicationStatusRegister(CSR)onthe73xxmotioncontrollers.TheCSRisahardwareregistercontainingcommunicationhandshakinganderrorstatusbits.TheNI-Motionsoftwarepollsthisregistercontinuouslywhensendingandreceivingpacketsforhandshakinganderrorcheckingpurposes.Refertoyourmotioncontrollerdocumentationformoreinformationaboutlow-levelcommunicationprotocolsandreturndatapackets.YoualsocancallthisVIatanytimetocheckthecommunicationanderrorstatus.BecausetheCSRisalwaysup-to-dateanddirectlyaccessibleoverthecomputerbus,executingthisVIdoesnotaffecttheoperationoftheNImotioncontroller.

NISoftMotionControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

IfyouareusingtheNISoftMotionController,thisVIreadstheNISoftMotionControllerengineservicestatus.

ReadytoReceiveindicatesiftheNISoftMotionControllerisrunning.

TheNISoftMotionControllerdoesnotsupportthefollowingCSRbits:CommandInProcessPacketErrorHardwareFailReadytoSend

Page 470: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadReturnDataBufferReadstheReturnDataBuffer.

Details

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.Typically,sourceisthenameoftheVIinwhichtheerroroccurred.

WordCountisthenumberof16-bitwordsinthecommandpacket.

Page 471: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

YoucanusetheReadReturnDataBufferVItoreadtheRDB.

Refertothemotioncontrollerdocumentationformoreinformationaboutlow-levelcommunicationsprotocolsandreturndatapackets.

Page 472: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ResetDefaultParametersResetsthepower-updefaultstothefactory-defaultsettings.

DetailsRemarks

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.Typically,sourceisthenameoftheVIinwhichtheerroroccurred.

BdIDOutisprovidedforflowcontrol.YoucanstringtogetherNI-MotionVIsbywiringtheBdIDOutterminalofoneVItotheBoardIDterminalofthenextVI.

Page 473: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheResetDefaultParametersVIresetsthepower-updefaultstothefactory-defaultsettingsforallimportantconfiguration,initialization,andtrajectoryparametersforuseaftersubsequentpower-upresets.WhenyouexecutethisVI,allparametersaresavedtononvolatileflashmemoryandbecomethepower-updefaults.

NoteTheeffectofthisVIisnotrealizeduntilthenexttimethecontrollerispoweredupfromapower-downstate.

YouonlyneedtousethisVIifyouhavepreviouslymodifiedthepower-updefaultsusingtheSaveDefaultParametersVIandwanttorevertbacktothefactorydefaults.

Page 474: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

ThisVImaytakelongerthan62mstoprocesson73xxcontrollers.ThisVIisnotguaranteedtoexecuteinrealtimeasitperformsmemoryallocation.

Page 475: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

SaveDefaultParametersSavesthecurrentoperatingparametersasdefaults.

DetailsRemarks

DeviceCompatibility

BoardIDisauniquenumberassignedbyMeasurement&AutomationExplorer(MAX)usedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.Typically,sourceisthenameoftheVIinwhichtheerroroccurred.

BdIDOutisprovidedforflowcontrol.YoucanstringtogetherNI-MotionVIsbywiringtheBdIDOutterminalofoneVItotheBoardIDterminalofthenextVI.

Page 476: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

TheSaveDefaultParametersVIsavesallimportantconfiguration,initialization,andtrajectoryparametersforuseaftersubsequentpower-upresets.WhenyouexecutethisVI,allparametersaresavedtononvolatileflashmemoryandbecomethepower-updefaults.

Ifnecessary,youcanreinstatethefactory-defaultparametersasthepower-updefaultswiththeResetDefaultParametersVI.

ThisVIdoesnotperformacompletestatesave.Forproperandsafeoperationafterpower-up,certainparametersarealwaysresettotheirfactorydefaultstobringthecontrollerbacktoaknownsafestate.Parametersnotstoredareleftoutbydesignandaretypicallyresettozeroatpower-up.

NoteIfyouwanttorememberaparameterthatisnotincludedinthislist,youcancopythatparametertoageneral-purposevariableanditissavedwiththisVI.Youcanthenresettheparametertothesavedvaluewithaprogramdesignedforthispurpose.

Page 477: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

ThisVImaytakelongerthan62mstoprocesson73xxcontrollers.ThisVIisnotguaranteedtoexecuteinrealtimeasitperformsmemoryallocation.Whenthecontrollerispoweredup,thedefaultsareautomaticallyapplied.Thereissometime,however,betweenthecontrollerpoweringupandtheapplicationofdefaults.

Thedefaultsonthestep,direction,breakpoint,andanalogoutputsignalsdonottakeeffectuntilthepowerupresetstateiscleared.UsetheClearPowerUpStatusVItoclearthepowerupresetstate.

NISoftMotionControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

Userdefaultsarenotapplieduntilthepowerupresetstateiscleared.UsetheClearPowerUpStatusVItoclearthepowerupresetstate.Refertothedocumentationforyourdrivefortheinitialpoweronstateofthedrive.

Page 478: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

AdvancedReadVIsYoucanusetheadvancedreadfunctionstoviewaxisorcoordinateexecutiondataandstatusinformation,I/Ostatusinformation,encoderexecutiondata,andsoon.

ClicktheiconsforVIdescriptions.

ReadExecutionStatus

ReadExecutionData

ReadEncoderData

ReadCaptureCompareData

ReadMotionI/OData

ReadDigitalI/OData

Page 479: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadExecutionDataReadsposition,velocity,andfollowingerrorinformationonanaxisorcoordinate.YoucanusethispolymorphicVItoreadexecutiondataofasingleaxisattribute,allexecutiondatainformationfromanaxis,positioninformationforallaxesinacoordinate,orvelocityorfollowingerrorinformationforacoordinate.

Usethepull-downmenutoselectaninstanceofthisVI.

Selectaninstance

Details

DeviceCompatibility

Page 480: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadAxisData

attributeistheattributeyouwanttoread.Thefollowingarevalidattributes:

position—Returnsthepositiontothedoubleelementofthedatacluster.velocity—Returnsthevelocitytothedoubleelementofthedatacluster.followingerror—Returnsthefollowingerrortothedoubleelementofthedatacluster.

boardinisauniquenumberassignedbyMeasurement&AutomationExplorerusedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.axisinistheaxistoreadwiththisVI.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.Typically,sourceisthenameoftheVIinwhichtheerroroccurred.

dataisaclusterofvariablesthatcontainsthevaluesfortheselectedattribute.Readthecorrectelementoftheclusterfortheattribute.Thevaluesoftheotherelementsintheclusterareundefined.

integeris32-bitintegerdata.doubleis64-bitfloatingpointdata.

Page 481: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadAllAxisData

boardinisauniquenumberassignedbyMeasurement&AutomationExplorerusedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.axisinistheaxistoreadwiththisVI.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.Typically,sourceisthenameoftheVIinwhichtheerroroccurred.

axisdataisthedatarecordcontainingaxisexecutiondata.positioncontainsaxispositioninformation.velocitycontainsfilteredvelocityincounts/s(forservoaxes)orsteps/s(forstepperaxes).Thesignofvelocityindicatesdirectionofmotion.followingerrorcontainstheinstantaneousdifferencebetweenthecommandedtrajectorypositionandtheactualfeedbackpositionincountsforservosystemsandstepsforsteppersystems.encoderpositioncontainsthequadraturecountvalueoftheencodermappedtotheselectedaxis.

boardoutisprovidedforflowcontrol.YoucanstringtogetherNI-MotionVIsbywiringtheboardoutterminalofoneVItotheboardinterminalofthenextVI.axisoutisprovidedforflowcontrol.YoucanstringtogetherNI-MotionVIsbywiringtheaxisoutterminalofoneVItotheaxisinterminalofthe

Page 482: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadCoordinateData

attributeistheattributeyouwanttoread.Thefollowingarevalidattributes:

velocity—Returnsthevelocitytothedoubleelementofthedatacluster.followingerror—Returnsthefollowingerrortothedoubleelementofthedatacluster.

boardinisauniquenumberassignedbyMeasurement&AutomationExplorerusedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.coordinateinisthecoordinatetoreadwiththisVI.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.Typically,sourceisthenameoftheVIinwhichtheerroroccurred.

dataisaclusterofvariablesthatcontainsthevaluesfortheselectedattribute.Readthecorrectelementoftheclusterfortheattribute.Thevaluesoftheotherelementsintheclusterareundefined.

integeris32-bitintegerdata.doubleis64-bitfloatingpointdata.BooleanisBooleandata.

boardoutisprovidedforflowcontrol.YoucanstringtogetherNI-Motion

Page 483: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadCoordinatePosition

boardinisauniquenumberassignedbyMeasurement&AutomationExplorerusedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.coordinateinisthecoordinatetoreadwiththisVI.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.Typically,sourceisthenameoftheVIinwhichtheerroroccurred.

positionsisthearraycontainingthecoordinatepositioninformation.boardoutisprovidedforflowcontrol.YoucanstringtogetherNI-MotionVIsbywiringtheboardoutterminalofoneVItotheboardinterminalofthenextVI.coordinateoutisprovidedforflowcontrol.YoucanstringtogetherNI-MotionVIsbywiringthecoordinateoutterminalofoneVItothecoordinateinterminalofthenextVI.erroroutcontainserrorinformation.Iferrorinindicatesanerror,erroroutcontainsthesameerrorinformation.Otherwise,itdescribestheerrorstatusthatthisVIproduces.

statusisTRUEifanerroroccurred,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroora

Page 484: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

CautionIfthisVIusesreflectivememory,itshouldnotbeusedforeventchecking.Inthiscase,onlyusetheinformationreturnedbythisVIfordisplaypurposes.RefertoReflectiveMemoryVIsformoreinformation.NoteBecauseofthewaythecontrollerupdatesinformation,thevaluesreturnedarenotguaranteedtoallbesampledinthesametimeslice.

AxisDataInstances

ThesingleaxisversionsofthisVIreturnexecutiondataontheselectedaxis.

Foropen-loopstepperaxes,theVIreturnspositioninformationinnumberofstepsgenerated.Forclosed-loopstepperaxes,itconvertstheprimaryfeedbackpositionfromcountstostepsandthenreturnsthevalueinsteps.Closed-loopstepperaxesrequireyoutocorrectlyloadvaluesofstepsperrevolutionandcountsperrevolutiontofunctioncorrectly.

NoteForclosed-loopaxes,thisVIalwaysreturnsthepositionoftheprimaryfeedbackresource.RefertotheReadCoordinatePositioninstanceofthisVIforaneasywaytoreadthepositionsofallaxesinacoordinateinonecall.

Foraxisvelocity,thisVIreturnsfilteredvelocityincounts/s(forservoaxes)orsteps/s(forstepperaxes).Thesignofvelocityindicatesdirectionofmotion.

Foraxisfollowingerror,thisVIreturnstheinstantaneousdifferencebetweenthecommandedtrajectorypositionandtheactualfeedbackpositionincountsforservosystemsandstepsforsteppersystems.

Encoderpositiondataisinquadraturecountvalueoftheencodermappedtotheselectedaxis.

Duringaxissetup,youcanoperatetheclosed-loopstepperaxisinopen-loopmodeandusethisVItodirectlymeasurethecountsperrevolutionandstepsperrevolutionfortheaxis.Thesevaluesmustbeloadedbeforeforsubsequentclosed-loopoperation.RefertotheLoadCounts/StepsperRevolutionVIformoreinformation.

Youalsocanuseencoderpositiontoreturnafinerreadingofpositionincaseswheretheencoderresolutiongreatlyexceedsthestepresolutionoftheclosed-loopstepperaxis.

Page 485: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadExecutionStatusYoucanusethispolymorphicVItoreadtheexecutionstatusofaselectedaxisexecutionstatusattribute,allexecutionstatusattributesonanaxis,oraselectedcoordinateexecutionstatusattribute.

Usethepull-downmenutoselectaninstanceofthisVI.

Selectaninstance

Details

DeviceCompatibility

Page 486: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadAxisStatus

attributeistheattributeyouwanttoread.RefertotheDetailssectionformoreinformation.Thefollowingarevalidattributes:

axisactive—ReturnsthestatustotheBooleanelementofthedatacluster.movecomplete—ReturnsthestatustotheBooleanelementofthedatacluster.profilecomplete—ReturnsthestatustotheBooleanelementofthedatacluster.blendcomplete—ReturnsthestatustotheBooleanelementofthedatacluster.followingerrorexceeded—ReturnsthestatustotheBooleanelementofthedatacluster.velocitythresholdexceeded—ReturnsthestatustotheBooleanelementofthedatacluster.axismoving—ReturnsthestatustotheBooleanelementofthedatacluster.directionforward—ReturnsthestatustotheBooleanelementofthedatacluster.

boardinisauniquenumberassignedbyMeasurement&AutomationExplorerusedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.axisinistheaxistoreadwiththisVI.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroora

Page 487: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadAllAxisStatus

boardinisauniquenumberassignedbyMeasurement&AutomationExplorerusedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.axisinistheaxistoreadwiththisVI.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.Typically,sourceisthenameoftheVIinwhichtheerroroccurred.

axisstatusisthedatarecordcontainingaxisstatusinformation.RefertotheDetailssectionformoreinformation.boardoutisprovidedforflowcontrol.YoucanstringtogetherNI-MotionVIsbywiringtheboardoutterminalofoneVItotheboardinterminalofthenextVI.axisoutisprovidedforflowcontrol.YoucanstringtogetherNI-MotionVIsbywiringtheaxisoutterminalofoneVItotheaxisinterminalofthenextVI.erroroutcontainserrorinformation.Iferrorinindicatesanerror,erroroutcontainsthesameerrorinformation.Otherwise,itdescribestheerrorstatusthatthisVIproduces.

statusisTRUEifanerroroccurred,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,

Page 488: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadCoordinateStatus

attributeistheattributeyouwanttoread.RefertotheDetailssectionformoreinformation.Thefollowingarevalidattributes:

movecomplete—ReturnsthestatustotheBooleanelementofthedatacluster.profilecomplete—ReturnsthestatustotheBooleanelementofthedatacluster.blendcomplete—ReturnsthestatustotheBooleanelementofthedatacluster.followingerrorexceeded—ReturnsthestatustotheBooleanelementofthedatacluster.

boardinisauniquenumberassignedbyMeasurement&AutomationExplorerusedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.coordinateinisthecoordinatetoreadwiththisVI.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.Typically,sourceisthenameoftheVIinwhichtheerroroccurred.

dataisaclusterofvariablesthatcontainsthevaluesfortheselectedattribute.Readthecorrectelementoftheclusterfortheattribute.Thevaluesoftheotherelementsintheclusterareundefined.

integeris32-bitintegerdata.

Page 489: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

UsethisVItoreadtheexecutionstatusofanaxisorcoordinate.

CautionIfthisVIusesreflectivememory,itshouldnotbeusedforeventchecking.Inthiscase,onlyusetheinformationreturnedbythisVIfordisplaypurposes.RefertoReflectiveMemoryVIsformoreinformation.NoteRefertoVIExecutionTimesforbenchmarktiminginformationaboutyourcontroller.

TheVIwillreturnTrueorFalsebasedonthefollowingcriteria:

Element ExecutionStatusaxisactive

True=motorisonFalse=motorisoff

movecomplete

True=movecompleteFalse=movenotcomplete

profilecomplete

True=profileiscompleteFalse=profilegenerationinprocess

blendcomplete

True=blendcompleteFalse=blendpending

followingerrorexceeded

True=axisorcoordinateaxisexceededtheprogrammedfollowingerrorlimitFalse=axisorcoordinateaxisfollowingerrorisbelowtheprogrammedfollowingerrorlimit

NoteIfyouarerunningacontouredmoveorslaveaxismovewithastepperaxis,itispossiblethatthecontourvelocityortheslaveaxisgearedvelocityexceedsthemaximumsteprateofthecontroller.Inthiscase,thecontrollerkillstheaxisandsetsthefollowingerrorstatustotrue.RefertotheSpecificationssectionofyourcontrollerusermanualforthemaximumsteprateofyourcontroller.

velocitythresholdexceeded

True=axisvelocityisabovetheprogrammedvelocitythresholdFalse=axisvelocityisbelowtheprogrammedvelocitythreshold

axismoving

True=axisismovingFalse=axisisstopped

directionforward

True=axismovingforwardFalse=axismovinginreverse

index True=encoderindexpositioncaptureoccurred

Page 490: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadCaptureCompareDataReadspositioncompareorpositioncapturedatafromtheselectedaxis.

Details

DeviceCompatibility

attributeistheattributeyouwanttoread.Thefollowingarevalidattributes:

capturedposition—Returnsthepositiontothedoubleelementofthedatacluster.positioncaptureoccurred—ReturnsthestatustotheBooleanelementofthedatacluster.True(On)indicatesthatthepositioncaptureoccurredandFalse(Off)indicatesthatthepositioncapturehasnotoccurred.positioncompareoccurred—ReturnsthestatustotheBooleanelementofthedatacluster.True(On)indicatesthatthepositioncompareoccurredandFalse(Off)indicatesthatthepositioncomparehasnotoccurred.

boardinisauniquenumberassignedbyMeasurement&AutomationExplorerusedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.axisinistheaxistoreadwiththisVI.indexinistheencoderindexvalue.Validvalueis1fortheprimaryencoder.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowing

Page 491: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

UsethisVItoreadpositioncompareorpositioncapturedatafromtheselectedaxis.

CautionIfthisVIusesreflectivememory,itshouldnotbeusedforeventchecking.Inthiscase,onlyusetheinformationreturnedbythisVIfordisplaypurposes.RefertoReflectiveMemoryVIsformoreinformation.NoteRefertoVIExecutionTimesforbenchmarktiminginformationaboutyourcontroller.

Page 492: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadDigitalI/ODataReadstheattributeonasingledigitalI/Oline.

DetailsRemarks

DeviceCompatibility

attributeistheattributeyouwanttoread.Thefollowingarevalidattributes:

outputactivestate—ReturnstheactivestateofthespecifiedoutputlinetotheBooleanelementofthedatacluster.TRUEindicatesactivelow/activeopen.FALSEindicatesactivehigh/activeclosed.inputactivestate—ReturnstheactivestateofthespecifiedinputlinetotheBooleanelementofthedatacluster.TRUEindicatesactivelow/activeopen.FALSEindicatesactivehigh/activeclosed.outputactive—ReturnsthecurrentoutputstateofthespecifiedlinetotheBooleanelementofthedatacluster.TRUEindicatestheoutputlineisactive.FALSEindicatestheoutputlineisinactive.

NoteReadingthisattributeonalineconfiguredforinputreturnserror-70102(NIMC_wrongIODirectionError).

inputactive—ReturnstheinputstateofthespecifiedlinetotheBooleanelementofthedatacluster.TRUEindicatestheinputlineisactive.FALSEindicatestheinputlineisinactive.

NoteReadingthisattributeonalineconfiguredforoutputreturnserror-70102(NIMC_wrongIODirectionError).

configureasinput—Returnsthedirectionofthespecifiedlinetothe

Page 493: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

UsethisVItoreadtheattributeonasingledigitalI/Oline.ThedigitalI/Olinesaredividedamongtheaxes.

CautionIfthisVIusesreflectivememory,itshouldnotbeusedforeventchecking.Inthiscase,onlyusetheinformationreturnedbythisVIfordisplaypurposes.RefertoReflectiveMemoryVIsformoreinformation.

Page 494: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowingincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxcontroller:

ThePCI-7390doesnotsupporttheconfigureasinputattribute.ThePCI-7390hasdedicateddirectionI/Olines.Onthesecontrollers,thepinyouread(inputoroutput)isdeterminedbythevaluespecifiedinlineinandattribute.

Forexample,toreadtheinputactivestateattributeofGeneral-PurposeInputBit1onaxis2,calltheReadDigitalI/ODataVIwiththefollowingparameters:

axisin=2linein=1attribute=inputactivestate

ToreadtheoutputactivestateofGeneral-PurposeOutputBit1onaxis2,calltheReadDigitalI/ODataVIwiththefollowingparameters:

axisin=2linein=1attribute=outputactivestate

7330,7340,and7350controllershaveconfigurabledirectionI/Olines.Onthesecontrollers,thelinenumberistranslatedtoportandlinenumber.Forexample,acalltoReadDigitalI/ODataonafouraxiscontrollerwitheightdigitalI/Oportsand

axisin=2

Page 495: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadEncoderDataReadspositionstatusordatafromtheselectedencoder.

Details

DeviceCompatibility

attributeistheattributeyouwanttoread.Thefollowingarevalidattributes:

position—Returnsthequadraturecountvalueoftheencodermappedtotheselectedaxistothedoubleelementofthedatacluster.indexposition—ReturnsthecapturedindexpositionafteraFindIndexsearchtothedoubleelementofthedatacluster.indexcaptureoccurred—ReturnsthestatustotheBooleanelementofthedatacluster.True(On)indicatesthattheencoderindexpositioncaptureoccurred.False(Off)indicatesthattheencoderindexpositionwasnotcaptured.

boardinisauniquenumberassignedbyMeasurement&AutomationExplorerusedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.axisinistheaxistoreadwiththisVI.indexinistheencoderindexvalue.Validvalueis1fortheprimaryencoder.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.If

Page 496: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

UsethisVItoreadstatusordatafromtheselectedencoder.

CautionIfthisVIusesreflectivememory,itshouldnotbeusedforeventchecking.Inthiscase,onlyusetheinformationreturnedbythisVIfordisplaypurposes.RefertoReflectiveMemoryVIsformoreinformation.NoteRefertoVIExecutionTimesforbenchmarktiminginformationaboutyourcontroller.

Page 497: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ReadMotionI/ODataReadsstatusanddatafromthemotioninputsandoutputs.

DetailsRemarks

DeviceCompatibility

attributeistheattributeyouwanttoread.Thefollowingarevalidattributes:

forwardlimitactive—ReturnsthestatustotheBooleanelementofthedatacluster.TRUEindicatesthattheinputisactiveandFALSEindicatesthattheinputisinactive.reverselimitactive—ReturnsthestatustotheBooleanelementofthedatacluster.TRUEindicatesthattheinputisactiveandFALSEindicatesthattheinputisinactive.forwardsoftwarelimitactive—ReturnsthestatustotheBooleanelementofthedatacluster.TRUEindicatesthattheinputisactiveandFALSEindicatesthattheinputisinactive.reversesoftwarelimitactive—ReturnsthestatustotheBooleanelementofthedatacluster.TRUEindicatesthattheinputisactiveandFALSEindicatesthattheinputisinactive.homeinputactive—ReturnsthestatustotheBooleanelementofthedatacluster.TRUEindicatesthattheinputisactiveandFALSEindicatesthattheinputisinactive.inhibit-inactive—ReturnsthestatustotheBooleanelementofthedatacluster.TRUEindicatesthattheinputisactiveandFALSEindicatesthattheinputisinactive.

Page 498: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

UsethisVItoreadthestatusanddatafromthemotioninputsandoutputsonthemotioncontroller.Youcanreadthestatusofthesemotioninputsandoutputsatanytime,regardlessofwhethertheyareenabled.ThelimitandhomeinputstatusduringaFindReferencemoveisundefined.RefertoWriteMotionI/ODataformoreinformation.

CautionIfthisVIusesreflectivememory,itshouldnotbeusedforeventchecking.Inthiscase,onlyusetheinformationreturnedbythisVIfordisplaypurposes.RefertoReflectiveMemoryVIsformoreinformation.NoteTheactivestateofthesesignalsdeterminesifanOnstateisactivehigh/activeclosedoractivelow/activeopen.RefertoWriteMotionI/ODataformoreinformationaboutactivestateandgeneralinformationaboutthesignals.NoteRefertoVIExecutionTimesforbenchmarktiminginformationaboutyourcontroller.

Page 499: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

Theminimumpulsewidthfortheinhibit-ininputtobedetectedisapproximately1ms.OntheNIPCI-7390controller,theinhibit-inactiveattributedoesnotreturnavalidvalueunlesstheinhibit-insignalisenabled.OntheNIPCI-7390controller,thein-positionactiveattributedoesnotreturnavalidvalueunlessthein-positionsignalisenabled.

NISoftMotionControllerConsiderations

ThefollowingincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

TheNISoftMotionControllerdoesnotsupportthein-positionactive,drivereadyactive,orinhibit-outactiveattributes.

Page 500: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

AdvancedWriteVIsYoucanusetheadvancedwriteVIsforspecializedI/OoperationsinvolvingthedigitalI/Oonacontroller,foradvancedmotionI/Ooperations,ortoconfigurethetrajectorydataforamove.

ClicktheiconsforVIdescriptions.

WriteTrajectoryData

WriteCaptureCompareData

WriteMotionI/OData

WriteDigitalI/OData

Page 501: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

WriteCaptureCompareDataLoadspositioncompareorpositioncapturedatafortheselectedaxis.

Details

DeviceCompatibility

attributeistheattributetoload.Thefollowingisthevalidattribute:

positioncomparepulsewidth—Setsthepulsewidthofthepositioncomparesignal.

boardinisauniquenumberassignedbyMeasurement&AutomationExplorerusedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.axisinistheaxistoconfigurewiththisVI.indexinistheencodertoconfigure.Validvalueis1fortheprimaryencoder.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.

Page 502: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

UsethisVItoloadconfigurationparametersforpositioncaptureandcompareonthemotioncontroller.Thisfunctionallowsyoutosetallattributesonaperaxisbasis.

Usethepositioncomparepulsewidthattributetoconfigurethepulsewidthforpositioncompareoutputsthattriggerdeviceswithspecificminimumactivepulserequirements.

NoteAbreakpointacrossRTSIalwaysgeneratesanactivehighpulseof200nsduration.CautionThepositioncompare(breakpoint)frequencydependsonthevelocityanddistancebetweenpositioncompareoutputsandislimitedbythepulsewidth.Thepositioncompareoutputfrequencymustmeettherequirementsspecifiedbelowforcorrectoperation.

Thepositioncompareoutputpulsemustnotoverlapwiththenextpositioncompareevent.Ifthepositioncompareoutputpulseoverlapswiththenextpositioncompareevent,positioncomparegenerationisstoppedandthepositioncompareoutputisdisabled.Torecoverfromthissituationchangethepulsewidth,velocity,ordistancebetweenpositioncompareoutputs.Inaddition,thepositioncompareoutputfrequencycannotbegreaterthanthemaximumvalueallowedforthespecifiedpositioncomparetype.Therefore,thepositioncompareoutputfrequency,inhertz,atthespecifiedpulsewidth,inseconds,mustconformtothefollowingtwoconditions:

AND

PositionCompare

(Breakpoint)OutputType

MaximumFrequency

Single 150HzBuffered,PIDrateof62.5µsto250µs

2kHz

Buffered,PIDrategreaterthan250µs

1kHz

Periodic 4MHz

Page 503: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

UsethisVItoloadconfigurationparametersforpositioncaptureandcompareonthemotioncontroller.Thisfunctionallowsyoutosetallattributesonaperaxisbasis.

Usethepositioncomparepulsewidthattributetoconfigurethepulsewidthforpositioncompareoutputsthattriggerdeviceswithspecificminimumactivepulserequirements.

NoteAbreakpointacrossRTSIalwaysgeneratesanactivehighpulseof200nsduration.CautionThepositioncompare(breakpoint)frequencydependsonthevelocityanddistancebetweenpositioncompareoutputsandislimitedbythepulsewidth.Thepositioncompareoutputfrequencymustmeettherequirementsspecifiedbelowforcorrectoperation.

Thepositioncompareoutputpulsemustnotoverlapwiththenextpositioncompareevent.Ifthepositioncompareoutputpulseoverlapswiththenextpositioncompareevent,positioncomparegenerationisstoppedandthepositioncompareoutputisdisabled.Torecoverfromthissituationchangethepulsewidth,velocity,ordistancebetweenpositioncompareoutputs.Inaddition,thepositioncompareoutputfrequencycannotbegreaterthanthemaximumvalueallowedforthespecifiedpositioncomparetype.Therefore,thepositioncompareoutputfrequency,inhertz,atthespecifiedpulsewidth,inseconds,mustconformtothefollowingtwoconditions:

AND

PositionCompare

(Breakpoint)OutputType

MaximumFrequency

Single 150HzBuffered,PIDrateof62.5µsto250µs

2kHz

Buffered,PIDrategreaterthan250µs

1kHz

Periodic 4MHz

Page 504: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

WriteDigitalI/ODataSetstheattributeonasingledigitalI/Oline.

DetailsRemarks

DeviceCompatibility

datainisaclusterofvariablesthatcontainsthevaluesfortheselectedattribute.

integeris32-bitintegerdata.doubleis64-bitfloatingpointdata.BooleanisBooleandata.

Basedontheattribute,thecorrectmemberofdatainmustbesetasfollows:

Foroutputactivestate,settheBooleanelementofthedatainclustertoTRUEtosettheactivestatetoactivelow/activeopen,andsetittoFALSEtosettheactivestatetoactivehigh/activeclosed.Forinputactivestate,settheBooleanelementofthedatainclustertoTRUEtosettheactivestatetoactivelow/activeopen,andsetittoFALSEtosettheactivestatetoactivehigh/activeclosed.Foroutputactive,settheBooleanelementofthedatainclustertoTRUEtoconfiguretheoutputlineasactive,andsetittoFALSEtoconfiguretheoutputlineasinactive.Forconfigureasinput,settheBooleanelementofthedatain

Page 505: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

UsethisVItosettheattributeonasingledigitalI/Oline.ThedigitalI/Olinesaredividedamongtheaxes.

Page 506: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowingincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxcontroller:

ThePCI-7390doesnotsupporttheconfigureasinputattribute.ThePCI-7390hasdedicateddirectionI/Olines.Onthesecontrollers,thepinyouwriteto(inputoroutput)isdeterminedbythevaluespecifiedinlineinandattribute.

Forexample,tochangetheinputactivestateofline1onaxis2,callWriteDigitalI/ODatawiththefollowingparameters:

axisin=2linein=1attribute=inputactivestate

Theactivestateisappliedtoaxis2General-PurposeInputBit1.

Tochangetheoutputactivestateofline1onaxis2,callWriteDigitalI/ODatawiththefollowingparameters:

axisin=2linein=1attribute=outputactivestate

Theactivestateisappliedtoaxis2General-PurposeOutputBit1.

7330,7340,and7350controllershaveconfigurabledirectionI/Olines.Onthesecontrollers,thelinenumberistranslatedtoportandlinenumber.Forexample,acalltoWriteDigitalI/ODataonafouraxiscontrollerwitheightdigitalI/Oportswith

Page 507: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

WriteMotionI/ODataLoadsconfigurationparametersforthemotioninputsandoutputs.

DetailsRemarks

DeviceCompatibility

datainisaclusterofvariablesthatcontainsthevaluesfortheselectedattribute.

integeris32-bitintegerdata.doubleis64-bitfloatingpointdata.BooleanisBooleandata.

Basedontheattribute,thecorrectmemberofdatainmustbesetasfollows:

Forforwardlimitenableandreverselimitenable,settheBooleanelementofthedatainclustertoTRUEtoenablethehardwarelimit,andFALSEtodisablethehardwarelimit.Forforwardsoftwarelimitenableandreversesoftwarelimitenable,settheBooleanelementofthedatainclustertoTRUEtoenablethesoftwarelimit,andFALSEtodisablethesoftwarelimit.Forhomeinputenable,settheBooleanelementofthedatainclustertoTRUEtoenablethehomeinput,andFALSEtodisablehomeinput.Forforwardlimitactivestate,reverselimitactivestate,andhomeinputactivestate,settheBooleanelementofthedatainclusterto

Page 508: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

UsethisVItoloadconfigurationparametersforthemotioninputsandoutputsonthemotioncontroller.ThisVIallowsyoutosetallattributesonaperaxisbasis.

Hardwarelimitinputs,homeinputs,softwarepositionlimits,inhibitinputs,in-positioninputs,drivereadyinputs,andinhibitoutputsareenhancementsontheNImotioncontrollersandarenotrequiredforbasicmotioncontrol.WiththeexceptionoftheFindReferenceVI,youcanoperateallmotioncontrolVIswithoutenablingorusingthesesignals.TheFindReferenceVIrequiresenabledlimitandhomeinputsforoperation.FindReferencedoesnotrequireenabledsoftwarelimits.

CautionNationalInstrumentsrecommendsusinglimitsforpersonalsafety,aswellastoprotectthemotionsystem.

Theactivestateforeachhardwarelimit,home,inhibitinput,in-positioninput,andinhibitoutputcanbeconfiguredaseitheractivelow/activeopenoractivehigh/activeclosed.

Whenconfiguredasactivelow,theinputoroutputisactivewhenthereisalowsignalonthepin.Conversely,activehighmeansthattheinputoroutputisactivewhenthereisahighsignalonthepin.

Configuringanactivestateofactiveopenoractivecloseddoesnotcorrespondtothelevelofthesignalontheinputoroutputpin.Instead,anactiveopenstatemeansthattheinputoroutputisactivewhencurrentisnotflowingthroughtheoptocoupledinput.Conversely,anactiveclosedstatemeansthattheinputoroutputisactivewhencurrentisflowingthroughtheoptocoupledinput.

ForwardandReverseLimits,andHomeInputs

Thehardwarelimitinputsaretypicallyconnectedtoend-of-travellimitswitchesorsensors.Anenabledlimitinputcausesahaltstopontheaxiswhentheinputbecomesactive.Activelimitinputsalsoprohibitattemptstostart

Page 509: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxcontroller:

7330,7340,and7350controllersdonotsupporttheinhibit-inactivestateandin-positionactivestateattributes.UseWriteDigitalI/ODatatosettheactivestateforthesesignals.7330,7340,and7390controllersdonotsupporttheinhibit-outtotempoleattribute.7390controllersdonotsupporttheinhibit-outactivestateattribute.Tosettheactivestateona7390useWriteDigitalI/OData.Theinhibit-insignalissoftware-timedlatchedat1ms.Thissignalmustbeactiveforapproximately1mstobedetectedbythecontroller.Thefollowingtableliststhedrivesignalsandtheirimplementationonthecontroller:

SignalName SignalDirection

ControllerSupportController Drive 7330 7340 7350 7390

Inhibit-Out ServoOn Output Dedicated Dedicated Dedicated Mappable

Inhibit-In ServoAlarm Input Mappable Mappable Mappable Dedicated

DriveReady

ServoReady Input Mappable Mappable Mappable Mappable

In-Position In-Position Input Mappable Mappable Mappable Dedicated

AlarmClear

AlarmClear Output Mappable Mappable Mappable Mappable

TheactivestateofadedicatedsignalisdirectlyconfigurableusingthisVI.

Page 510: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

WriteTrajectoryDataConfigurestrajectorygeneratorparameters.

DetailsRemarks

DeviceCompatibility

datainisaclusterofvariablesthatcontainsthevaluesfortheselectedattribute.

integeris32-bitintegerdata.doubleis64-bitfloatingpointdata.BooleanisBooleandata.

Basedontheattribute,thecorrectmemberofdatainmustbesetasfollows:

Formovecompletewhendeactivated,settheBooleanelementofthedatainclustertoTRUEtoaddmotoroffstatusasacriteriaformovecomplete,andsetittoFALSEtoremovemotoroffstatus.Formovecompletewhennotmoving,settheBooleanelementofthedatainclustertoTRUEtoaddmotorstopstatusasacriteriaformovecomplete,andsetittoFALSEtoremovemotorstopstatus.Formovecompleteafterdelay,settheBooleanelementofthedatainclustertoTRUEtoenableauser-defineddelayasacriteriaformovecomplete,andsetittoFALSEtodisableauser-defineddelay.Formovecompletetimedelay,setdoubleDataintheTnimcDatastructuretothedesiredtimedelaytowaitformovecomplete.Valid

Page 511: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

UsethisVItoconfiguretrajectorygeneratorparametersforreportingamovecomplete.Whenamoveiscompleteonanaxis,thecorrespondingbitintheMoveCompleteStatus(MCS)registerisset.RefertoReadMoveCompleteStatusforinformationaboutreadingtheMCSregister.

Ifmovecompletewhendeactivatedistrue,anyconditionthatcausestheaxistoturnitsmotoroff(akillorfollowingerrortrip)satisfiesthisrequirementforMoveComplete.

Ifthemovecompletewhennotmovingistrue,theaxismustbelogicallystoppedforthemovetobeconsideredcomplete.

Ifmovecompleteafterdelayistrue,theaxismustwaitauser-defineddelayaftertheothercriteriaaremetbeforethemoveisconsideredcomplete.Themovecompletetimedelayattributeistypicallyusedtowaitthemechanicalsettlingtimesothatamoveisnotconsideredcompleteuntilvibrationsinthemechanicalsystemhavedampedout.ItalsocanbeusedtocompensateforPIDpull-intimeduetotheintegralterm.Thispull-inistypicallyatvelocitiesbelowtheRun/Stopthreshold.

NoteYoucanusethemovecompleteafterdelayparametertoguaranteeaminimumtimefortheFalsestate.ThestatustransitionsfromCompletetoNotCompleteatthestartofamoveandstaysintheNotCompletestateforatleastthisdelaytimeeveninthecaseofazerodistancemove.

Ifmovecompletewheninrangeistrue,theaxischecksitsfinalstoppingpositionversusitstargetpositionandonlysetstheMoveCompletestatusiftheabsolutevalueofthedifferenceislessthanmovecompleterangedistance.

Finally,ifmovecompletewheninpositionactiveistrue,thein-positioninputsignalisusedasacriteriaformovecomplete,andthemoveisonlycompleteifthein-positionsignalisactive.

Anon-zerovalueformovecompleteminimumactivetimeguaranteesthe

Page 512: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Remarks

ThissectionincludesinformationabouthowthebehaviorofthisVIdiffersamongthecontrollersthatsupportit.

NI73xxControllerConsiderations

ThefollowinglistincludesconsiderationsyoumustmakewhenyouareusingthisVIwitha73xxmotioncontroller:

TheNI7344doesnotsupportthemovecompletewheninpositionactiveattribute.7330,7340,and7350controllersuseConfigureMotionI/OMaptomapthein-positioninputtoageneral-purposeI/Oline.

NISoftMotionControllerConsiderations

ThefollowingincludesconsiderationsyoumustmakewhenyouareusingthisVIwiththeNISoftMotionController:

TheNISoftMotionControllerdoesnotsupportthemovecompletewheninpositionactiveattribute.

Page 513: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

AdvancedMethodsYoucanusetheadvancedmethodsforspecializedI/Oandmoveoperations,andforspecializedcommunicationsinvolvingthecontrolleranddriveorhost.

ClicktheiconsforVIdescriptions.

AxisStraightLineMove

ConfigureMotionI/OMap

ResetMotionController

ClearFaults

Page 514: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

AxisStraightLineMovePerformsastraightlinemoveonanaxis.

Details

DeviceCompatibility

axisstraightlinemovedataisaclustercontainingstraightlinemoveinformation.

startmodeisthestartmodeforthemove:

donotstart—Donostartthestraightlinemoveatthistime.start—Startthestraightlinemovewiththeconfiguredparameters.

positionmodeselectsthepositionmodeforthemove.RefertoDetailsformoreinformationabouttheavailablepositionmodes.

absolute—Useabsolutepositionmodeinthemove.relative—Userelativepositionmodeinthemove.velocity—Usevelocitymodeinthemove.

targetpositionisthetargetpositionforthestraightlinemoveincountsorsteps.

moveconstraintsisaclustercontainingmoveconstraintinformation:velocitysetsthevelocityforthemoveincounts/sorsteps/s.accelerationsetstheaccelerationforthemoveincounts/s2orsteps/s2.decelerationsetsthedecelerationforthemoveincounts/s2orsteps/s2.accelerationjerksetstheaccelerationjerkforthemoveincounts/s3orsteps/s3.

Page 515: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

UsethisVItoperformastraightlinemoveonanaxis.Thepositionmodesaredescribedinthefollowingsections:

AbsolutePositionMode

Inabsolutepositionmode,targetpositionsareinterpretedwithrespecttoanorigin,reference,orzeroposition.Theoriginistypicallysetatahomeswitch,endoftravellimitswitch,orencoderindexposition.Anabsolutepositionmoveusesthespecifiedvaluesofacceleration,deceleration,andvelocitytocompleteatrajectoryprofilewithanendingpositionequaltothespecifiedabsolutetargetposition.

CautionAnysinglemoveislimitedtobetween–231and231–1countsorsteps.Anerrorisgeneratedifyouexceedthislimitbyspecifyingatargetpositiontoofarfromthecurrentposition.

Thelengthofanabsolutemovedependsuponthespecifiedpositionandthecurrentpositionwhenthemoveisstarted.Ifthetargetpositionisthesameasthecurrentposition,nomoveoccurs.

RelativePositionMode

Inrelativepositionmode,ifarelativepositionmoveisstartedwhilemotionisnotinprogress,specifiedtargetpositionsareinterpretedwithrespecttothecurrentpositionatthetimethevalueisspecified.Arelativepositionmoveusesthespecifiedvaluesofacceleration,deceleration,andvelocitytocompleteatrajectoryprofilewithanendingpositionequaltothesumofthespecifiedrelativetargetpositionandthestartingposition.

Ifarelativemoveisstartedwhilemotionisinprogress,thenewtargetpositioniscalculatedwithrespecttothetargetpositionofthemovealreadyinprogress(consideredtobethenewstartingposition),asifthatmovehadalreadycompletedsuccessfully.Motioncontinuestothenewrelativeposition,independentoftheactualpositionlocationwhenthenewmoveisstarted.

VelocityMode

Invelocitymode,theaxismovesatthespecifiedvelocityuntilyouexecuteaStopMotionVI,alimitisencountered,oranewvelocityisspecifiedandyouexecuteaStartMotionVI.Specifiedtargetpositionshavenoeffectinvelocity

Page 516: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ClearFaultsClearsallmodalerrorsanddrivefaultsonallaxes.

Details

DeviceCompatibility

boardinisauniquenumberassignedbyMeasurement&AutomationExplorerusedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.Typically,sourceisthenameoftheVIinwhichtheerroroccurred.

boardoutisprovidedforflowcontrol.YoucanstringtogetherNI-MotionVIsbywiringtheboardoutterminalofoneVItotheboardinterminalofthenextVI.erroroutcontainserrorinformation.Iferrorinindicatesanerror,erroroutcontainsthesameerrorinformation.Otherwise,itdescribestheerror

Page 517: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

UsethisVItoclearallmodalerrorsanddrivefaultsonallaxes.ThisVIpulsesthealarmclearlineonallaxesthathavemappedthealarmclearsignalusingConfigureMotionI/OMap.

NoteRefertoWriteMotionI/ODataformoreinformationaboutthealarmclearsignalandtochangethealarmclearpulsewidth.

Theinhibit-insignalisconnectedtotheAlarmsignalofthedrive.Monitorthestatusoftheinhibit-insignaltodetermineifthereareanydrivefaults.Correctthefaults,thenusethisVItoclearthealarmstateofthedrive.

TheInitializeControllerVIautomaticallycallsthisVIifthecontrollerisinapower-upstate.IfyoucallInitializeControllerandthecontrollerisnotinapower-upstate,thisVIisnotcalled.

Page 518: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ConfigureMotionI/OMapMapsageneralpurposeI/Olinetoanalternatefunctionofanaxis.

Details

DeviceCompatibility

attributeistheactiontomaptoadigitalI/Oline.Thefollowingarevalidattributes:

defaultinput—MapsageneralpurposeI/Olineasthedefaultinputline.defaultoutput—MapsageneralpurposeI/Olineasthedefaultoutputline.shutdown—Mapsageneralpurposeinputlineastheshutdown(E-Stop)line.RefertoEnableShutdownformoreinformationabouttheshutdown(E-Stop)functionalityofthecontroller.inhibit-out—Mapsageneralpurposeoutputlineasaninhibit-outline.RefertoConfigureInhibitOutputformoreinformationabouttheinhibitoutputs.alarmclear—Mapsageneralpurposeoutputlineasanalarmclearline.RefertoWriteMotionI/ODataformoreinformationaboutalarmclear.inhibit-in—Mapsageneralpurposeinputlineasaninhibit-inline.RefertoWriteMotionI/ODataformoreinformationaboutthe

Page 519: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

ThisVImapsageneral-purposeI/Olinetoanalternatefunctionofanaxissuchasinhibitoutput.Forexample,tomapaxis3general-purposeoutput1totheinhibitoutputofaxis3,calltheVIwiththefollowingparametervalues:

axisin=3attribute=inhibit-outioAxisin=3linein=1

Notes

Forallattributesexceptforshutdown,theaxisininputmustbethesameastheioAxisininput.Theactionshutdownappliestothedevicelevel.Theaxisininputisignored.Furthermore,onlyonegeneral-purposeinputcanbemappedtothisattribute.7330,7340,and7350controllersdonotsupporttheinhibit-outandshutdownattributesbecausethesecontrollershavededicatedpinsforthesesignals.7390controllersdonotsupporttheinhibit-inandin-positionattributesbecausethiscontrollerhasdedicatedpinsforthesesignals.

Thefollowingtableliststhedrivesignalsandtheirimplementationonthecontroller:

SignalName SignalDirection

ControllerSupportController Drive 7330 7340 7350 7390Inhibit-Out ServoOn Output Dedicated Dedicated Dedicated Mappable

Inhibit-In ServoAlarm Input Mappable Mappable Mappable Dedicated

DriveReady

ServoReady Input Mappable Mappable Mappable Mappable

Page 520: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ResetMotionControllerResetsthemotioncontrollertothepower-upstate.

Details

DeviceCompatibility

boardinisauniquenumberassignedbyMeasurement&AutomationExplorerusedtosendandreceivecommandsanddatatoorfromaspecificNImotioncontroller.errorin(noerror)describeserrorconditionsthatoccurbeforethisVIruns.Thedefaultinputofthisclusterisnoerror.Ifanerroralreadyoccurred,thisVIreturnsthevalueoferrorininerrorout.TheVIrunsnormallyonlyifnoincomingerrorexists.Otherwise,theVIpassestheerrorinvaluetoerrorout.Theerrorinclustercontainsthefollowingparameters:

statusisTRUEifanerroroccurredbeforethisVIwascalled,orFALSEifnot.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.codeisanumberidentifyinganerrororwarning.IfstatusisTRUE,codeisanonzeroerrorcode.IfstatusisFALSE,codeiszeroorawarningcode.UsetheerrorhandlerVIstolookupthemeaningofthiscodeanddisplaythecorrespondingerrormessage.sourceisastringthatindicatestheoriginoftheerror,ifany.Typically,sourceisthenameoftheVIinwhichtheerroroccurred.

boardoutisprovidedforflowcontrol.YoucanstringtogetherNI-MotionVIsbywiringtheboardoutterminalofoneVItotheboardinterminalofthenextVI.

Page 521: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

UsingThisVI

UsethisVItoresetthemotioncontrollertothepower-upstate.Afterresettingthecontroller,youmustcallInitializeControllerorClearPowerUpStatustousethecontroller.

Page 522: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ImportantInformationWarranty

Copyright

Trademarks

Patents

WarningRegardingUseofNIProducts

Page 523: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

WarrantyThemediaonwhichyoureceiveNationalInstrumentssoftwarearewarrantednottofailtoexecuteprogramminginstructions,duetodefectsinmaterialsandworkmanship,foraperiodof90daysfromdateofshipment,asevidencedbyreceiptsorotherdocumentation.NationalInstrumentswill,atitsoption,repairorreplacesoftwaremediathatdonotexecuteprogramminginstructionsifNationalInstrumentsreceivesnoticeofsuchdefectsduringthewarrantyperiod.NationalInstrumentsdoesnotwarrantthattheoperationofthesoftwareshallbeuninterruptedorerrorfree.

AReturnMaterialAuthorization(RMA)numbermustbeobtainedfromthefactoryandclearlymarkedontheoutsideofthepackagebeforeanyequipmentwillbeacceptedforwarrantywork.NationalInstrumentswillpaytheshippingcostsofreturningtotheownerpartswhicharecoveredbywarranty.

NationalInstrumentsbelievesthattheinformationinthisdocumentisaccurate.Thedocumenthasbeencarefullyreviewedfortechnicalaccuracy.Intheeventthattechnicalortypographicalerrorsexist,NationalInstrumentsreservestherighttomakechangestosubsequenteditionsofthisdocumentwithoutpriornoticetoholdersofthisedition.ThereadershouldconsultNationalInstrumentsiferrorsaresuspected.InnoeventshallNationalInstrumentsbeliableforanydamagesarisingoutoforrelatedtothisdocumentortheinformationcontainedinit.

EXCEPTASSPECIFIEDHEREIN,NATIONALINSTRUMENTSMAKESNOWARRANTIES,EXPRESSORIMPLIED,ANDSPECIFICALLYDISCLAIMSANYWARRANTYOFMERCHANTABILITYORFITNESSFORAPARTICULARPURPOSE.CUSTOMER'SRIGHTTORECOVERDAMAGESCAUSEDBYFAULTORNEGLIGENCEONTHEPARTOFNATIONALINSTRUMENTSSHALLBELIMITEDTOTHEAMOUNTTHERETOFOREPAIDBYTHECUSTOMER.NATIONALINSTRUMENTSWILLNOTBELIABLEFORDAMAGESRESULTINGFROMLOSSOFDATA,PROFITS,USEOFPRODUCTS,ORINCIDENTALORCONSEQUENTIALDAMAGES,EVENIFADVISEDOFTHEPOSSIBILITYTHEREOF.ThislimitationoftheliabilityofNationalInstrumentswillapplyregardlessoftheformofaction,whetherincontractortort,including

Page 524: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

negligence.AnyactionagainstNationalInstrumentsmustbebroughtwithinoneyearafterthecauseofactionaccrues.NationalInstrumentsshallnotbeliableforanydelayinperformanceduetocausesbeyonditsreasonablecontrol.Thewarrantyprovidedhereindoesnotcoverdamages,defects,malfunctions,orservicefailurescausedbyowner'sfailuretofollowtheNationalInstrumentsinstallation,operation,ormaintenanceinstructions;owner'smodificationoftheproduct;owner'sabuse,misuse,ornegligentacts;andpowerfailureorsurges,fire,flood,accident,actionsofthirdparties,orothereventsoutsidereasonablecontrol.

Page 525: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

CopyrightUnderthecopyrightlaws,thispublicationmaynotbereproducedortransmittedinanyform,electronicormechanical,includingphotocopying,recording,storinginaninformationretrievalsystem,ortranslating,inwholeorinpart,withoutthepriorwrittenconsentofNationalInstrumentsCorporation.

NationalInstrumentsrespectstheintellectualpropertyofothers,andweaskouruserstodothesame.NIsoftwareisprotectedbycopyrightandotherintellectualpropertylaws.WhereNIsoftwaremaybeusedtoreproducesoftwareorothermaterialsbelongingtoothers,youmayuseNIsoftwareonlytoreproducematerialsthatyoumayreproduceinaccordancewiththetermsofanyapplicablelicenseorotherlegalrestriction.

Page 526: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

TrademarksNationalInstruments,NI,ni.com,andLabVIEWaretrademarksofNationalInstrumentsCorporation.RefertotheTermsofUsesectiononni.com/legalformoreinformationaboutNationalInstrumentstrademarks.

FireWire®istheregisteredtrademarkofAppleComputer,Inc.

HandleGraphics®,MATLAB®,Real-TimeWorkshop®,Simulink®,Stateflow®,andxPCTargetBox®areregisteredtrademarks,andTargetBox™andTargetLanguageCompiler™aretrademarksofTheMathWorks,Inc.

Tektronix®andTekareregisteredtrademarksofTektronix,Inc.

Otherproductandcompanynamesmentionedhereinaretrademarksortradenamesoftheirrespectivecompanies.

MembersoftheNationalInstrumentsAlliancePartnerProgramarebusinessentitiesindependentfromNationalInstrumentsandhavenoagency,partnership,orjoint-venturerelationshipwithNationalInstruments.

Page 527: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

PatentsForpatentscoveringNationalInstrumentsproducts,refertotheappropriatelocation:Help»Patentsinyoursoftware,thepatents.txtfileonyourCD,orni.com/patents.

Page 528: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

WARNINGREGARDINGUSEOFNATIONALINSTRUMENTSPRODUCTS(1)NATIONALINSTRUMENTSPRODUCTSARENOTDESIGNEDWITHCOMPONENTSANDTESTINGFORALEVELOFRELIABILITYSUITABLEFORUSEINORINCONNECTIONWITHSURGICALIMPLANTSORASCRITICALCOMPONENTSINANYLIFESUPPORTSYSTEMSWHOSEFAILURETOPERFORMCANREASONABLYBEEXPECTEDTOCAUSESIGNIFICANTINJURYTOAHUMAN.

(2)INANYAPPLICATION,INCLUDINGTHEABOVE,RELIABILITYOFOPERATIONOFTHESOFTWAREPRODUCTSCANBEIMPAIREDBYADVERSEFACTORS,INCLUDINGBUTNOTLIMITEDTOFLUCTUATIONSINELECTRICALPOWERSUPPLY,COMPUTERHARDWAREMALFUNCTIONS,COMPUTEROPERATINGSYSTEMSOFTWAREFITNESS,FITNESSOFCOMPILERSANDDEVELOPMENTSOFTWAREUSEDTODEVELOPANAPPLICATION,INSTALLATIONERRORS,SOFTWAREANDHARDWARECOMPATIBILITYPROBLEMS,MALFUNCTIONSORFAILURESOFELECTRONICMONITORINGORCONTROLDEVICES,TRANSIENTFAILURESOFELECTRONICSYSTEMS(HARDWAREAND/ORSOFTWARE),UNANTICIPATEDUSESORMISUSES,ORERRORSONTHEPARTOFTHEUSERORAPPLICATIONSDESIGNER(ADVERSEFACTORSSUCHASTHESEAREHEREAFTERCOLLECTIVELYTERMED"SYSTEMFAILURES").ANYAPPLICATIONWHEREASYSTEMFAILUREWOULDCREATEARISKOFHARMTOPROPERTYORPERSONS(INCLUDINGTHERISKOFBODILYINJURYANDDEATH)SHOULDNOTBERELIANTSOLELYUPONONEFORMOFELECTRONICSYSTEMDUETOTHERISKOFSYSTEMFAILURE.TOAVOIDDAMAGE,INJURY,ORDEATH,THEUSERORAPPLICATIONDESIGNERMUSTTAKEREASONABLYPRUDENTSTEPSTOPROTECTAGAINSTSYSTEMFAILURES,INCLUDINGBUTNOTLIMITEDTOBACK-UPORSHUTDOWNMECHANISMS.BECAUSEEACHEND-USERSYSTEMISCUSTOMIZED

Page 529: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

ANDDIFFERSFROMNATIONALINSTRUMENTS'TESTINGPLATFORMSANDBECAUSEAUSERORAPPLICATIONDESIGNERMAYUSENATIONALINSTRUMENTSPRODUCTSINCOMBINATIONWITHOTHERPRODUCTSINAMANNERNOTEVALUATEDORCONTEMPLATEDBYNATIONALINSTRUMENTS,THEUSERORAPPLICATIONDESIGNERISULTIMATELYRESPONSIBLEFORVERIFYINGANDVALIDATINGTHESUITABILITYOFNATIONALINSTRUMENTSPRODUCTSWHENEVERNATIONALINSTRUMENTSPRODUCTSAREINCORPORATEDINASYSTEMORAPPLICATION,INCLUDING,WITHOUTLIMITATION,THEAPPROPRIATEDESIGN,PROCESSANDSAFETYLEVELOFSUCHSYSTEMORAPPLICATION.

Page 530: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

TechnicalSupportandProfessionalServicesVisitthefollowingsectionsoftheNationalInstrumentsWebsiteatni.comfortechnicalsupportandprofessionalservices:

Support—Onlinetechnicalsupportresourcesatni.com/supportincludethefollowing:

Self-HelpResources—Foranswersandsolutions,visittheaward-winningNationalInstrumentsWebsiteforsoftwaredriversandupdates,asearchableKnowledgeBase,productmanuals,step-by-steptroubleshootingwizards,thousandsofexampleprograms,tutorials,applicationnotes,instrumentdrivers,andsoon.FreeTechnicalSupport—AllregisteredusersreceivefreeBasicService,whichincludesaccesstohundredsofApplicationsEngineersworldwideintheNIDiscussionForumsatni.com/forums.NationalInstrumentsApplicationsEngineersmakesureeveryquestionreceivesananswer.

Forinformationaboutothertechnicalsupportoptionsinyourarea,visitni.com/servicesorcontactyourlocalofficeatni.com/contact.

TrainingandCertification—Visitni.com/trainingforself-pacedtraining,eLearningvirtualclassrooms,interactiveCDs,andCertificationprograminformation.Youalsocanregisterforinstructor-led,hands-oncoursesatlocationsaroundtheworld.SystemIntegration—Ifyouhavetimeconstraints,limitedin-housetechnicalresources,orotherprojectchallenges,NationalInstrumentsAlliancePartnermemberscanhelp.Tolearnmore,callyourlocalNIofficeorvisitni.com/alliance.

Ifyousearchedni.comandcouldnotfindtheanswersyouneed,contactyourlocalofficeorNIcorporateheadquarters.YoualsocanvisittheWorldwideOfficessectionofni.com/niglobaltoaccessthebranchofficeWebsites,whichprovideup-to-datecontactinformation,supportphonenumbers,emailaddresses,andcurrentevents.

Page 531: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

NI7330and7340TimingInformationThefollowingtableliststheexecutiontimeforselectedVIs,aswellasforthedifferentattributesofthoseVIs,ifapplicable.Alsoincludedistiminginformationforaxesorvectorspaces,ifbotharesupportedwithagivenVI.

NoteThetimeslistedarebenchmarktimesandarenotaguaranteeofVIexecutiontimesonyoursystem.Timesdonottakeintoaccountotheroperations,onboardprograms,orotherfactorsthatslowperformance.

VI VIReturnTime(ms)using1.47GHzProcessor†

VIReturnTime(ms)using700MHzProcessor‡

LoadTargetPosition 1.1 1.2

ReadPosition 1.7 1.9ReadMotionI/OData

ForwardLimitActive

ReverseLimitActive

ForwardSoftwareLimitActive

ReverseSoftwareLimitActive

HomeInputActive

Inhibit-InActive

1.3

1.3

1.4

1.4

1.6

1.6

1.6

1.4

1.4

1.5

1.5

1.7

1.7

1.7

Page 532: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

In-PositionActive

DriveReadyActive

Inhibit-OutActive

1.6

1.6

1.7

1.7

ReadI/OPort 1.3 1.4SetI/OPortMOMO 1.1 1.2

LoadVectorSpacePosition 1.1 1.2

ReadVelocity

axis

vector1.8

1.9

1.8

1.9

ReadVelocityinRPM

axis

vector2.0

2.1

2.1

2.2

LoadVelocity

axis

vector1.2

1.2

1.3

1.3

LoadVelocityinRPM

Page 533: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

axis

vector 2.7

2.8

2.8

2.9

ReadMoveCompleteStatus 0.1 0.2

ConfigureVectorSpace 1.3 1.4

CheckMoveCompleteStatus 1.6 1.7

CheckBlendCompleteStatus 1.4 1.5

ReadCommunicationStatus

0.1 0.2

InitializeController 607.1 607.1

ReadDigitalI/OData

OutputActiveState

InputActiveState

OutputActive

InputActive

ConfigureAsInput

1.4

1.4

1.4

1.4

1.4

1.5

1.5

1.5

1.5

1.5

ReadFollowingError 1.8 1.9

†AnAMDAthlon1.47GHzPCwith256MBofRAMwasusedfortiming

Page 534: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

tests.Testsrunin"abovenormalpriority"executiontoachievethemostaccurateresults.

‡AnIntelPentium3700MHzPCwith386MBofRAMwasusedfortimingtests.Testsrunin"abovenormalpriority"executiontoachievethemostaccurateresults.

Page 535: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

NI7334,7342,and7344TimingInformationThefollowingtableliststheexecutiontimeforselectedVIs,aswellasforthedifferentattributesofthoseVIs,ifapplicable.Alsoincludedistiminginformationforaxesorvectorspaces,ifbotharesupportedwithagivenVI.

NoteThetimeslistedarebenchmarktimesandarenotaguaranteeofVIexecutiontimesonyoursystem.Timesdonottakeintoaccountotheroperations,onboardprograms,orotherfactorsthatslowperformance.

VI VIReturnTime(ms)using1.47GHzProcessor†

VIReturnTime(ms)using700MHzProcessor‡

LoadTargetPosition 1.1 1.2

ReadPosition 1.9 1.9ReadI/OPort 1.6 1.7SetI/OPortMOMO 1.1 1.2

LoadVectorSpacePosition 1.3 1.4

ReadVelocity

axis

vector1.9

2.02.0

2.1

ReadVelocityinRPM

axis 2.1 2.2

Page 536: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

vector 2.1 2.2

LoadVelocity

axis

vector1.5

1.2

1.6

1.3

LoadVelocityinRPM

axis

vector3.4

1.9

3.5

1.9

ReadMoveCompleteStatus 0.1 0.1

ConfigureVectorSpace 1.7 1.8

CheckMoveCompleteStatus 1.5 1.6

CheckBlendCompleteStatus 1.6 1.7

ReadCommunicationStatus

0.1 0.1

InitializeController 620.4 620.4

ReadFollowingError 1.8 1.8

†AnAMDAthlon1.47GHzPCwith256MBofRAMwasusedfortimingtests.Testsrunin"abovenormalpriority"executiontoachievethemostaccurateresults.

Page 537: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

‡AnIntelPentium3700MHzPCwith386MBofRAMwasusedfortimingtests.Testsrunin"abovenormalpriority"executiontoachievethemostaccurateresults.

Page 538: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

NI7350TimingInformationThefollowingtableliststheexecutiontimeforselectedVIs,aswellasforthedifferentattributesofthoseVIs,ifapplicable.Alsoincludedistiminginformationforaxesorvectorspaces,ifbotharesupportedwithagivenVI.

NoteThetimeslistedarebenchmarktimesandarenotaguaranteeofVIexecutiontimesonyoursystem.Timesdonottakeintoaccountotheroperations,onboardprograms,orotherfactorsthatslowperformance.

VI VIReturnTime(ms)using1.47GHzProcessor†

VIReturnTime(ms)using700MHzProcessor‡

LoadTargetPosition 1.1 1.2

ReadPosition 0.1 0.1

ReadAxisData

Position

Velocity

FollowingError

0.1

0.1

0.1

0.2

0.2

0.2

ReadAxisStatus

AxisActive

MoveComplete

ProfileComplete

BlendComplete

FollowingError

0.1

0.1

0.1

0.1

0.2

0.2

0.2

0.2

Page 539: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

VelocityThresholdReached

Moving

DirectionForward

0.1

0.1

0.1

0.1

0.2

0.2

0.2

0.2

ReadAllAxisData 0.2 0.3

ReadAllAxisStatus 0.1 0.2

ReadCoordinateData

Velocity

FollowingError0.2

0.2

0.3

0.3

ReadCoordinatePosition 0.3 0.3

ReadEncoderData

Position

IndexPosition

IndexCapture

0.1

1.6

0.1

0.2

1.7

0.2

ReadMotionI/OData

ForwardLimitActive

ReverseLimit

Page 540: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Active

ForwardSoftwareLimitActive

ReverseSoftwareLimitActive

HomeInputActive

Inhibit-InActive

In-PositionActive

DriveReadyActive

Inhibit-OutActive

0.1

0.1

0.1

0.1

0.1

1.5

1.5

1.5

1.5

0.2

0.2

0.2

0.2

0.2

1.6

1.6

1.6

1.6

ReadCaptureCompareData

CapturedPosition

CaptureStatus

CompareStatus

1.6

0.1

0.1

1.7

0.2

0.2

ReadI/OPort 0.2 0.3SetI/OPortMOMO 1.1 1.2

LoadVectorSpacePosition 1.2 1.3

ReadVelocity

axis

Page 541: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

vector 0.1

0.2

0.2

0.3

ReadVelocityinRPM

axis

vector0.1

0.2

0.2

0.3

LoadVelocity

axis

vector1.3

1.1

1.4

1.2

LoadVelocityinRPM

axis

vector3.1

1.8

3.2

1.8

ReadMoveCompleteStatus 0.1 0.1

ConfigureVectorSpace 1.8 1.8

CheckMoveCompleteStatus 1.5 1.6

CheckBlendCompleteStatus 1.5 1.6

ReadCommunicationStatus

0.1 0.1

Page 542: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

InitializeController 1218.0 1218.0

ReadCoordinateStatus

MoveComplete

ProfileComplete

BlendComplete

FollowingErrorExceeded

0.2

0.2

0.2

0.2

0.3

0.3

0.3

0.3

ReadDigitalI/OData

OutputActiveState

InputActiveState

OutputActive

InputActive

ConfigureAsInput

1.3

1.3

0.2

0.2

1.3

1.3

1.3

0.2

0.2

1.3

ReadFollowingError 2.1 2.1

†AnAMDAthlon1.47GHzPCwith256MBofRAMwasusedfortimingtests.Testsrunin"abovenormalpriority"executiontoachievethemostaccurateresults.

‡AnIntelPentium3700MHzPCwith386MBofRAMwasusedfortimingtests.Testsrunin"abovenormalpriority"executiontoachievethemostaccurateresults.

Page 543: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

NI7390TimingInformationThefollowingtableliststheexecutiontimeforselectedVIs,aswellasforthedifferentattributesofthoseVIs,ifapplicable.Alsoincludedistiminginformationforaxesorvectorspaces,ifbotharesupportedwithagivenVI.

NoteThetimeslistedarebenchmarktimesandarenotaguaranteeofVIexecutiontimesonyoursystem.Timesdonottakeintoaccountotheroperations,onboardprograms,orotherfactorsthatslowperformance.

VI VIReturnTime(ms)using1.47GHzProcessor†

VIReturnTime(ms)using700MHzProcessor‡

LoadTargetPosition 1.1 1.2

ReadPosition 0.1 0.2

ReadAxisData

Position

Velocity

FollowingError

0.1

0.1

0.1

0.2

0.2

0.2

ReadAxisStatus

AxisActive

MoveComplete

ProfileComplete

BlendComplete

FollowingError

0.1

0.1

0.1

0.1

0.2

0.2

0.2

0.2

Page 544: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

VelocityThresholdReached

Moving

DirectionForward

0.1

0.1

0.1

0.1

0.2

0.2

0.2

0.2

ReadAllAxisData 0.2 0.3

ReadAllAxisStatus 0.1 0.2

ReadCoordinateData

Velocity

FollowingError0.2

0.3

0.3

0.4

ReadCoordinatePosition 0.2 0.3

ReadEncoderData

Position

IndexPosition

IndexCapture

0.1

1.5

0.1

0.2

1.6

0.2

ReadMotionI/OData

ForwardLimitActive

ReverseLimit

Page 545: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Active

ForwardSoftwareLimitActive

ReverseSoftwareLimitActive

HomeInputActive

Inhibit-InActive

In-PositionActive

DriveReadyActive

Inhibit-OutActive

0.1

0.1

0.1

0.1

0.1

1.3

1.3

1.3

1.3

0.2

0.2

0.2

0.2

0.2

1.4

1.4

1.4

1.4

ReadCaptureCompareData

CapturedPosition

CaptureStatus

CompareStatus

1.5

0.1

0.1

1.6

0.2

0.2

ReadI/OPort 0.2 0.3SetI/OPortMOMO 1.0 1.1

LoadVectorSpacePosition 1.1 1.2

ReadVelocity

axis

Page 546: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

vector 0.1

0.2

0.2

0.3

ReadVelocityinRPM

axis

vector0.1

0.2

0.2

0.3

LoadVelocity

axis

vector1.2

1.1

1.3

1.2

LoadVelocityinRPM

axis

vector2.7

1.5

2.7

1.6

ReadMoveCompleteStatus 0.1 0.1

ConfigureVectorSpace 1.4 1.5

CheckMoveCompleteStatus 1.5 1.6

CheckBlendCompleteStatus 1.4 1.4

ReadCommunicationStatus

0.1 0.1

Page 547: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

InitializeController 565.5 608.5

ReadCoordinateStatus

MoveComplete

ProfileComplete

BlendComplete

FollowingErrorExceeded

0.2

0.2

0.2

0.2

0.3

0.3

0.3

0.3

ReadDigitalI/OData

OutputActiveState

InputActiveState

OutputActive

InputActive

1.3

1.3

0.2

0.2

1.4

1.4

0.3

0.3

ReadFollowingError 2.1 2.1

†AnAMDAthlon1.47GHzPCwith256MBofRAMwasusedfortimingtests.Testsrunin"abovenormalpriority"executiontoachievethemostaccurateresults.

‡AnIntelPentium3700MHzPCwith386MBofRAMwasusedfortimingtests.Testsrunin"abovenormalpriority"executiontoachievethemostaccurateresults.

Page 548: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

BranchOfficesOffice TelephoneNumber

Australia 1800300800Austria 43662457990-0Belgium 32(0)27570020Brazil 551132623599Canada 8004333488China 862165557838CzechRepublic 420224235774Denmark 4545762600Finland 385(0)972572511France 33(0)148142424Germany 49897413130India 918041190000Israel 972036393737Italy 3902413091Japan 81354722970Korea 820234513400Lebanon 961(0)1332828Malaysia 1800887710Mexico 018000100793Netherlands 31(0)348433466NewZealand 0800553322Norway 47(0)66907660Poland 48223390150Portugal 351210311210Russia 74957836851Singapore 18002265886Slovenia 38634254200SouthAfrica 270118058197

Page 549: NI-Motion VI HelpThis help file provides a comprehensive reference of all NI-Motion Virtual Instruments (VIs). This document is intended for use by developers of NI-Motion systems

Spain 34916400085Sweden 46(0)858789500Switzerland 41562005151Taiwan 8860223772222Thailand 6622786777Turkey 902122793031UnitedKingdom 44(0)1635523545UnitedStates(Corporate) 5126830100