Page 58 of 74 FirstFirst ... 84854555657585960616268 ... LastLast
Results 571 to 580 of 737
  1. #571
    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

    Did you write a small programm to test your steppers wih the stepper board?

    Here my programm:
    Code:
    #include "stdafx.h"
    #include "fsbus.h"
    
    int _tmain(int argc, _TCHAR* argv[])
    {
    CheckIn();
    BOOL b = FsbusOpen("COM3");
    FsbusWriteFmtVar(29, 80, 0);
    FsbusMux(2000);
    FsbusWriteFmtVar(29, 80, 2000);
    FsbusMux(2000);
    FsbusWriteFmtVar(29, 80, 0);
    FsbusMux(2000);
    CheckOut();
    return 0;
    }

  2. #572
    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 tested the stepper boards when Dirk sent through some sample code some time ago (He used v1 of the dll to test it though, I think you pointed that out).
    So, I know the boards work.
    This was what I used (pretty well just minor changes to your code)
    Code:
    #include "stdafx.h"
    
    
    int _tmain(int argc, _TCHAR* argv[])
    {
        CheckIn();
        BOOL b = FsbusOpen("COM1");
        FsbusWriteFmtVar(29, 80, 0);
        FsbusMux(2000);
        FsbusWriteFmtVar(29, 80, 100);
        FsbusMux(2000);
        FsbusWriteFmtVar(29, 80, 0);
        FsbusMux(2000);
        CheckOut();
        return 0;
    }
    So, how am I doing with the code I've written so far for the ADF.

    I am getting 1 compiling error though: steppergauges.cpp(22) : error C2447: '{' : missing function header (old-style formal list?)

    This is the code exactly to this minute that is producing the error:

    Code:
    #include "stdafx.h"
    #include "fsbus.h"
    
    void cbSteppergauges(int oid, int val, double dval);
    #define FS_ADF1RELATIVEBEARING 1
    #define FS_ADF1DIALBEARING 2
    //#define C_ADFCOMPASSCARD 3
    //#define C_ADFBEARINGNEEDLE 4
    #define C_RADFROSEADJUST 5
    
    static int ADFroseadjust = 0;
    
    void cbSteppergaugesBuildObjects()
    {
    	MkFsObject(FS_ADF1RELATIVEBEARING,"ADF Needle",  cbSteppergauges,  0x0C6A, 2, TP_I16,  FS_NORMAL,0);
    	MkFsObject(FS_ADF1DIALBEARING,"ADF Compass Card",  cbSteppergauges,  0x0C6C, 2, TP_I16,  FS_NORMAL,0);
    	//MkFsbusObject(BTP_V_OUT, C_ADFCOMPASSCARD,"",NULL,30,80,0);
    	//MkFsbusObject(BTP_V_OUT, C_ADFBEARINGNEEDLE,"",NULL,29,80,0);
    	MkFsbusObject(BTP_ROTARY, C_RADFROSEADJUST,	"",cbModecontrolpanel, 27, 26, 0);
    }
    void cbSteppergauges(int oid, int val, double dval);
    {
    	int x;
    	switch(oid)
    	{
    	case FS_ADF1RELATIVEBEARING:
    		FsbusWriteFmtVar(29,80,val);
    		break;
    
    	case FS_ADF1DIALBEARING:
    		FsbusWriteFmtVar(30,80,val);
    		break;
    
    	case C_RADFROSEADJUST:
    		ADFroseadjust -= val;
    		while (ADFroseadjust > 360)
    			ADFroseadjust -= 360;
    		while (ADFroseadjust <=0)
    			ADFroseadjust += 360;
    		x = (ADFroseadjust % 360);
    		FsWriteInt(FS_ADF1DIALBEARING,x);
    		break;
    	}
    }
    Once I get it to compile, should I just test it with the gauge and see what happens?

    David

  3. #573
    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 test with the V3 dll. that works in my sample.

    Edit: donīt!!!
    void cbSteppergauges(int oid, int val, double dval);

    has to be
    void cbSteppergauges(int oid, int val, double dval)

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

    Great, compiles now.

    So looking back at some code you worked with me on for my Altitude gauge, I can see how 'val' is worked out.
    Code:
    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;
    So for the 'val' in the ADF code, I need to work out the number of steps to 360 deg, and divide the value by that as in the sample above. Am I correct?

    Thanks

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

    sounds perfect. if you have a gear dont forget it.
    A 200step neadle on a 360° scale donīt perfect.

  6. #576
    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 do have gears so I will work it out.

    I am trying to print the value of the ADF needle and the ADF rose face, and I don't seem to be getting anything.

    Here's what I have (I have the same for the altitude and it prints it fine):

    case FS_ADF1RELATIVEBEARING:
    val=val/1; // 360° are ? steps
    printf("ADF relative bearing %d\n", val);
    FsbusWriteFmtVar(29,80,val);
    break;

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

    I am trying to print the value of the ADF needle and the ADF rose face, and I don't seem to be getting anything.
    if i understand that right, you whant to have a output like:
    Input value: 12345 Needle Position: 67890

    right??

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

    Well, it's not really important to have as I can get these figures from FSInterrogate. I was just wondering why it isn't printing any value at all when I move the needle or the dial face.

    Also, the ADF Dial heading works on a simple 0 - 360, but the Needle works on -179.9 to 0 to 179.9 0 being at the top, -179 being to the left and +179 to the right. Will I need to write the needle differently?

  9. #579
    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, but i woudl try somethink like

    case that with the -179 to 179:
    val = val + 179;
    than you have your 0 in the -179 positon.
    but!!

    if (val >=0)
    {
    val = ( val+1);
    }

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

    Ah ha, then I can use the 360degress divided by how many steps the motor has in 360deg. I would never have thought of that.

    Thank you.

    So now I have:

    case FS_ADF1RELATIVEBEARING:
    val = val + 179;
    if (val >=0)
    {
    val = (val+1);
    }
    printf("ADF relative bearing %d\n", val);
    FsbusWriteFmtVar(29,80,val);
    break;

    Any idea why it's still not showing anything is the DOS box for the print function?

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