Page 64 of 74 FirstFirst ... 1454606162636465666768 ... LastLast
Results 631 to 640 of 737
  1. #631
    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

    Quote Originally Posted by sgaert View Post
    In the devision you have a resoult with ,xxx that is not possible with int.
    Let is as flot, it is ok.


    Right! But only in case that the differenz is always the same.

    Stefan
    Hi Stefan,

    I have left it as float but is producing the warning. (I will check which line the error is coming from)

    Well the difference won't always be the same, for example when the difference is low numbers, it moves in very small increments as it should, but when the difference starts to get higher, say 70 plus, it moves more and more distance. If I minus, when I have small differences, the needle would probably move the wrong way.

    So I think I need to change the scale, so that the go to numbers are smaller, but 0 = 0 and not a minus figure. Does that make sense.

    So if I used division say divide by 2, it should halve the output, and 0 should still be 0.
    FsbusWriteFmtVar(29,80,ADF1RelNeedlegoto / 2);

    Would that work?

    Thanks
    David


    Sean, I agree with Stefan, change the 8535 and see. I had a dud one that caused me grief too.

  2. #632
    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

    So if I used division say divide by 2, it should halve the output, and 0 should still be 0.
    FsbusWriteFmtVar(29,80,ADF1RelNeedlegoto / 2);

    Would that work?
    No, because you only make the half of steps but the software think it is in the right position. You donīt have a continius readback of the needle Position.

    What do the needle if you fly more than one 360, is there a strange moving?

  3. #633
    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

    If the needle in the software moves 360 degrees, the needle on the gauges will go around 3 or 4 times.

    It does consistently move in the correct direction through.

  4. #634
    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

    If the needle in the software moves 360 degrees, the needle on the gauges will go around 3 or 4 times.
    I would try a direct way for testing with the Stepp and angle problem.

    FsbusWriteFmtVar(29,80,val/(Stepp/360)); //for Stepp your nummber of stepps for a 360 turn.

    Maybe it shows to the opposite direction but it is importent to know the right Stepp/degree ratio.

    Stefan

    EDIT:
    STOP, we both do a big fault. We all the time use the 360 as a Data but that is not true.
    We have to use the max input value that is signed +32768 or unsigned 65536.

    my try of the code:
    Code:
    static int ADF1RelDataIn;
    static int ADF1RelDataSave;
    static int ADF1RelDataDif;
    
    static int ADF1RelNeedlegoto;
    static int ADF1RelNeedleSave;
    static int ADF1RelNeedleDif;
    float ADF1RelNeedleMulti;
    //static int ADF1RelNeedleMulti;
    static int ADF1RelNeedleDeg = 65536;
    //static int ADF1RelNeedleDeg = 360;
    //static int ADF1RelNeedleStep = 2355;
    static int ADF1RelNeedleStep = 1150;
    
    
    case FS_ADF1RELATIVEBEARING:
    				printf("Data in: %d\n",val);
    				ADF1RelNeedleMulti = ADF1RelNeedleDeg/ADF1RelNeedleStep;
    				ADF1RelDataIn = val + 32780;
    				if (ADF1RelDataIn >=0)
    				{
    					ADF1RelDataIn = (ADF1RelDataIn+1);
    				}
    				ADF1RelDataDif = ADF1RelDataIn - ADF1RelDataSave;
    				ADF1RelNeedleDif = ADF1RelDataDif / ADF1RelNeedleMulti;
    				ADF1RelNeedlegoto = ADF1RelNeedleSave + ADF1RelNeedleDif;
    				FsbusWriteFmtVar(29,80,ADF1RelNeedlegoto);
    				printf("Relative Bearing: %d NeedleDif: %d NeedleSave: %d\n",ADF1RelNeedlegoto, ADF1RelNeedleDif, ADF1RelNeedleSave);
    				ADF1RelNeedleSave = ADF1RelNeedlegoto;
    				ADF1RelDataSave = ADF1RelDataIn;
    				//printf("ADF1RelNeedleMulti: %d\n",ADF1RelNeedleMulti);
    				//printf("ADF1RelNeedleDeg: %d\n",ADF1RelNeedleDeg);
    				//printf("ADF1RelNeedleStep: %d\n",ADF1RelNeedleStep);
    				//printf("ADF1RelDataIn: %d\n",ADF1RelDataIn);
    				//printf("ADF1RelDataDif: %d\n",ADF1RelDataDif);
    				//printf("ADF1RelNeedledif: %d\n",ADF1RelNeedlegoto);
    				break;

  5. #635
    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

    I'll give it a try now and let you know.

  6. #636
    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

    Sorry i Edit my Post befor you.

  7. #637
    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

    Getting this error message again: Run-Time Check Failure #2 - Stack around the variable 'buf' was corrupted.

    I have commented out all other lines but the write line just to make sure something else was not causing it.

    I've got the stepp up to 20000 and it is moving more accurately. I know I definately don't have 20,000 steps per 360 degrees

    Oh, it seems the 'buf' error happens when the val is passing through 0 at the 360 position.

  8. #638
    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

    With that?
    FsbusWriteFmtVar(29,80,val/(Stepp/360));

    or my Edit?

  9. #639
    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

    Quote Originally Posted by sgaert View Post
    With that?
    FsbusWriteFmtVar(29,80,val/(Stepp/360));

    or my Edit?
    With this. I have the Stepp at 20,000 and the needle is moving in the right direction, and also fairly accurately with the screen gauge. The buf error message occurs when the value is passing through 0 at the top of the gauge (goes straight to error message once the needle moves to the left side as they are all negative numbers) and passing the maximum at the bottom (which is then moving into the maximum negative number)

    Does that make sense?

  10. #640
    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

    Donīt use the 360 degrees anymore that is wrong, look to my edit ther is a new code.

  11. Thanks RobiD thanked for this post

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