Example Programs

Showing results for 
Search instead for 
Did you mean: 

Build State Machine with SoftMotion Function Blocks using LabVIEW



This example demonstrates how to build a State Machine controlling axis using SoftMotion Function Blocks.



NI SoftMotion 2009 introduced a new API based on LabVIEW function blocks. This is a non-blocking API optimized for use in real time targets like cRIO. This example shows users how these function blocks can be used in a state machine architecture for developing motion applications.
A key concept to remember when programming with function blocks is that the "execute" boolean input must transition from false-to-true in order for the function block to start. If a boolean true constant is wired to the execute input, the user will find that the first call of the function block executes correctly, but in every subsequent call it fails to start. 
See the NI SoftMotion 2009 State Chart Example to see SoftMotion function blocks used with NI LabVIEW State Chart Module




  • LabVIEW Full Development System 2012 (or compatible)
  • LabVIEW Real-Time Module 2012 (or compatible)
  • NI SoftMotion Module 2012 (or compatible)
  • NI-CompactRIO 12.0 (or compatible)


  • NI Real-Time cRIO
  • NI-9512
  • SMD-7616
  • ST23

Steps to Implement or Execute Code

  1. Run the VI.

Additional Information or References


 Axis Straight Line Example.vi - Front Panel.png


Axis Straight Line Example.vi - Block Diagram.png   

**The code for this example has been edited to meet the new Community Example Style Guidelines. The edited copy is marked with the text 'NIVerified'. Read here for more information about the new Example Guidelines and Community Platform.**

Member hanyang19861017@163.com

Hi! MarcoPolo5   How are you! may I could make friend with you?  I am a student  pursuing a master's degree in zhejiang sci-tech university in hangzhou zhejiang province of china.,my major is mechanical design and mechanical engineering.     I have been studying the NI Labview ,NI SoftMotion or NI SoftMotion for SolidWorks for one month,but I have not any progress, so I want you give me some resource ,such as the website that can download NI SoftMotion 2009 or NI SoftMotion for SolidWorks module free of charge.     I will be appreciated if yougive some community number such as MSN,or QQ that is very prevail in China , there are many problems for me , there are not any website to introduce knowledge about NI SoftMotion or NI SoftMotion for SolidWorks in China. If you could give me help ,I will have great improvement in studying NI Labview ,NI SoftMotion or NI SoftMotion for SolidWorks, and it is also  will be usefull for me to improve my English skill. My English is poor , forgive me if there have any difficulties for you to read my text.   I will be appreciated if you give me a email attaching your email ,MSN number ,or other contact mode.My email is hanyang19861017@163.com, mobile phone number is 13634129375 and QQ is 575748306, my address is zhejiang sci-tech university, jianggan district, hangzhou  zhejiang province in china. my chinese name is hanyang ,my english name is harry.If you want to make friend with me ,I am looking forward your email

Member hanyang19861017@163.com

  Could the NI SoftMotion or NI SoftMotion for SolidWorks simulate realistic machine running condition?  which include the assembly tolerance ,combination and auxiliary device such as sensor . However ,the real machine system are not drived by serv motor, most of them are drived by screw rod , belt drive and hydraulic pressure device. If NI company solve these factor, it is not reliable for us to use these data generated by Virtual prototyping to produce physical prototyping .But there are many constraint for us to use NI SoftMotion or NI SoftMotion for SolidWorks to simulate realistic machine running condition. If that ,we choose the ADAMS software to simulate the kinematic or dynamic of machine at all .Why NI SoftMotion or NI SoftMotion for SolidWorks module are not downloaded freely.

Member hanyang19861017@163.com

hi MarcoPolo5,   do you  simulate this program sucessfully, Does there has the hardware,which can simulate in solidworks, thank you hanyang

Member hanyang19861017@163.com

Hi  MarcoPolo5 could you add me  ,my MSN is hanyang19861017@Hotmail.com thank you your sincerely hanyang

Member hanyang19861017@163.com

Hi,MarcoPolo5 my MSN is hanyang19861017@Hotmail.com,thank you  add me ,become your friend

Member atul_rk

Hi Sir

I am doing a project on Inverted pendulum where i'm using a kollmorgan servo motor and AKD drive for actuation. I'm using Labview softmotion for programming.

My problem is as follows

For my application servo has to execute command without checking that previous command is executed. here command is taken by motor only after previous command is finished execution. here my motor has to move rapidly according to the instantaneous commands. Sir please give me a solution to this problem

Member SbihaLassaad

If I want to use the torque command offset and make my own order, how can I do it?