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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.