Results 311 to 320 of 737
Thread: Progamming help with FSBus dll
-
03-08-2010, 08:06 AM #311
Re: Progamming help with FSBus dll
Ok, on to the next bit of programming.
I have built a Servo based VOR/GS indicator as in Mike's book. Works great. I have almost everything working but now it is time to get all of it's bits working.
Mike has used 3 seven segment Displays at the top and 3 at the bottom of the gauge as the to/from instead of the large resolver ring.
The offset for this is 0C4E for the top display and the bottom needs to be 180 degrees opposite.
I am using a rotary encoder on the gauge to change it.
Using FSInterrogate, 0C4E is the right offset for the 'Omnibearing Selector Knob'
I have some basic programming for the top display and for some reason, it is displaying the same as the last 3 digits of the ADF and changes when I change the ADF.
Stefan, I'd love your assistance in writing the correct code to acheive what I have written above.
This is what I have for the OBS display so far (less all the other bits in the gauges.cpp file):
MkFsbusObject (BTP_DISPLAY,C_OBS_DISPLAY,"OBS Display",cbGauges,15,0);
DisplayOptions (C_OBS_DISPLAY, 3, 0, TRUE, 0);
MkFsObject(FS_NAV1OBS,"OBS",cbGauges,0x0C4E,2,TP_I16,FS_NORMAL);
case FS_NAV1OBS:
//int x;
//x = val;
//static int OBS;
//OBS = Int2BCD(x);
FsbusWrite (C_OBS_DISPLAY, val);
break;
---------------------------------------------------
This is the code I have for the ADF perhaps it is clear to someone else why this is coming through CID 15 instead of the OBS 0x0C4E offset.
MkFsbusObject (BTP_ROTARY, C_RADF,"",cbNav, 27,44);
MkFsbusObject(BTP_DISPLAY, C_DADF_1,"",cbNav, 11, 0);
DisplayOptions(C_DADF_1,5,0,TRUE,2);
MkFsObject(FS_EXTENDEDADF1,"",cbNav,0x0356, 2,TP_UI16,FS_NORMAL);
MkFsObject(FS_ADF1FREQUENCY,"",cbNav,0x034C, 2,TP_UI16,FS_NORMAL);
case FS_ADF1FREQUENCY:
ADF1 = (ADF1 / 10000) * 10000 + BCD2Int(val) * 10 + ADF1 % 10;
FsbusWrite(C_DADF_1, ADF1);
if (bSynchronised == false)
{
ADF1Stb = ADF1;
FsbusWrite(C_DADF_1, ADF1Stb);
}
break;
case FS_EXTENDEDADF1:
ADF1 = BCD2Int(val >> 8) * 10000 + ((ADF1/10)%1000)*10 + BCD2Int(val & 0x00FF);
FsbusWrite(C_DADF_1, ADF1);
if (bSynchronised == false)
{
ADF1Stb = ADF1;
FsbusWrite(C_DADF_1, ADF1Stb);
}
break;
case C_ADFPush:
if(val==0)
{
adfmode+=1;
if (adfmode>2)
adfmode=0;
}
break;
case C_RADF:
if (adfmode==0)
{
x = ADF1Stb / 1000; // hundreds
x = x + val; // update 100s
if (x > 17)
x = 1; // wrap
else if (x < 1)
x = 17; // wrap
ADF1Stb = x * 1000 + ADF1Stb % 1000; // new 100s
FsbusWrite(C_DADF_1, ADF1Stb);
x = Int2BCD(ADF1Stb);
FsWrite(FS_EXTENDEDADF1, ((x & 0x0F0000) >> 8) | (x & 0x00000F));
FsWrite(FS_ADF1FREQUENCY, (x & 0x00FFF0) >> 4);
}
if (adfmode==1)
{
x = (ADF1Stb % 1000) / 10; // tens + units
x = x + val; // update 10s
if (x > 99)
x = 0; // wrap
else if (x < 0)
x = 99; // wrap
ADF1Stb = (ADF1Stb / 1000) * 1000 + x * 10 + ADF1Stb % 10; // new 10s
FsbusWrite(C_DADF_1, ADF1Stb);
x = Int2BCD(ADF1Stb);
FsWrite(FS_EXTENDEDADF1, ((x & 0x0F0000) >> 8) | (x & 0x00000F));
FsWrite(FS_ADF1FREQUENCY, (x & 0x00FFF0) >> 4);
}
if (adfmode==2)
{
x = ADF1Stb % 10; // .1 units
x = x + val; // update 10s
if (x > 9)
x = 0; // wrap
else if (x < 0)
x = 9; // wrap
ADF1Stb = (ADF1Stb / 10) * 10 + x;
FsbusWrite(C_DADF_1, ADF1Stb);
x = Int2BCD(ADF1Stb);
FsWrite(FS_EXTENDEDADF1, ((x & 0x0F0000) >> 8) | (x & 0x00000F));
FsWrite(FS_ADF1FREQUENCY, (x & 0x00FFF0) >> 4);
}
break;
-
03-09-2010, 07:13 AM #312
Re: Progamming help with FSBus dll
I've managed to program this my self (very proud) and it works perfect.
Just can't figure the last bit.
The second group of 3 x 7segment Leds should show the from course which is '180' degrees the opposite of the 'to'.
I have tried dividing the val by 2. At compass 030, I get 015
Tried minus 180 with no luck.
Here is the code I've done. Can someone please tell me what I need to add to show the 'from' heading.
Code:case FS_NAV1OBS: int x; x = val; static int OBS; OBS = Int2BCD(x); FsbusWrite (C_OBS_DISPLAY, val); FsbusWrite(C_DCOURSEL, val); // to cockpit display FsbusWrite(C_DCOURSER, val); val = val >> 1; // this is where I've tried to display the from heading FsbusWrite(C_OBS_FROM_DISPLAY, val); break; case C_OBS_ROTARY: Obsknob -=val; while (Obsknob >360) Obsknob -= 360; while (Obsknob <= 0) Obsknob += 360; FsWrite(FS_NAV1OBS, Obsknob); // to FS FsbusWrite(C_DCOURSEL, Obsknob); // to cockpit display FsbusWrite(C_DCOURSER, Obsknob); FsbusWrite(C_OBS_DISPLAY, Obsknob); break;
David
-
03-10-2010, 07:30 AM #313
Re: Progamming help with FSBus dll
Worked it out finally.
For anyone else who wants to know how to do this, here is the code:
Code:case FS_NAV1OBS: int x; x = val; static int OBS; OBS = Int2BCD(x); FsbusWrite (C_OBS_DISPLAY, val); FsbusWrite(C_DCOURSEL, val); FsbusWrite(C_DCOURSER, val); val = val - 180; while (val >360) val -= 360; while (val <= 0) val += 360; FsbusWrite(C_OBS_FROM_DISPLAY, val); break; case C_OBS_ROTARY: Obsknob -=val; while (Obsknob >360) Obsknob -= 360; while (Obsknob <= 0) Obsknob += 360; FsWrite(FS_NAV1OBS, Obsknob); FsbusWrite(C_DCOURSEL, Obsknob); FsbusWrite(C_DCOURSER, Obsknob); break;
-
03-14-2010, 12:38 AM #314
Re: Progamming help with FSBus dll
Stefan, you still there?
I don't know if you can help me here but here goes.
I am about to tackle building and programming the Altimeter and using a stepper motor.
On the pcb stepper.lay file, do you have the capacity to remove all the black around the outside of the pcb layout. Reason being, when trying to print using the toner transfer method, this enormous amount of toner is causing problems printing. I thought that you would possible have access to the original file. (If you have a look at the file in Sprint, you will see what I mean)
Secondly, do you have an example of how to code for a stepper specific to the altimeter.
Also, when I make the MkFSBusObject is it an analogue or digital out ie: BTP_D_OUT or BTP_A_OUT
Hope you are able to help me out with this.
Thanks
David
-
04-21-2010, 05:10 AM #315
Re: Progamming help with FSBus dll
Here is the File i have stepperfet.lay and when you go into Sprint go to the bottom left side of the program and click on "Enable/disable ground plane" and that will take that away so you may then print it with out the extra black. And the MkFSBusObject is BTP_V_OUT = Stepper controller the first channel begins with r = 80, the 8th channel is r = 87. Says that on page 17 of the fsbusreference.pdf if.... you.... have a copy of that....
-
04-21-2010, 05:19 AM #316
Re: Progamming help with FSBus dll
Thanks Trevor.
Dirk made contact and helped me a little. I still have no idea how to code for the stepper.
I have made the altitude indicator from Mikes book with the 3 optical interupters for zero point. So I'm not sure how to account for this either.
Have you made and are using the stepper? If so, is it possible to see the code you have made to run it so I can get some idea.
Dirk hasn't gone far with testing or using the stepper but has also offered help if needed.
Thanks
David
-
04-21-2010, 06:20 AM #317
Re: Progamming help with FSBus dll
Sorry im Still Stuck on the Radio Stack
-
04-21-2010, 06:23 AM #318
- Join Date
- Feb 2008
- Location
- Krefeld, Germany
- Posts
- 318
Re: Progamming help with FSBus dll
Hi David,
i also never get the Stepper working.
But i seen it on Dirks Setup a year ago. Strange.
Stefan
-
04-21-2010, 06:28 AM #319
Re: Progamming help with FSBus dll
Yes, he said that. Here's part of what Dirk wrote back:
"THe tricky part
will be the zero position decoding. I got it working once, but i know somebody who failed at that point. So far i
haven't investigated that flaw."
It seems a hard choice to go down the road with this controller when it seem no one has got it working yet. (But I guess, someone has to get it going at some point)
So you can see that I would appreciate any help or advice anyone can give.
Regards
David
-
04-21-2010, 06:29 AM #320
Re: Progamming help with FSBus dll
was it hard to solder that LITTLE chip onto the PCB
Similar Threads
-
Fsbus CDK
By flyandre in forum General Builder Questions All Aircraft TypesReplies: 4Last Post: 12-27-2014, 12:58 PM -
Need Help Getting My FSBUS NG I/O Going Again..
By JBRoberts in forum I/O Interfacing Hardware and SoftwareReplies: 14Last Post: 03-21-2010, 01:38 PM -
Fsbus ng io
By Davral in forum I/O Interfacing Hardware and SoftwareReplies: 0Last Post: 01-10-2009, 10:38 PM -
Fsbus 2.4.3
By Anderson/SBSP in forum I/O Interfacing Hardware and SoftwareReplies: 9Last Post: 11-30-2008, 04:25 PM -
Help FSBUS
By cesarfsim in forum I/O Interfacing Hardware and SoftwareReplies: 2Last Post: 10-26-2008, 02:23 PM
Search Prettys Womans from your city for night
5.Sharing an Essay about PIC16F877