Results 1 to 8 of 8
  1. #1
    10+ Posting Member
    Join Date
    Jul 2009
    Location
    Australia
    Posts
    19
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    A Question for Mike Powell

    Hi Mike,
    I am having trouble with understanding your op command summary for the gyro compass, it may be I don't know enough about the subject. Am I on the right track when I am thinking that for command Set Motor Position for example, Bytes [0:4] are the unique identifier for this instrument,(can be 4 bytes made up of any sequence of 1 and 0?), now byte 5 is set to 1 is that 00000001? and bytes [6:7] is motor position.
    Now I am having trouble sorting out what exactly I should program for motor position, eg: what is forward and what is reverse, what is take 10 steps forward etc. Could you please lend me a little hand as this is got my poor brain boggling at the moment as I am not too flash with assembler, I only used it once whilst attending uni

    Cheers,
    Dave...

  2. #2
    300+ Forum Addict



    Join Date
    Feb 2007
    Location
    California, USA
    Posts
    380
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: A Question for Mike Powell

    Hi Dave,

    The forward, backward, and take a step stuff is all hidden in the firmware. The set motor position need only be loaded with the position where you want the motor to end up.

    The project is designed with a 400 step per revolution motor in mind. It is half-stepped to give 800 discreet positions which are referred to as positions 0 to 799. When powered on or reset, the firmware rotates the motor until the flag on the motor shaft goes through the gap in the optical interrupter. This is position 0.

    For simplicity, let's assume you have the DG compass card set such that North is aligned with position 0.

    If you wanted the compass card to rotate to the 90 degree position, you would send a set motor position command with a value of 200. One of the micro controller timers periodically wakes up the firmware to watch over the motor. Firmware compares the current motor position (0) with the desired motor position (200), determines the shorter direction to turn the motor, takes a single half-step, and changes the current motor position variable to "1". The next time the timer wakes up the firmware, it will move the motor to position 2, and so on until it reaches position 200.

    Had you wanted to rotate the compass card to the 270 degree position, you would have sent a position value of 600, and the firmware would have moved the motor from position 0 to position 799, choosing to rotate the opposite direction.

    The format of the command string is as you have presented it:

    Bytes 0 to 4 are the instrument identifier. They can be any string of 1s and 0s. However, I typically use five ascii characters because it's easier to remember. I believe "ZZZ99" and "DG001" are both used in the project.

    Byte 5 is the command byte. The set motor position command is the numeric value 1 which in binary is "00000001"

    Bytes 6 and 7 contain the desired motor position. Because there are 800 positions, we need 10 bits. Since a byte only has 8 bits, we need 2 bytes.

  3. #3
    10+ Posting Member
    Join Date
    Jul 2009
    Location
    Australia
    Posts
    19
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: A Question for Mike Powell

    Mike,
    That clears up my confusion completley, I wrote out the contents of several calls to the gauge this morning using binary representation. It all makes sense , thanks for the clarification, much appreciated.

    Cheers,
    Dave...

  4. #4
    25+ Posting Member
    Join Date
    Nov 2007
    Location
    Mobile, AL
    Posts
    48
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: A Question for Mike Powell

    Mike,
    Thanks for the clear explaination. While I understand the choice of turning the stepper motor the shortest direction. What happens in the case that the airplane was actually turning in the "other" direction? couldn't there ba a condition when the compass went in the wrong direction without some notion of where we were at the last position and which way the aircraft is turning? I suppose, however, that in all actuality that the rate that data was being sent to the instrument would make the new heading values very small anyway.

    William, Tripacer Builder

  5. #5
    300+ Forum Addict



    Join Date
    Feb 2007
    Location
    California, USA
    Posts
    380
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: A Question for Mike Powell

    William,

    You might have a condition in which the desired heading is changing faster than the motor can respond. Given the speed of the motor and typical flight parameters, I think this would most likely be an error condition in the simulator. Nonetheless, the firmware reacts on an interrupt by interrupt basis, and would not get confused. It just keeps trying to move the motor position into alignment with the incoming data.

  6. #6
    10+ Posting Member
    Join Date
    Jul 2009
    Location
    Australia
    Posts
    19
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Post Re: A Question for Mike Powell

    G'day Mike,
    I am having a little trouble working out how to adjust the MAXPOS variable in the INITIALIZE routine for different steppers in the Gyro Compass project. Could you please explain to me how this is achieved in a little more detail?
    The problem being is that I can only get a 1.8 deg/step motor for a reasonable price. This would then turn out to be 400 steps half stepped which will give me roughly 0.9 steps per degree which I am hoping will be enough resolution, considering the compass rose has minimum markings of 5 degrees.

    Cheers,
    Dave...

  7. #7
    300+ Forum Addict



    Join Date
    Feb 2007
    Location
    California, USA
    Posts
    380
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: A Question for Mike Powell

    Hi Dave,

    The PIC assembler treats "MAXPOS" as a byte address. "MAXPOS+1" is the address of the next byte. Since the 400 position stepping motor has 800 half-stepped positions, two bytes are required to hold the value of the maximum position which is 799. (Positions range from 0 to 799.) MAXPOS+1 is the high byte, so if MAXPOS+1 is 3 and MAXPOS is 31, the value of the maximum position is 3*256 + 31 = 799. Similarly, HALFWAY+1 is 1 and HALFWAY is 144, and 1*256 + 144 = 400.

    Converting to a 200 step per rev motor means changing to a range of 0 to 399, and a half way position of 200. MAXPOS+1 becomes 1; MAXPOS becomes 143 (1*256 + 143 = 399). HALFWAY+1 becomes 0; HALFWAY becomes 200.

  8. #8
    10+ Posting Member
    Join Date
    Jul 2009
    Location
    Australia
    Posts
    19
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Post Re: A Question for Mike Powell

    Thanks Mike,
    I wondered why I couldn't make head nor tail of it! Since your post I have found the 16 bit variable declaration in the Predko. This helped heaps, especially making the watch window reference MaxPos and HalfWay as a 16 bit variable and not a 8 bit variable Your explanation helped make it gel quite well
    Thanks heaps for your patience,
    Dave...

Similar Threads

  1. Mike Powell VOR/GS CDI schematic QUERY
    By BeechBonanza in forum General Aviation (GA) Builder Disccusion
    Replies: 1
    Last Post: 07-08-2010, 12:28 AM
  2. 727 question for Mike
    By Jackpilot in forum General Builder Questions All Aircraft Types
    Replies: 4
    Last Post: 11-22-2008, 02:36 PM

Tags for this Thread