Sections

venerdì 24 dicembre 2010

Altimeter

I finally managed to have the altimeter WORKING!!!
The job has been done by replacing the existing resolvers with 2 pots: one for the altitude and one for the QNH.
The problem by interfacing it with the OC card is the crap resolution of the A/D...only 8 bits....that means 256 steps. It could be ok for gauges like VSi or ASI but the altimeter? it has a rotating drum which goes from - 1000 to + 50000 feet. that means that if we can manage this excursion for the whole rotation of the pot we have the ridiculous resolution of 51000 / 256, so 200 feet for each step!!!! it's simply not usable for an altimeter...plus think that the mechanical rotation of stock gearing makes the 51000 feet excursion in less than half turn of the pot so the precision halves to 400 ft or more!!! it's just CRAAAAAAAAP!!!!

So...how to over this problem? We need an higher resolution A/D converter if we want to preceed with the DC motor way.

There are no cards around for motor driving with an easy interface for FS which have a resolution higher that 10 bits, and I'm not so expert to build one and make a code for it. So?
The solution comes frrom the Leo Bodnar's joystick card. It has 12 bit resolution A/D which means 4096 steps per revolution. Counting half revolution with stock gearing we still have around 2000 steps for our scale which means a resolution of bit more than 20ft!!! Now THIS is acceptable resolution!!!
But now the question: how do we do that?
FSUIPC is the answer!
After connection the pot to the joystick card, we go into the FSUIPC Axis assignement menu and we assign the altimeter drum axis to an external free offset (Starting with $66C0) as a dWord setting DELTA value to 1
Same is for the QNH which we'll assign to another offset. But with a Delta higher as 32.
The Offsets comes out with a reading of 15bits from -16364 to + 16383,  but we only want to read it as a normal 12 bit axis. We manage to do that in the FSUIPC4.INI file where the assignements has just been done. (Thanks to my friend Gery for his help!)
Under the " [AXES] " section look for the 2 axis you recently added. you should have 2 lines like those:
1=1X,4,F,x030066C0,0,0,0
2=1Y,32,F,x030066C4,0,0,0
Now we want to use only the positive range and divide it by 4 to limit the reading from 0 to 4096.
We do that by halving the readout value, dividing the result by 4 and adding 2048 to stay in positive range.
This is how lines should look with this adjustement
1=1X,4,F,x030066C0,0,0,0,*0.125,+2048
2=1Y,32,F,x030066C4,0,0,0,*0.125,+2048

Now just read the offset in SIOC and use the value as reference pot. (the offset length is 4)

You will find the complete code at top of the page in SIOC CODE section along with rest of cockpit.