 Atul_Goyal
		
			Atul_Goyal
		
		
		
		
		
		
		
		
	
			04-18-2016 01:20 AM
Hi,
I am developing a VI that needs an output motor to be switched "ON" for some fixed timing. Like If an event is sensed using a sensor, the motor should run for exactly 2 minutes and then stop. Please help how to achieve it and what logic or function should be used to achieve this.
Thanks to all of you in advance.
Atul Goyal.
 GerdW
		
			GerdW
		
		
		 
		
		
		
		
		
	
			04-18-2016 02:03 AM
Hi Atul,
the motor should run for exactly 2 minutes and then stop
Please define "exactly"! Is it in the order of seconds or is it nanoseconds?
My advice is to use a state machine to switch this motor ON and OFF. And use ElapsedTime to start and stop your timer…
 sankar06
		
			sankar06
		
		
		
		
		
		
		
		
	
			04-18-2016 09:37 AM
Hi Atul,
Frist write a simulation code with State machine architecture. You can find the template for State machine here. Use Elapse time or Wait Until Next ms Multiple for timing control( In this method you can get 1ms accuracy). If every thing working fine in this simulation, change your code to interface hardware.
Happy to Wire