Sign in

username:

password:



Not a member?

Search basicx



Search tips

Subscribe to basicx



basicx by Keywords

Accelerometer | ADC | ADXL | Adxl20 | AVR | BasicStamp | BX-35 | BX28 | BX35 | COM3 | Compiler | Downloader | EEPROM | Electromagnet | GetADC | GP2D1 | GPS | I2C | IDE | Keypad | LCD | LCD+ | MIDI | Motors | Multitasking | Netmedia | Networking | PCB | PID | PlaySound | PWM | Relays | RTC | Servo | ShiftOut | SitePlayer | SPI | Stack | Timer | USB


Ads

Discussion Groups

See Also

DSPFPGAElectronics

Discussion Groups | BasicX | Pulse Frequency Jittering and Stepper Motor

Discussion forum for the BasicX family of microcontroller chips.

Pulse Frequency Jittering and Stepper Motor - Russ Durkee - Mar 24 18:08:00 2005


Hello,
I am new to the basicx but have done a variety of programming over the
years...and I am running into a problem driving a stepper motor
through a Parker DB Drive with standard step and direction signals.

I have written two simple programs to send pulses to the stepper
controller and I am seeing a frequency shift in the pulse train in
each case. As a result the stepper is loping, running faster and then
slightly slower and then faster over fractions of a second. The
controller is microstepping 10000 steps/rev. I am able to see the
jitter because I have a mirror attached to the stepper shaft and a
laser bouncing off the mirror. I am after reasonable smooth motion.

When I stick a scope on output I can easily see the frequency of the
pulse train jittering by 20% or more. The variability scales with the
frequency of the pulses too...so if I increase the pulse width, the
jittering increases as well. Is there an inherent jitter in the clock
of the Basicx?

The first program is a simple pulse out pin 5. The second program
uses the AutoCapture output...and I see the same result.

Am I missing something here?

Thanks for any suggestions...

Regards,

Russ
'First Program
Option Explicit

Dim PulseWidth As Integer
Public Sub Main()

Do
PulseWidth = 1000
'Pulse Pin5
Call PulseOut(5,PulseWidth,0)
Call PulseOut(5,PulseWidth,1)
Loop
End Sub
'Second Program

Option Explicit

Dim ToggleArray (1 to 2) as New UnsignedInteger
Public Sub Main()

ToggleArray(1) = 9000
ToggleArray(2) = 9000

Do

Call OutputCapture(ToggleArray,2,1)

Loop

End Sub





(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )


RE: Pulse Frequency Jittering and Stepper Motor - Tom Becker - Mar 24 18:55:00 2005

> ... frequency of the pulse train jittering by 20%...

Yes, I suspect you are seeing a temporal artifact of multitasking. Both
techniques you tried need to loop for each output cycle, so the loop
time will vary as the OS performs its magic. In particular, since your
~2mS pulse width is very close to the OS tick of ~1.95mS, you might well
be seeing a slow beat product of the two frequencies, making the effect
more dramatic. Bit banging in a multitasking environment makes for a
poor signal generator.

Try PWM. Once you set it, the PWM hardware mechanism operates
autonomously and should produce a continuous stable stream, although the
available rates are few. I've seen others use an external 555, ramping
it's rate with an analog output. You can bring it's output back to a
pin to count if you need to know the motor's position. Tom
Tom Becker
--... ...--
www.RighTime.com
The RighTime Clock Company, Inc., Cape Coral, Florida USA
+1239 540 5700




(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )