Results 281 to 290 of 737
Thread: Progamming help with FSBus dll
-
02-20-2010, 07:17 AM #281
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?
-
02-20-2010, 03:58 PM #282
- Join Date
- Feb 2008
- Location
- Krefeld, Germany
- Posts
- 318
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;
-
02-20-2010, 11:34 PM #283
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.
-
02-21-2010, 03:52 AM #284
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; }
-
Post Thanks / Like - 1 Thanks, 0 Likes, 0 Dislikes
388TH_A thanked for this post
-
02-21-2010, 12:32 PM #285
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
-
02-21-2010, 05:55 PM #286
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
-
02-22-2010, 03:53 AM #287
- Join Date
- Jan 2007
- Location
- Netherlands
- Posts
- 201
-
02-22-2010, 06:20 AM #288
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
-
02-22-2010, 06:28 AM #289
- Join Date
- Feb 2008
- Location
- Krefeld, Germany
- Posts
- 318
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
-
02-22-2010, 10:01 AM #290
Re: Progamming help with FSBus dll
(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
-
Fsbus ng io
By Davral in forum I/O Interfacing Hardware and SoftwareReplies: 1Last Post: 10-19-2024, 05:19 PM -
Need Help Getting My FSBUS NG I/O Going Again..
By JBRoberts in forum I/O Interfacing Hardware and SoftwareReplies: 15Last Post: 10-19-2024, 11:37 AM -
Help FSBUS
By cesarfsim in forum I/O Interfacing Hardware and SoftwareReplies: 3Last Post: 08-27-2024, 02:22 PM -
Fsbus CDK
By flyandre in forum General Builder Questions All Aircraft TypesReplies: 4Last Post: 12-27-2014, 12:58 PM -
Fsbus 2.4.3
By Anderson/SBSP in forum I/O Interfacing Hardware and SoftwareReplies: 9Last Post: 11-30-2008, 04:25 PM