The Software

The software has gone through several reincarnations, starting as 6502 assembly code for the Commodore 64, when the Commodore 64 first came out (I bought my Commodore 64 for at the time incredible sales price of $600, and with no floppy or tape drive, and had to reenter my programs everytime I turned the computer back on!). Unfortunately, the stalwart 2 megahertz 6502 processor could only muster recentering the object every couple seconds. The dream of an inexpensive amateur built altaz drive seemed far away, until the AT class machines arrived. The code was then rewritten in C. Later, the code went through its C++ object oriented life on a 386. Now, in interests of making the code as universal and easy to port, the code lives in ANSI C. Functions that are directly tied to low level hardware such as the parallel port and bios clock, use pointers to access the appropriate memory locations. For non-DOS machines, some modification of these parts of the code will be necessary.

The program is based on the popular two-star conversion algorithm, based on an Feb '89 Sky and Telescope magazine article by Toshimi Taki, to translate between altazimuth and equatorial coordinates. The scope need only be accurately aligned on two widely separated stars using a high power reticle eyepiece; there is no need to level the base. The scope can also be initially set on a planet, say, soon after sunset. After a couple of minutes of microstepping recentering, the scope is initialized on the same object again. The scope will continue to track the object, keeping it in the eyepiece field of view for an hour or two.

In addition, the program will use a third initialization point, for more accuracy than the two star initialization would otherwise give. Any of the three initialization positions can be reinitialized as often as wanted. The conversion algorithm allows the input of mount construction errors. For instance, one altitude bearing may be a bit lower than its counterpart. Normally this would cause a pointing error, but the conversion algorithm will compensate once given the amount of the error. All init positions are saved to a file for later analysis.

In addition, the program can refine the altitude angle based on the initialized positions.  Per the original Taki routine, the starting azimuth can be any number.  Now the starting altitude only needs to be set to within 10 degrees or so.  This altitude offset algorithm was contributed by Dave Sopchak.

The software is event driven by either keyboard or hand paddle input. If no events occur, then the scope moves to the current equatorial coordinates. If the coordinates remain unchanged, the scope tracks. If new coordinates are entered, the scope slews. Slews can only be interrupted by pressing or releasing a button on the handpad, and by the keyboard, and by the altitude or azimuth limits if the interrupt driven halfstepping option is turned on. Tracking should be paused if hot-keying out to another program. When the program is exited, the scope's altazimuth coordinates are saved along with any initialized positions.

The software handles backlash and handles periodic error correction, or PEC, for both axis. A 'guide' function is also included so that guiding for a minute or two nulls occasional tiny residual drift.


  • Files Used:

  • scope.exe - the executable program
    config.dat - the configuration file
    scope.c, lowlevel.c, common.c, scope.h, lowlevel.h, common.h - source code
    current.dat - last saved scope altazimuth coordinates in degrees
    align.dat - last saved initialization coordinates in degrees (Ra, Dec, Alt, Az, Sidereal Time)
    init.dat - a record of all initializations, in degrees (Ra, Dec, Alt, Az, Sidereal Time)
    pec.dat - the file used for periodic error corrections to the motors
    guide.dat - a record of guiding corrections
    bstars.dat, messier.dat, 5magstar.dat, ngc0.dat through ngc7.dat, and ic.dat are all object catalog files
    outguide.dat - list of exit positions from Project Pluto Guide
    *.scr - scroll files
    record.dat - record scope equatorial scope positions via the handpaddle
    encoff.dat - altitude and azimuth encoder offset values in radians
    encoders.txt - a recording of encoder threshold violations for each session
     

  • Data object file layout (a single blank space must start each line):

  •  Ra_hrs Ra_min Ra_sec Dec_deg Dec_min Dec_sec name or comment
    ie,
     12 23 14 33 53 09 test position

    I have a conversion program available for the asking that will convert Megastar and Sky commander file formats to scope.exe's data file format.

    For scroll file data layouts, see the webpage on operating the software.


  • In detail, the sequence of events for each bios clock tick (which occurs about 18.2 times a second) is:

  • add equatorial drift to current equatorial position,
    update a status field or work with the optional encoders: either a calculation or a direct write to video memory or reading the encoders or setting current coordinates to encoder coordinates,
    check for keyboard event, if none,
    check for handpad event, if none,
    check for IACA event, if none,
    check for LX200 events and process all accumulated commands since last bios clock tick, but if none,
    check to see if field rotation motor needs pulsing,
    then move to current equatorial coordinates by:
    calculate new altazimuth coordinates based on new sidereal time that was calculated when bios clock tick occurred,
    find difference between current altazimuth coordinates and newly calculated altazimuth coordinates,
    find distances to move in each axis and decide between microstepping or halfstepping, if microstepping,
    then check for backlash, if none,
    then spread microsteps over the bios clock tick by dividing # of microsteps into MsTicksRep, the count of PWM's per bios clock tick: if microsteps exceeds MsTicksRep, then reduce # of microsteps per fullstep up to halfstep,
    continuously generate PWMs, checking for bios clock tick at end of each PWM: a PWM consists of outputting to parallel port an already calculated array of ons and offs to the stepper motors' windings,
    when bios clock tick occurs, PWMs end and new sidereal time is calculated,
    current altazimuth coordinates updated to reflect # of microsteps that actually occurred, current altitude coordinate updated to include refraction,
    current altazimuth coordinates updated to include any backlash compensations already moved,
    current altazimuth coordinates updated to include PEC based on steppers rotors' position,
    current altazimuth coordinates updated to include altazimuth drift,
    current altazimuth coordinates updated to include any guiding motions


    return to top
    continue onto 'Optional Encoders'
    ...by Mel Bartels