Results 671 to 680 of 737
Thread: Progamming help with FSBus dll
-
02-15-2011, 09:36 AM #671
- Join Date
- Feb 2008
- Location
- Krefeld, Germany
- Posts
- 318
Re: Progamming help with FSBus dll
try that!!! Completly new Idea from a friend and me.
Code:static int ADF1RelDataIn; static int ADF1RelDataSave; static int ADF1RelDataDif; static int ADF1RelNeedlegoto; static int ADF1RelNeedleSave; static int ADF1RelNeedleDif; static int ADF1RelNeedleDeg = 65536; float ADF1RelNeedleMulti; static int ADF1RelNeedleStep = 1150; case FS_ADF1RELATIVEBEARING: printf("Data in: %d\n",val); ADF1RelNeedleMulti = ADF1RelNeedleDeg/ADF1RelNeedleStep; if (ADF1RelDataSave < ADF1RelDataIn) { ADF1RelDataDif = ADF1RelDataIn - ADF1RelDataSave; if (ADF1RelDataDif > ADF1RelNeedleDeg/2) ADF1RelDataDif = ADF1RelDataDif - ADF1RelNeedleDeg; } else { ADF1RelDataDif = (ADF1RelDataSave - ADF1RelDataIn) * -1; if (ADF1RelDataDif > ADF1RelNeedleDeg/2) ADF1RelDataDif = ADF1RelNeedleDeg - ADF1RelDataDif; } ADF1RelNeedleDif = ADF1RelDataDif / ADF1RelNeedleMulti; ADF1RelNeedlegoto = ADF1RelNeedleSave + ADF1RelNeedleDif; FsbusWriteFmtVar(29,80,ADF1RelNeedlegoto); ADF1RelNeedleSave = ADF1RelNeedlegoto; ADF1RelDataSave = ADF1RelDataIn; break;
-
02-15-2011, 05:44 PM #672
Re: Progamming help with FSBus dll
Fantastic Stefan, I will give it a try this evening when I get home from work.
Thanks
David
-
02-18-2011, 12:05 AM #673
Re: Progamming help with FSBus dll
Hi Stefan,
I have had a chance to try the new code, I am getting no needle movement at all.
Using the printf function, the Data In is reading exactly the same the the ADF1RelNeedlegoto.
So the data is going from -32 odd thousand to + 32 od thousand.
Here's a copy and paste:
running ...Data in: -32366
ADF1RelNeedlegoto: -32366
ADF1RelNeedleDif: -32366
press any key to exit ...
Any thoughts?
Thanks
David
Oh, I'm also getting this error message:
warning C4244: '=' : conversion from 'int' to 'float',
for these lines:
ADF1RelNeedleMulti = ADF1RelNeedleDeg/ADF1RelNeedleStep;
ADF1RelNeedleDif = ADF1RelDataDif / ADF1RelNeedleMulti;
-
02-18-2011, 02:36 AM #674
- Join Date
- Feb 2008
- Location
- Krefeld, Germany
- Posts
- 318
Re: Progamming help with FSBus dll
Oh, I'm also getting this error message:
warning C4244: '=' : conversion from 'int' to 'float',
for these lines:
ADF1RelNeedleMulti = ADF1RelNeedleDeg/ADF1RelNeedleStep;
ADF1RelNeedleDif = ADF1RelDataDif / ADF1RelNeedleMulti;
But look to a tutorial about Type Casting / Explicit conversion.
running ...Data in: -32366
ADF1RelNeedlegoto: -32366
ADF1RelNeedleDif: -32366
press any key to exit ...
Did you fly the aircraft and how run the needle?
Stefan
-
02-18-2011, 03:04 AM #675
Re: Progamming help with FSBus dll
Sorry, I did mean warning.
Here is the code copied and pasted :
Code:static int ADF1RelDataIn; static int ADF1RelDataSave; static int ADF1RelDataDif; static int ADF1RelNeedlegoto; static int ADF1RelNeedleSave; static int ADF1RelNeedleDif; static int ADF1RelNeedleDeg = 65536; float ADF1RelNeedleMulti; //static int ADF1RelNeedleStep = 1150; static int ADF1RelNeedleStep = 1400; case FS_ADF1RELATIVEBEARING: printf("Data in: %d\n",val); ADF1RelNeedleMulti = ADF1RelNeedleDeg/ADF1RelNeedleStep; if (ADF1RelDataSave < ADF1RelDataIn) { ADF1RelDataDif = ADF1RelDataIn - ADF1RelDataSave; if (ADF1RelDataDif > ADF1RelNeedleDeg/2) ADF1RelDataDif = ADF1RelDataDif - ADF1RelNeedleDeg; } else { ADF1RelDataDif = (ADF1RelDataSave - ADF1RelDataIn) * -1; if (ADF1RelDataDif > ADF1RelNeedleDeg/2) ADF1RelDataDif = ADF1RelNeedleDeg - ADF1RelDataDif; } ADF1RelNeedleDif = ADF1RelDataDif / ADF1RelNeedleMulti; ADF1RelNeedlegoto = ADF1RelNeedleSave + ADF1RelNeedleDif; FsbusWriteFmtVar(29,80,ADF1RelNeedlegoto); printf("ADF1RelNeedlegoto: %d\n",val); ADF1RelNeedleSave = ADF1RelNeedlegoto; ADF1RelDataSave = ADF1RelDataIn; printf("ADF1RelNeedleDif: %d\n",val); break;
-
02-18-2011, 03:10 AM #676
- Join Date
- Feb 2008
- Location
- Krefeld, Germany
- Posts
- 318
Re: Progamming help with FSBus dll
OMG!!!!
First how turn the needle if you fly?
Second learn the printf function thet is wrong what you do.
-
02-18-2011, 03:15 AM #677
Re: Progamming help with FSBus dll
Needle does not move at all.
Opps, I see the error of my ways
Have corrected printf function and I'll try it again and report back.
David
-
02-18-2011, 03:21 AM #678
Re: Progamming help with FSBus dll
Ok, these are the outputs:
Data in: -10972
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -10903
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -10844
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -10906
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -10868
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -10834
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -10950
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -10956
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Just so I'm accurate, this is how I have the printf:
printf("ADF1RelNeedlegoto: %d\n",ADF1RelNeedlegoto);
-
02-18-2011, 03:27 AM #679
- Join Date
- Feb 2008
- Location
- Krefeld, Germany
- Posts
- 318
Re: Progamming help with FSBus dll
Ok.
Fly for a positive Data in val.
and gereate a printf for ADF1RelDataDif.
-
02-18-2011, 03:54 AM #680
- Join Date
- Feb 2008
- Location
- Krefeld, Germany
- Posts
- 318
Re: Progamming help with FSBus dll
Next try.
Code:static int ADF1RelDataIn; static int ADF1RelDataSave; static int ADF1RelDataDif; static int ADF1RelNeedlegoto; static int ADF1RelNeedleSave; static int ADF1RelNeedleDif; static int ADF1RelNeedleDeg = 65536; float ADF1RelNeedleMulti; //static int ADF1RelNeedleStep = 1150; static int ADF1RelNeedleStep = 1400; case FS_ADF1RELATIVEBEARING: printf("Data in: %d\n",val); ADF1RelNeedleMulti = ADF1RelNeedleDeg/ADF1RelNeedleStep; ADF1RelDataDif = ADF1RelDataIn - ADF1RelDataSave; if ( ADF1RelDataDif > ADF1RelNeedleDeg/2) ADF1RelDataDif = ADF1RelNeedleDeg-ADF1RelDataDif; else if (ADF1RelDataDif < (ADF1RelNeedleDeg/2 * -1)) ADF1RelDataDif = ADF1RelNeedleDeg+ADF1RelDataDif; printf("ADF1RelDataDif: %d\n",ADF1RelDataDif); ADF1RelNeedleDif = ADF1RelDataDif / ADF1RelNeedleMulti; ADF1RelNeedlegoto = ADF1RelNeedleSave + ADF1RelNeedleDif; FsbusWriteFmtVar(29,80,ADF1RelNeedlegoto); printf("ADF1RelNeedlegoto: %d\n",ADF1RelNeedlegoto); ADF1RelNeedleSave = ADF1RelNeedlegoto; ADF1RelDataSave = ADF1RelDataIn; printf("ADF1RelNeedleDif: %d\n",ADF1RelNeedleDif); break;
Similar Threads
-
Fsbus CDK
By flyandre in forum General Builder Questions All Aircraft TypesReplies: 4Last Post: 12-27-2014, 12:58 PM -
Need Help Getting My FSBUS NG I/O Going Again..
By JBRoberts in forum I/O Interfacing Hardware and SoftwareReplies: 14Last Post: 03-21-2010, 01:38 PM -
Fsbus ng io
By Davral in forum I/O Interfacing Hardware and SoftwareReplies: 0Last Post: 01-10-2009, 10:38 PM -
Fsbus 2.4.3
By Anderson/SBSP in forum I/O Interfacing Hardware and SoftwareReplies: 9Last Post: 11-30-2008, 04:25 PM -
Help FSBUS
By cesarfsim in forum I/O Interfacing Hardware and SoftwareReplies: 2Last Post: 10-26-2008, 02:23 PM
Search Prettys Womans from your city for night
5.Sharing an Essay about PIC16F877