Page 60 of 74 FirstFirst ... 105056575859606162636470 ... LastLast
Results 591 to 600 of 737
  1. #591
    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

    Just another point, in the DOS box when FsBus is running, it now displays the following:

    FSBUS.DLL (take out the version number)
    www.fsbus.de

    FS objects ......... 62
    enabled .................... 62
    disabled ................... 0
    polling .................... lazy:0, normal:55, quick:4
    FSBUS objects ...... 128
    enabled .................... 128
    disabled ................... 0
    button,switch .............. 47
    rotary ..................... 13
    analog in .................. 0
    led, digital out ........... 35
    7 segment display .......... 18
    servo, analog out .......... 15
    stepper .................... 0
    Timer objects ...... 0
    Sound objects ...... 0

    running ...Altimeter Feet 5
    press any key to exit ...


    It now shows what is connected. Is this information gathered from the code? If so, it doesn't seem to recognise that I have 3 steppers attached.

    Also, just to be sure the steppers were working, I redid the little motor test code, and it all worked fine.

    David

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

    Here's just another bit of info that may help.

    I did some experimenting with printf.

    If I put a basic line like: printf("whiskeycompass"); in any other .cpp file, it displays it in the dos box, when I put it into the Stepper gauges .cpp file, it does not show it in the dos box. (hope that makes sense). It is almost like the steppergauges.cpp file is not being included in the project.

    Does that help any?

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

    Wrong!
    void cbSteppergauges(int oid, int val, double dval);

    Right!!!
    void cbSteppergauges(int oid, int val, double dval)

    With the ";" you close the function.

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

    Hmmm, I've had some success.

    I've taken the code out of the steppergauges.cpp files and put it into gauges.cpp (which I know works, and the printf works)

    So this is the code I have so far in this file:

    case FS_ALTIMETERFEET:
    val=val/5; // 1000feet for 360° are 200 steps (1000/200)
    printf("Altimeter Feet %d\n", val);
    FsbusWriteFmtVar(8, 80,val);
    break;

    case FS_ADF1DIALBEARING:
    x=0.625;(I have 576 steps to 360 degrees, which means for each degree it's 0.6 of a step)
    val=val/x; (When I do it like this, I have a compiling warning, so obviously this is wrong)
    FsbusWriteFmtVar(30,80,val);
    printf("ADF Dial Bearing %d/n",val);
    break;

    So now I'm getting data with the printf.
    The stepper for the Altitude does not correlate with the altimeter on the screen, and it's randomly moving forwards and backwards. When it zeros itself on start up, the stepper is smooth and accurate to the zero. Any thoughts?

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

    yes analyse the data and build a calibration.

    Edit:
    case FS_ADF1DIALBEARING:
    Work like the same code that i send if my code workes.

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

    Some feedback from the code you put together for me:

    case FS_ADF1RELATIVEBEARING:
    ADF1RelNeedleMulti = ADF1RelNeedleDeg / ADF1RelNeedleStep;
    ADF1RelDataIn = val + 179;
    if (ADF1RelDataIn >=0)
    {
    ADF1RelDataIn = (ADF1RelDataIn+1);
    }
    ADF1RelDataDif = ADF1RelDataIn - ADF1RelDataSave;
    ADF1RelNeedleDif = ADF1RelDataDif / ADF1RelNeedleMulti;
    ADF1RelNeedlegoto = ADF1RelNeedleSave + ADF1RelNeedleDif;
    FsbusWriteFmtVar(29,80,ADF1RelNeedlegoto);
    printf("Relative Bearing %d/n",ADF1RelNeedlegoto);
    ADF1RelNeedleSave = ADF1RelNeedlegoto;
    ADF1RelDataSave = ADF1RelDataIn;
    break;

    I am getting an error: > Davids Flight sim.exe!cbGauges(int oid=510, int val=6140, double dval=0.00000000000000000) Line 209 + 0x6 bytes C++
    Line 209 is: ADF1RelNeedleDif = ADF1RelDataDif / ADF1RelNeedleMulti;

    I am getting data in, here is the datum:

    ADF1RelDataDif 6320 int
    ADF1RelDataIn 6320 int
    ADF1RelDataSave 0 int
    ADF1RelNeedleDif 0 int
    ADF1RelNeedleMulti 0 int

    Unhandled exception at 0x0041282d in Davids Flight sim.exe: 0xC0000094: Integer division by zero.

    Next question is how do I use the calibrate function in this situation using steppers?

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

    Integer division by zero.
    Yes, that is stupid.

    you said that the data range is -179 to 179 but the read value is 6140 or 6320.
    Please find the right data range in fsuipc.
    Code:
    case FS_ADF1RELATIVEBEARING:
    printf("Data in: %d/n",val);
    break;
    Than we can start to fix the code.

    Next question is how do I use the calibrate function in this situation using steppers?
    like servos, Analog In or Out.
    But not at looping situations, like Compas, RMI,.....

    Stefan

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

    It's giving a different range using the printf than in FSInterrogate.

    at 12 o'clock = 0
    at 3 o'clock = 16400
    at 6 o'clock =-32780 or 32780
    at 9 o'clock = -16400

    As for the calibrate function, all these gauges are looping types.

    The ADF compass rose face is producing this data with the printf:
    North 360/0
    E 90
    S 180
    W 270

    So 360 degrees and I have 576 steps for this one too.

  9. #599
    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 code like that to stop the division by Zero.

    Code:
    case FS_ADF1RELATIVEBEARING:
    		ADF1RelNeedleMulti = (1000 * ADF1RelNeedleDeg) / ADF1RelNeedleStep;
    		ADF1RelDataIn = val + 32780;
    		// if (ADF1RelDataIn >=0)
    		// {
    			// ADF1RelDataIn = (ADF1RelDataIn+1);
    		// }
    		ADF1RelDataDif = ADF1RelDataIn - ADF1RelDataSave;
    		ADF1RelNeedleDif = (ADF1RelDataDif * 1000) / ADF1RelNeedleMulti;
    		ADF1RelNeedlegoto = ADF1RelNeedleSave + ADF1RelNeedleDif;
    		FsbusWriteFmtVar(29,80,ADF1RelNeedlegoto/1000);
    		ADF1RelNeedleSave = ADF1RelNeedlegoto;
    		ADF1RelDataSave = ADF1RelDataIn;
    		break;

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

    Implemented the changed code and the printf produces '26' regardless of the needle position.

    Odd!

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