Shop Learn P1 Docs P2 Docs
dual stepper motors CLOSING IN FAVOR OF OF PROP C - Page 3 — Parallax Forums

dual stepper motors CLOSING IN FAVOR OF OF PROP C



  • Am going to try the methods given on pages 135 - 153 of PE Kit labs. Wish me luck.

  • GenetixGenetix Posts: 1,683


    The PE Kit Labs text is great, but it hasn't been updated so don't rely solely on it.

    I think counting the number of teeth on each of your Axis gears, as much of a pain as it is, would be more useful.
    The gear ratio determines how fast the axis moves.
    I find that counting by 5's is best.

    Also do you have instructions for your Guide Scope so I can understand how it works.

  • At this time I don't have immediate access to my instructions for the costar autoguider and am not concerned with the autoguider. I am more concerned with the lack of signal on the enable pins on the programs dh15 through dh19N. When I use dh14 I have function on all outputs,RA_enable outputs a square wave(50%) and the DEC_Enable outputs a PWM signal(15% duty). see Post#60; "drive gears are not accessable on the mount.

  • GenetixGenetix Posts: 1,683


    It's been a while since you last posted so I need to refresh on your setup.

    As one of my coworkers repeatedly says, "You can't fix the software if the hardware isn't 'frozen' or no more hardware changes".

    Something must have changed in the software after dh14 and other than pin changes were there any other hardware changes.

    Just so we are clear, what pins do you currently have connected to something and where does each on go?

  • GenetixGenetix Posts: 1,683


    Is this your guide camera?
    Starlight Xpress CoStar Autoguider Monochrome CMOS Telescope Camera

  • GenetixGenetix Posts: 1,683
    edited 2022-01-04 10:37


    These are the changes that I saw between DH14 that you say works and DH15 which does not:
    RA_SPEED ' Changed from 16 to 13
    RA_DIR ' Changed from 17 to 12
    DEC_SPEED ' Changed from 18 to 15
    DEC_DIR ' Changed from 19 to 14
    TX ' Changed from 3 to 10
    RX ' Changed from 2 to 11
    DEC_RATE ' Changed from 8_0 to 7_5
    RA_RATE ' Changed from 7_5 to 9_5

    In PUB Main

       STEP1.SET_SPEED(-RA_AUTO + RA_RATE) ' Changed from subtracted (-) to added (+)

    CON ' Bottom of the program
    TRACE_SIZE ' Changed from 5000 to 6000


  • bbrienbbrien Posts: 525
    edited 2022-01-04 19:41

    The major changes in the board design is(1) The Processor changed from "Flip" to The 40 pin Dip chip with added EEPROM and 3.3v regulator(PELab Kit). (2) replacing the UDN2993 with second MC3479 stepper driver resulting in 2 stepper driver chips. See attached documents. Yes That is my costar. SquareWaveTest.spin does Work,PELab Kit pp143-145

  • The problem is in the stepper object , I am Trying other programs that I have which might work if I can adapt Synth or SquareWave to the programs.I am working withTelescope2b

  • GenetixGenetix Posts: 1,683


    Looking at Telescope test 2b, what is the 'longcon', which is at the top of the program?
    LONG is a 32-bit variable, and CON designates a block of CONstants.

    Is there a reason that you are only running at 5 MHz, because you on have PLL1X which is a 1X multiplier?
    Typically the Propeller is run at 80 MHz using PLL16X for a 16X multiplier (5 MHz x 16 = 80 MHz).

    I recognize bits and pieces of JonnyMac code in the program and I am not as versed in Spin as he is, so I need to decipher what some of them do.
    I don't know how you can work with this program without ANY comments, because if it were me it would commented to death not only explaining what it does but HOW.

  • This is a very old program from around 2020 in June . I believe it written for my Meade"SCT"
    IT does actually work. First the NORTH,SOUTH,EAST,WEST pins refer to the inputs of a "Guide Camera" which is controlled by a separate computer(laptop) camera interfaces to the mount by 5 conductor cable with 6p6c modular phone jack and opto-isolators(optical transistors) , hand box communicates with mount by serial. I am somewhat lost with the section after setup concerning the line "ctra := %00100 << 26 " is that the same as ctra[30..26] := %00100.

  • GenetixGenetix Posts: 1,683


    The Serial Method and Object are not used, so why are they there?

    The Main loop repeats every 1/50 seconds according to Cycle_Tix, and the motors get 15 ms pulses when the Guide Camera is in control.

    When the Guide Camera gives no input, the motor moves West using 1.95 ms pulses (1 ms = 1000 us).

    %00100 places the counter in NCO single-ended (Square Wave) mode.
    << is a Bitwise Shift Left and will place 26 zeros to the Left side of the value before it, which moves the CtrMode value into bits 26 to 30.
    | is a Bitwise OR and it will place the counter control pin into bits 0 to 5.

  • I guess I can keep it for my frequency generator. Tomorrow I will post my partial program to the forum.

  • Can you help with setting up a serial(fds) to communicate with the hand box , it sends 4 bytes of data.

  • GenetixGenetix Posts: 1,683


    What is the Receive Pin number?
    What is the Transmit Pin number?
    What is the communication Mode (I assume it's 0)?
    What is the Baud Rate?

    Then you would call fds.Start with those parameters to start up the Serial object.

    There is a method called RxCheck that will be 0 or greater if anything was received.
    If there was data then use method Rx.

    IF (fds.rxcheck => 0) ' Check for data
    DataByte := fds.rx ' and grab it, if it's there.

  • bbrienbbrien Posts: 525
    edited 2022-01-25 23:22

    I think I am still Having a small problem with the program, I have two pulse patterns when there should only be one. It's not running the nav section it goes strait to output, also my oscilloscope has taken a dump. New version of T 3_A

  • GenetixGenetix Posts: 1,683


    How many times do I need to say it: "COMMENT YOUR CHANGES!

    In 2A, there was a 0 before GO_EAST and GO_WEST, but it's a 1 in 3A.

    Before the WAITCNT in the Main loop, 2A had PHSA := - nspulse and PHSB := -ewpulse, but both are missing in 3A.

    In 2A, there was a PHSA := STOP and PHSB := STOP in Setup between the FRQx and DIRA commands.

    Also, in 2B the Main loop had a 50 Hz pause, while 3A is 30 Hz (AFreq).

  • bbrienbbrien Posts: 525
    edited 2022-01-21 17:23

    If I am correct in 2a , the program we generated a duty cycle pulse, but in 3_A I am not using variable duty, only the frequency method is being used, thus no PHSAB. Also I love your cat.

  • bbrienbbrien Posts: 525
    edited 2022-01-23 08:46

    SENDING MODIFIED version of my dh15 files, having problems compiling. will send screen shot.

  • GenetixGenetix Posts: 1,683


    Where did you get Synth.spin from?

    When you use an Object, you can only call PUBlic Methods from it.
    Either Set_Speed is a PRIvate Method (can only be used WITHIN an Object) or it doesn't exist.

    The cat is called an Abyssinian and it's a picture I grabbed from the Internet many many years ago.

  • I am not certain where I found the program but I think it may have been in my propeller tool library, anyway I'm sending it to my post.

  • PublisonPublison Posts: 12,360

    @Genetix said:

    Where did you get Synth.spin from?

    When you use an Object, you can only call PUBlic Methods from it.
    Either Set_Speed is a PRIvate Method (can only be used WITHIN an Object) or it doesn't exist.

    The cat is called an Abyssinian and it's a picture I grabbed from the Internet many many years ago.

    Synth.spin is the the Proptool library, written by Chip.

  • JonnyMacJonnyMac Posts: 8,229

    Where did you get Synth.spin from?

    It's an old object that is designed for things the OP doesn't require. This method, from my IO object, will set a pin to NCO mode. With two counters in the cog, it will allow for two oscillators.

    pub freq_out(ctrx, px, fx)
    '' Sets ctrx to frequency fx on pin px (NCO/SE mode)
    '' -- fx in 0.1Hz units (100_0 = 100Hz)
    '' -- use fx of 0 to stop counter that is running
      if (fx > 0)
        fx := ($4000_0000 / ((clkfreq >> 2) / fx))                  ' convert freq for NCO mode
        fx := (fx + 5) / 10                                         ' round up if needed
        case ctrx
          0, "a", "A":
            ctra := (%00100 << 26) | px                             ' configure ctra for NCO on pin
            frqa := fx                                              ' set frequency
            dira[px] := 1                                           ' make pin an output
          1, "b", "B":
            ctrb := (%00100 << 26) | px
            frqb := fx
            dira[px] := 1
        case ctrx
          0, "a", "A":
            ctra := 0                                               ' disable counter
            outa[px] := 0                                           ' clear pin/driver
            dira[px] := 0
          1, "b", "B":
            ctrb := 0
            outa[px] := 0
            dira[px] := 0

    I tested this at 8.0 and 10.0 hertz a week or so because the OP says he needs those and doesn't want to use a cog. This is from my LA.

  • GenetixGenetix Posts: 1,683


    FrequencySynth.spin appears to be the Demo program because it uses Synth as an Object.

    Synth.spin has only one PUBlic method called Synth.

    Your DH15 program is looking for a Set_Speed method that does not exist in Synth.spin, so that is why you are getting an error.

    One nice thing about the Propeller Tool is that you if you double-click on a Spin file, it will open up in another tab.
    It's always a good idea to see what PUBlic methods exist in an Object and what Parameters are needed.

    Publison, I don't have Prop Tool installed on this PC and I think I have heard people mention Synth.spin before.

    Jon, I saw what you are Tracy said in the other thread.

  • Okay Jon , Telescope 3_A how do I make it start the case test and then follow the instructions.

  • bbrienbbrien Posts: 525
    edited 2022-01-25 23:23

    Genetix: Can you have a look at Telescope 3_A, The program seems to skip over the main program and run only the setup .

  • GenetixGenetix Posts: 1,683


    One thing I notice in the CON section is that GO_EAST and GO_WEST now start at 1 (#1), where before they started at 0 just like GO_NORTH and GO_SOUTH.

    Try putting t := CNT under the REPEAT.
    It takes a while to catch up to an old CNT value.

  • I moved t := cnt under repeat and indented two spaces and still no change . Dec pin still flashing when it should be off.

  • Hi Jon ; in your last post you sent me some code , question what is (0, "a", "A") and (1, "b", "B") and what do the mean.

  • JonnyMacJonnyMac Posts: 8,229

    Those are different ways to refer to ctra (0, "a", "A") or ctrb (1, "b", "B") -- the two counters in each cog. You wanted two oscillators without using another cog; that code let's you do it. But then, had you taken a minute to study the code, you'd have seen that.

  • Well I did study it But when one has a old and feeble mind one misses things or doesn't understand what he is looking at so I do the best I can. When I finish I'll send the modified version so you can check it.

Sign In or Register to comment.