Page 68 of 74 FirstFirst ... 1858646566676869707172 ... LastLast
Results 671 to 680 of 737
  1. #671
    300+ Forum Addict
    Join Date
    Feb 2008
    Location
    Krefeld, Germany
    Posts
    318
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    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;

  2. #672
    300+ Forum Addict RobiD's Avatar
    Join Date
    Sep 2007
    Location
    Gold Coast, Australia
    Posts
    430
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Progamming help with FSBus dll

    Fantastic Stefan, I will give it a try this evening when I get home from work.

    Thanks
    David

  3. #673
    300+ Forum Addict RobiD's Avatar
    Join Date
    Sep 2007
    Location
    Gold Coast, Australia
    Posts
    430
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    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;

  4. #674
    300+ Forum Addict
    Join Date
    Feb 2008
    Location
    Krefeld, Germany
    Posts
    318
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    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;
    That is not an error only warning, for me at the moment it isnīt interessting.
    But look to a tutorial about Type Casting / Explicit conversion.

    running ...Data in: -32366
    ADF1RelNeedlegoto: -32366
    ADF1RelNeedleDif: -32366
    press any key to exit ...
    That is not possible, show your print funktions.

    Did you fly the aircraft and how run the needle?

    Stefan

  5. #675
    300+ Forum Addict RobiD's Avatar
    Join Date
    Sep 2007
    Location
    Gold Coast, Australia
    Posts
    430
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    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;

  6. #676
    300+ Forum Addict
    Join Date
    Feb 2008
    Location
    Krefeld, Germany
    Posts
    318
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    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.

  7. #677
    300+ Forum Addict RobiD's Avatar
    Join Date
    Sep 2007
    Location
    Gold Coast, Australia
    Posts
    430
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    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

  8. #678
    300+ Forum Addict RobiD's Avatar
    Join Date
    Sep 2007
    Location
    Gold Coast, Australia
    Posts
    430
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    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);

  9. #679
    300+ Forum Addict
    Join Date
    Feb 2008
    Location
    Krefeld, Germany
    Posts
    318
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Progamming help with FSBus dll

    Ok.
    Fly for a positive Data in val.
    and gereate a printf for ADF1RelDataDif.

  10. #680
    300+ Forum Addict
    Join Date
    Feb 2008
    Location
    Krefeld, Germany
    Posts
    318
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    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;
    please fly 1x 360 left and 1x 360 right and report the datalog.

Similar Threads

  1. Fsbus CDK
    By flyandre in forum General Builder Questions All Aircraft Types
    Replies: 4
    Last Post: 12-27-2014, 12:58 PM
  2. Need Help Getting My FSBUS NG I/O Going Again..
    By JBRoberts in forum I/O Interfacing Hardware and Software
    Replies: 14
    Last Post: 03-21-2010, 01:38 PM
  3. Fsbus ng io
    By Davral in forum I/O Interfacing Hardware and Software
    Replies: 0
    Last Post: 01-10-2009, 10:38 PM
  4. Fsbus 2.4.3
    By Anderson/SBSP in forum I/O Interfacing Hardware and Software
    Replies: 9
    Last Post: 11-30-2008, 04:25 PM
  5. Help FSBUS
    By cesarfsim in forum I/O Interfacing Hardware and Software
    Replies: 2
    Last Post: 10-26-2008, 02:23 PM

Tags for this Thread