Machsupport Forum
		Mach Discussion => VB and the development of wizards => Topic started by: imitheo on October 27, 2017, 02:07:50 PM
		
			
			- 
				Hi guys, i am trying to develop a mechanical tool changer, but i am stuck at the following point, i need to control a micro servo using an output
from my motion controller. I tried to write a code, like this, to try creating a "pulse":
Sub Advance_Servo()
Dim i As Integer
i = 0
While i<10
ActivateSignal(OUTPUT4)
Sleep(1.5)
DeactivateSignal(OUTPUT4)
Sleep(18.5)
i=i+1
Wend 
End Sub 
This is creating a square wave in the oscilloscope, but it's so weird, really weird.
The pulses are not in the programmed time. Is this the motion controller, or macro's just can't create a nice waveform ?
This is my servo:
http://mekanus.com.br/imagens_ML/servo-9g/s3.jpg (http://mekanus.com.br/imagens_ML/servo-9g/s3.jpg)
			 
			
			- 
				activate and deactiate outpult will allways create a square Signal (what else !!?)
1.5ms on a Windows System where the macro scripting is running in a 10ms Task,
no way.
---Is this the motion controller, or macro's just can't create a nice waveform ?
what Hardware are you using on the Controller side ?
Thomas 
			 
			
			- 
				I am using a nevex(Brazilian company) motion controller.
I said weird when referring to the not constant period. Yes 10ms.. i see, the only way to make this happen is to use
the activate signal to signal some pic or signal generator outside the motion controller ?
			 
			
			- 
				if you need such a precise timing  (1,5/18,5ms) the only way is a extrenal Signal Generator.  
			
 
			
			- 
				As i imagined.
			
 
			
			- 
				It worked nicely, used a PIC to generate the square wave for the servo.