Shop Learn
using multiple frequencies to control a stepper motor. - Page 3 — Parallax Forums

using multiple frequencies to control a stepper motor.



  • It's saying that PWM_FREQ is not defined. Look at your declaration for PWM_FREQ in the CON section. It has two underscores instead of one.
  • bbrienbbrien Posts: 516
    edited 2020-12-17 21:58
    Fixed the double underscore , now I get error "expected ",". " on line for Step.Synth( SIDE_RATE) at closing ")". New program follows
  • In the OBJ Stepper.spin can I use a decimal in the scale.
  • Dave HeinDave Hein Posts: 6,347
    edited 2020-12-18 00:20
    No, but we can change the way the frequency is computed to make it more precise. I'll take a look at it.
  • I modified the telescope mount program so that it passes the frequency scaled by 10 to the stepper.set_speed routine. I defined the constant RA_RATE to set the base value for the RA speed. This should be set to the frequency needed to generate the sidereal speed. The value is currently set to 9_5, which corresponds to 9.5 Hz.

    The SCALE value in stepper.spin must be changed to a value of 4 so that it divides the parameter received in set_speed by 10 to get the right frequency.
  • bbrienbbrien Posts: 516
    edited 2020-12-21 19:43
    OK now it's working like a champ. I got it down to 8Hz and the orion mount is tracking about one minute slow in 30 minutes. The meade mount uses a larger gear on the RA axis which is good news. Thanks for all your help. Willl include picture
    2560 x 1920 - 907K
  • Hello from Thailand. I am working on the big scope using Dh 14 program and I ran into a snag here. When I use7 as the SIDE_RATE, I get a frequency of 7Hz but when I use 7_5 I do not get 7.5Hz like before. I wonder what is going on.

  • JonnyMacJonnyMac Posts: 8,097
    edited 2022-06-12 19:38

    If you use 7 for 7 Hz, you cannot use 7_5 (which is 75) for 7.5 Hz. The problem is easily fixed by changing the SCALE constant in the stepper object from 40 to 4, and then always setting the speed in 0.1Hz units, so 7_0 is 7.0 Hz and 7_5 is 7.5Hz.

    Note: The Propeller compiler ignores the _ in numbers -- this is not a replacement for a decimal point. Many of us use this style to indicate that the value doesn't represent whole units.

  • JonnyMacJonnyMac Posts: 8,097
    edited 2022-06-13 16:18

    Note: The way Dave wrote that stepper code means you can only ever run one instance of it in a program. If you decide you need two steppers, you'll need to move the values that are in the dat section to a var section. All instances of a given class share the dat and code sections from the class.

Sign In or Register to comment.