Page 29 of 74 FirstFirst ... 1925262728293031323339 ... LastLast
Results 281 to 290 of 737
  1. #281
    150+ Forum Groupie


    388TH_A's Avatar
    Join Date
    Nov 2008
    Location
    Medford, Oregon (USA)
    Posts
    239
    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

    Thanks ill have to try that and if im understanding look at posts #136 and #137 and change it some over to the COM and NAV swap buttons?

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

    The post you mean are only ADF and XPNDR.
    I can write you a code sample from my cockpit, but that dont base on the FS Swap offset.
    Code:
    	case C_COM1Trans:
    			FsWrite (FS_COM1FREQUENCY, COM1S);
    			FsWrite (FS_COM1STANDBY, COM1);
    			FsbusWrite (C_COM1DisplayS, BCD2Int(COM1)+10000);
    			FsbusWrite (C_COM1DisplayA, comstby+10000);
    			x1 = COM1;
    			x2 = COM1S;
    			COM1 = x2;
    			COM1S = x1;
    		
    		break;

  3. #283
    150+ Forum Groupie


    388TH_A's Avatar
    Join Date
    Nov 2008
    Location
    Medford, Oregon (USA)
    Posts
    239
    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

    Sure that would be great and i have the code for all the COM1 + COM1 stby and so on just dont have the Swap button in there. Was thinking of trying to put it all into C++ before i get my IO pcbs in the mail but almost think i should wait for them so i can learn and teach my self on how the IO board works. then that way i can also play with the code and the switch at the same time.

  4. #284
    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 Trevor,

    It is definately better to have the boards wired up and ready to test your code, otherwise you won't know if it is working properly. Having the boards also lets you problem solve any issues.

    Here is the code that I am grateful to Stefan's help with (this is a working code that I am using for my cockpit so it should work fine for you):
    (If you are still having trouble working it out, let me know and I'll post the entire radios .cpp file for you)
    Don't forget to define the int at the top:
    David

    static int nav1mode=0;

    Code:
    /*----------------------- NAV1 Events ---------------------*/
    
    		case FS_NAV1FREQUENCY:
    				Nav1Fr = 10000 + BCD2Int(val);
    				FsbusWrite(C_DNAV1, Nav1Fr);
    			break;
    		case FS_NAV1STANDBY:
    				Nav1FrStb = 10000 + BCD2Int(val);
    				FsbusWrite(C_DNAV1STB, Nav1FrStb);
    			break;
    
    			case C_NAV1Push:
                                  if(val==0)
                                  {
    		nav1mode+=1;
    		if (nav1mode>1)
    			nav1mode=0;
                                  }
    			break;
           case C_RNAV1:
    	   if (nav1mode==0)
    	   {
    				x = Nav1FrStb % 100; // behind dec point
    				x = x + 5 * val; // in steps of 0.05
                if (x > 95)
                    x = 0 ;
                else if (x < 0)
                    x = 95;
    				Nav1FrStb = Nav1FrStb / 100 * 100 + x; // units: 0.01
    				FsbusWrite(C_DNAV1STB, Nav1FrStb);
    				x = Int2BCD(Nav1FrStb % 10000);
    				FsWrite(FS_NAV1STANDBY, x);
                break;
    			}
    			if (nav1mode==1)
            {
    				x = Nav1FrStb / 100;
    				x = x + val; // in steps of 1.00
                if (x > 117)
                    x = 108;
                else if (x < 108)
                    x = 117;
    				Nav1FrStb = x * 100 + Nav1FrStb % 100; // units: 0.01
    				FsbusWrite(C_DNAV1STB, Nav1FrStb);
    				x = Int2BCD(Nav1FrStb % 10000);
    				FsWrite (FS_NAV1STANDBY, x);
    			break;
    		case C_SNAV1SWAP:
                if (val == 0)
                    FsWrite(FS_RADIOUSESTBYTOGGLE, 0x02); // toggle bit 1 (NAV1)
    			break;
    			}

  5. Thanks 388TH_A thanked for this post
  6. #285
    150+ Forum Groupie


    388TH_A's Avatar
    Join Date
    Nov 2008
    Location
    Medford, Oregon (USA)
    Posts
    239
    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

    Thank You David for your post that helped out alot. Also Stefan Sent me a file of a sample project and that has also helped out alot. Thanks guys

  7. #286
    150+ Forum Groupie


    388TH_A's Avatar
    Join Date
    Nov 2008
    Location
    Medford, Oregon (USA)
    Posts
    239
    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

    0x08 toggle bit 3 (COM1)
    0x04 toggle bit 2 (COM2)
    0x02 toggle bit 1 (NAV1)
    0x01 toggle bit 3 (NAV2)

    So if the bits are that above how do you get that out of

    2^3 = COM1
    2^2 = COM2
    2^1 = NAV1
    2^0 = NAV2

  8. #287
    150+ Forum Groupie
    Join Date
    Jan 2007
    Location
    Netherlands
    Posts
    201
    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 388TH_A View Post
    0x08 toggle bit 3 (COM1)
    0x04 toggle bit 2 (COM2)
    0x02 toggle bit 1 (NAV1)
    0x01 toggle bit 3 (NAV2)

    So if the bits are that above how do you get that out of

    2^3 = COM1
    2^2 = COM2
    2^1 = NAV1
    2^0 = NAV2

    Hi Trevor,

    Don't know exactly what your mean with your question, but:

    2^3 = 2 x 2 x 2 = 8 = 0x08 bit3
    2^2 = 2 x 2 = 4 = 0x04 bit2
    2^1 =1 x 2 = 2= 0x02 bit1
    2^0 = 1 = 0x01 bit0

    and so on



    Best regrards

    Jan Geurtsen

  9. #288
    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'm not quite sure about what you are trying to work out either.

    The swap is done with the Nav1mode part of the code. I haven't used any offsets for the swap, just Nav1mode==0 and Nav1mode==1.

    Stefan showed me how to use this and it works perfect.

    Do you want my entire .cpp code for the radios so you can see how it's put together without using offsets for the swap? (I'm more than happy for you to use the whole thing in it's entireity or just bits of it)

    David

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

    Hi David,

    yes we both and Rob in the Sample File use the Radioīs ase Input Only devices.
    We swap the frequenzies self.
    If you donīt need the FS default Swap Offset, you also dont need to read out the frequenzies from the FS.

    Stefan

  11. #290
    150+ Forum Groupie


    388TH_A's Avatar
    Join Date
    Nov 2008
    Location
    Medford, Oregon (USA)
    Posts
    239
    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 Jan737 View Post
    Hi Trevor,

    Don't know exactly what your mean with your question, but:

    2^3 = 2 x 2 x 2 = 8 = 0x08 bit3
    2^2 = 2 x 2 = 4 = 0x04 bit2
    2^1 =1 x 2 = 2= 0x02 bit1
    2^0 = 1 = 0x01 bit0

    and so on



    Best regrards

    Jan Geurtsen
    (Light goes on in head) O.... ok thanks that makes since now! Yeah I understood that A=B but just didnt understand on why it did but i get it now. It was almost like in Math in school where i understood that this = this but didnt see the work for it to prove on why it did. I get it now thanks again Jan!

    And David i think im ok now just was wondering on why above was why it was thats all, but thanks anyways. I might take you up on your offer later down the road for the mcp maybe but well see.

    Trevor

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