Jump to content
The simFlight Network Forums

Trying to get heading as a 4 digit number


Recommended Posts

Hi,

 

I have converted a real RMI to use stepper motors and it is run through SIOC.

 

It all works correctly, I use the *360/(65536*65536) equation on offset $0580 i get a 3 digit heading from -180 to +180 as I should.

 

This means my stepper motors move every degree, but during slow turns this looks quite jerky.

 

What I want is for the heading to be a 4 digit number, such as 263 & 1/2 degrees would read 2635.

 

 

How should the equation look if i want it to read -1800 to +1800?

 

 

This will give me 10x the resolution and make the movement smoother

 

The Stepper motor card uses a value of 0 to 36000 for the position of the motor.  My motors have 2048 steps for a full circle.

 

Cheers.

Link to comment
Share on other sites

It all works correctly, I use the *360/(65536*65536) equation on offset $0580 i get a 3 digit heading from -180 to +180 as I should.

 

This means my stepper motors move every degree, but during slow turns this looks quite jerky.

 

What I want is for the heading to be a 4 digit number, such as 263 & 1/2 degrees would read 2635.

 

How should the equation look if i want it to read -1800 to +1800?

 

The Stepper motor card uses a value of 0 to 36000 for the position of the motor.  My motors have 2048 steps for a full circle.

 

Basic arithmetic. The heading provided by the offset you are reading is in units of 4,294,967,296ths of a full circle. That number is more easily remembered as 65536 x 65536. Nothing magic about that. You convert to whatever units you want. Obviously your should have units of 36,000ths of a circle, so you need to do the computation as

 

(unsigned value from offset)*36000/(65536 * 65536)

 

By using unsigned you get 0-35999. Do the computation in floating point then take the integer part of the result.

 

Then you can use the value directly.

 

Pete

Link to comment
Share on other sites

Cheers Pete.

 

I had tried that earlier, but was getting strange heading readings.

I have since realized that i needed to do the same change of calculation for the Magnetic variation.

 

ii have now fixed that, and also both the VOR and ADF relative bearings, and it all works beautifully.

 

Thanks mate

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.