Results 591 to 600 of 737
Thread: Progamming help with FSBus dll
-
01-24-2011, 08:54 PM #591
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
-
01-24-2011, 09:11 PM #592
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?
-
01-25-2011, 02:30 AM #593
- Join Date
- Feb 2008
- Location
- Krefeld, Germany
- Posts
- 318
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.
-
01-25-2011, 06:17 AM #594
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?
-
01-25-2011, 06:46 AM #595
- Join Date
- Feb 2008
- Location
- Krefeld, Germany
- Posts
- 318
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.
-
01-25-2011, 07:01 AM #596
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?
-
01-25-2011, 07:16 AM #597
- Join Date
- Feb 2008
- Location
- Krefeld, Germany
- Posts
- 318
Re: Progamming help with FSBus dll
Integer division by zero.
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;
Next question is how do I use the calibrate function in this situation using steppers?
But not at looping situations, like Compas, RMI,.....
Stefan
-
01-25-2011, 07:55 AM #598
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.
-
01-25-2011, 08:20 AM #599
- Join Date
- Feb 2008
- Location
- Krefeld, Germany
- Posts
- 318
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;
-
01-25-2011, 08:41 AM #600
Re: Progamming help with FSBus dll
Implemented the changed code and the printf produces '26' regardless of the needle position.
Odd!
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
Womans in your city for night
JH startup on Client PC