-
Re: Progamming help with FSBus dll
Ok, that's much much better. Gauge is now a little behind ie: in 180 degrees on the screen, gauge will move 150 deg.
Also, when the needle gets to the bottom (relative bearing data goes from 1222 to 0, or the val goes from +32765 to -32765, the needle does a full 360 deg turn plus another 30degress.
Seems like it's getting close.
-
Re: Progamming help with FSBus dll
Ok edit that line to that.
ADF1RelDataIn = val + 32765;
Quote:
Also, when the needle gets to the bottom (relative bearing data goes from 1222 to 0, or the val goes from +32765 to -32765, the needle does a full 360 deg turn plus another 30degress.
That was the reason why i ask you to fly a lot of 360th. I expected that error.
We need something like a counter that count how many full cirrcles the Data input turn. With that we can add full circle steps to the output.
That is a good homework for us.
Stefan
-
Re: Progamming help with FSBus dll
Quote:
Originally Posted by
sgaert
Ok edit that line to that.
ADF1RelDataIn = val + 32765;
Is this the number to edit and play around with until the ratio is correct?
-
Re: Progamming help with FSBus dll
no that is to change the signed Value in an unsigned value.
-
Re: Progamming help with FSBus dll
Ok, so this is what I need to change: static int ADF1RelNeedleStep = 1150;?
-
Re: Progamming help with FSBus dll
That is the nummber of Steps for a full 360.
-
Re: Progamming help with FSBus dll
I will do some calculations tomorrow to work out a little more accurately the number of steps.
-
Re: Progamming help with FSBus dll
Just another thing, in the FSUIPC SDK the offset I'm using states this:
relative bearing to NDB ( *360/65536 for degrees, –ve
left, +ve right)
so if I divide 65536 by 2 would be 32768. Should this be the number in this line: ADF1RelDataIn = val + 32765;
-
Re: Progamming help with FSBus dll
maybe, you write that the values are -32765 to 32765.
-
Re: Progamming help with FSBus dll
Hey guys
Ok i put a new 8535 in and flashed fine, set bits and BO no problems. BUT - during a flight same issue but this time it was VS and CRS that stopped working.
Do you know if the new DLL would fix these problems? When will it be released?
-
Re: Progamming help with FSBus dll
I have 11 IO Boards working, there is no error.
David and i have the new DLL for testing.
Official it will release after the 20.Feb.2011.
Stefan
-
Re: Progamming help with FSBus dll
This is very strange. I can't think of something that is doing this. Could it be the setup of my serial port? or W7? or something affecting it?
I am lost.
-
Re: Progamming help with FSBus dll
Hi Sean,
I only have two IO boards working faultlessly. I did have the issue of resets on the board, but changed the fuse bits as you have done, and I have not had a problem since. I use many rotary encoders without problems.
If it has only just started doing this, the board may have developed a cracked track if it has been moved a lot, or bent or twisted a bit.
Looks like some detective work, but there will definately be a fault somewhere, perhaps even a dry solder joint. My next step would be to pull the board out, grab your multimeter and start testing. Maybe even put the board under a little pressure so if there is a crack it would be easier to pick up with the meter.
Just my thoughts.
David
-
Re: Progamming help with FSBus dll
Quote:
Originally Posted by
sgaert
maybe, you write that the values are -32765 to 32765.
How would I write it that way in the code?
When ever the relative bearing data goes into a -ve number, the 'buf' error appears.
-
Re: Progamming help with FSBus dll
Quote:
Originally Posted by
sgaert
Ok edit that line to that.
ADF1RelDataIn = val + 32765;
That was the reason why i ask you to fly a lot of 360th. I expected that error.
We need something like a counter that count how many full cirrcles the Data input turn. With that we can add full circle steps to the output.
That is a good homework for us.
Stefan
Had any thoughts on this one?
I wouldn't know where to begin to add a counter, let alone what to do with the data after that. Thank god you're here.
-
Re: Progamming help with FSBus dll
i have some ideas, but not the time to code that.
Also i don´t know the effect if you enter a new frequenz.
-
Re: Progamming help with FSBus dll
Happy to wait until you have time Stefan. I just appreciate the time you are giving.
-
Re: Progamming help with FSBus dll
Hehe, new Idea, try it self. :lol:
Here is my Idea.
https://lh6.googleusercontent.com/_B...-13-39_517.jpg
have fun,
Stefan
-
Re: Progamming help with FSBus dll
As info Version 3 is released.
download
Have fun and read the manual for the changes!!
-
Re: Progamming help with FSBus dll
Quote:
Originally Posted by
sgaert
As info Version 3 is released.
download
Have fun and read the manual for the changes!!
Thanks Stefan. Anythig new that would be good to take special note of?
-
Re: Progamming help with FSBus dll
Yes that ios marked in the Manual and you compiler also give you a message.
-
Re: Progamming help with FSBus dll
Hi Stefan,
Has Dirk made any changes to the version I have as a final release?
Thanks
David
-
Re: Progamming help with FSBus dll
-
Re: Progamming help with FSBus dll
So I should I download the version from the website and replace the test V3.
Thanks
-
Re: Progamming help with FSBus dll
-
Re: Progamming help with FSBus dll
Quote:
Originally Posted by
sgaert
Hi Stefan,
Had any more thoughts about how to do this?
How would I define dist1, dist2 and dist3?
Thanks
David
-
Re: Progamming help with FSBus dll
that is so easy.
The Problem isn´t the Programming, it is normal mathamatics.
You need to find the right formula, use pen and paper and calculate situations/movings. The very last stepp is to translate that in C++.
dist1-3 are normal int.
//dist3
if (ADF1RelDataSave > 32768 )
{
dist3 = 65536 - ADF1RelDataSave;
}
else
{
dist3 == ADF1RelDataSave;
}
//dist2
if (ADF1RelDataIn > 32768 )
{
dist2 = 65536 - ADF1RelDataIn;
}
else
{
dist2 == ADF1RelDataIn;
}
//dist1
if (ADF1RelDataDif > 0)
{
dist1 == ADF1RelDataDif;
}
else
{
dist1 = ADF1RelDataSave - ADF1RelDataIn;
}
-
Re: Progamming help with FSBus dll
So for example if dist2 and dist3 are say 30 degrees either side of zero, work out how many steps are in that 30 degrees, or what the val data would be at that 30 degree point.
-
Re: Progamming help with FSBus dll
First degree´s are not relevant only the fsuipc input data!! 0-65536
The Problem is that the Stepper can turn to right and left without a limit.
But the data has only one turn.
Now you need a calculation the how may´s turn that is.
If you don´t do that the needle goes from 60000 to 10000 in the left way but the rightway is the shortest and the real one.
Now find the formula to check the shortest way and if nesessary add or subtrackt a full circle from the stepper output.
Sample: 1500 data in in the 4 turn, go to 55000 in the 3 turn, what is the stepper output.
try to find the formular.
-
Re: Progamming help with FSBus dll
I've just been sitting here reading what you just wrote, then looking at the piece of code you have written, then re-reading what you have just written. I think my head is hurting:)
So I understand that we are working with the val output of the offset.
I have no idea where to begin to work a formula out like that. I understand the principle of what needs to be achieved, but really no idea.
You mentioned before about a counter to count the number of 360 deg revolutions. From what you have just said, this still needs to be in the code in order to go from 1500 data in in the 4 turn, go to 55000 in the 3 turn.
-
Re: Progamming help with FSBus dll
try that!!! Completly new Idea from a friend and me.
Code:
static int ADF1RelDataIn;
static int ADF1RelDataSave;
static int ADF1RelDataDif;
static int ADF1RelNeedlegoto;
static int ADF1RelNeedleSave;
static int ADF1RelNeedleDif;
static int ADF1RelNeedleDeg = 65536;
float ADF1RelNeedleMulti;
static int ADF1RelNeedleStep = 1150;
case FS_ADF1RELATIVEBEARING:
printf("Data in: %d\n",val);
ADF1RelNeedleMulti = ADF1RelNeedleDeg/ADF1RelNeedleStep;
if (ADF1RelDataSave < ADF1RelDataIn)
{
ADF1RelDataDif = ADF1RelDataIn - ADF1RelDataSave;
if (ADF1RelDataDif > ADF1RelNeedleDeg/2)
ADF1RelDataDif = ADF1RelDataDif - ADF1RelNeedleDeg;
}
else
{
ADF1RelDataDif = (ADF1RelDataSave - ADF1RelDataIn) * -1;
if (ADF1RelDataDif > ADF1RelNeedleDeg/2)
ADF1RelDataDif = ADF1RelNeedleDeg - ADF1RelDataDif;
}
ADF1RelNeedleDif = ADF1RelDataDif / ADF1RelNeedleMulti;
ADF1RelNeedlegoto = ADF1RelNeedleSave + ADF1RelNeedleDif;
FsbusWriteFmtVar(29,80,ADF1RelNeedlegoto);
ADF1RelNeedleSave = ADF1RelNeedlegoto;
ADF1RelDataSave = ADF1RelDataIn;
break;
-
Re: Progamming help with FSBus dll
Fantastic Stefan, I will give it a try this evening when I get home from work.
Thanks
David
-
Re: Progamming help with FSBus dll
Hi Stefan,
I have had a chance to try the new code, I am getting no needle movement at all.
Using the printf function, the Data In is reading exactly the same the the ADF1RelNeedlegoto.
So the data is going from -32 odd thousand to + 32 od thousand.
Here's a copy and paste:
running ...Data in: -32366
ADF1RelNeedlegoto: -32366
ADF1RelNeedleDif: -32366
press any key to exit ...
Any thoughts?
Thanks
David
Oh, I'm also getting this error message:
warning C4244: '=' : conversion from 'int' to 'float',
for these lines:
ADF1RelNeedleMulti = ADF1RelNeedleDeg/ADF1RelNeedleStep;
ADF1RelNeedleDif = ADF1RelDataDif / ADF1RelNeedleMulti;
-
Re: Progamming help with FSBus dll
Quote:
Oh, I'm also getting this error message:
warning C4244: '=' : conversion from 'int' to 'float',
for these lines:
ADF1RelNeedleMulti = ADF1RelNeedleDeg/ADF1RelNeedleStep;
ADF1RelNeedleDif = ADF1RelDataDif / ADF1RelNeedleMulti;
That is not an error only warning, for me at the moment it isn´t interessting.
But look to a tutorial about Type Casting / Explicit conversion.
Quote:
running ...Data in: -32366
ADF1RelNeedlegoto: -32366
ADF1RelNeedleDif: -32366
press any key to exit ...
That is not possible, show your print funktions.
Did you fly the aircraft and how run the needle?
Stefan
-
Re: Progamming help with FSBus dll
Sorry, I did mean warning.
Here is the code copied and pasted :
Code:
static int ADF1RelDataIn;
static int ADF1RelDataSave;
static int ADF1RelDataDif;
static int ADF1RelNeedlegoto;
static int ADF1RelNeedleSave;
static int ADF1RelNeedleDif;
static int ADF1RelNeedleDeg = 65536;
float ADF1RelNeedleMulti;
//static int ADF1RelNeedleStep = 1150;
static int ADF1RelNeedleStep = 1400;
case FS_ADF1RELATIVEBEARING:
printf("Data in: %d\n",val);
ADF1RelNeedleMulti = ADF1RelNeedleDeg/ADF1RelNeedleStep;
if (ADF1RelDataSave < ADF1RelDataIn)
{
ADF1RelDataDif = ADF1RelDataIn - ADF1RelDataSave;
if (ADF1RelDataDif > ADF1RelNeedleDeg/2)
ADF1RelDataDif = ADF1RelDataDif - ADF1RelNeedleDeg;
}
else
{
ADF1RelDataDif = (ADF1RelDataSave - ADF1RelDataIn) * -1;
if (ADF1RelDataDif > ADF1RelNeedleDeg/2)
ADF1RelDataDif = ADF1RelNeedleDeg - ADF1RelDataDif;
}
ADF1RelNeedleDif = ADF1RelDataDif / ADF1RelNeedleMulti;
ADF1RelNeedlegoto = ADF1RelNeedleSave + ADF1RelNeedleDif;
FsbusWriteFmtVar(29,80,ADF1RelNeedlegoto);
printf("ADF1RelNeedlegoto: %d\n",val);
ADF1RelNeedleSave = ADF1RelNeedlegoto;
ADF1RelDataSave = ADF1RelDataIn;
printf("ADF1RelNeedleDif: %d\n",val);
break;
-
Re: Progamming help with FSBus dll
OMG!!!!
First how turn the needle if you fly?
Second learn the printf function thet is wrong what you do.
-
Re: Progamming help with FSBus dll
Needle does not move at all.
Opps, I see the error of my ways:)
Have corrected printf function and I'll try it again and report back.
David
-
Re: Progamming help with FSBus dll
Ok, these are the outputs:
Data in: -10972
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -10903
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -10844
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -10906
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -10868
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -10834
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -10950
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Data in: -10956
ADF1RelNeedlegoto: 0
ADF1RelNeedleDif: 0
Just so I'm accurate, this is how I have the printf:
printf("ADF1RelNeedlegoto: %d\n",ADF1RelNeedlegoto);
-
Re: Progamming help with FSBus dll
Ok.
Fly for a positive Data in val.
and gereate a printf for ADF1RelDataDif.
-
Re: Progamming help with FSBus dll
Next try.
Code:
static int ADF1RelDataIn;
static int ADF1RelDataSave;
static int ADF1RelDataDif;
static int ADF1RelNeedlegoto;
static int ADF1RelNeedleSave;
static int ADF1RelNeedleDif;
static int ADF1RelNeedleDeg = 65536;
float ADF1RelNeedleMulti;
//static int ADF1RelNeedleStep = 1150;
static int ADF1RelNeedleStep = 1400;
case FS_ADF1RELATIVEBEARING:
printf("Data in: %d\n",val);
ADF1RelNeedleMulti = ADF1RelNeedleDeg/ADF1RelNeedleStep;
ADF1RelDataDif = ADF1RelDataIn - ADF1RelDataSave;
if ( ADF1RelDataDif > ADF1RelNeedleDeg/2)
ADF1RelDataDif = ADF1RelNeedleDeg-ADF1RelDataDif;
else if (ADF1RelDataDif < (ADF1RelNeedleDeg/2 * -1))
ADF1RelDataDif = ADF1RelNeedleDeg+ADF1RelDataDif;
printf("ADF1RelDataDif: %d\n",ADF1RelDataDif);
ADF1RelNeedleDif = ADF1RelDataDif / ADF1RelNeedleMulti;
ADF1RelNeedlegoto = ADF1RelNeedleSave + ADF1RelNeedleDif;
FsbusWriteFmtVar(29,80,ADF1RelNeedlegoto);
printf("ADF1RelNeedlegoto: %d\n",ADF1RelNeedlegoto);
ADF1RelNeedleSave = ADF1RelNeedlegoto;
ADF1RelDataSave = ADF1RelDataIn;
printf("ADF1RelNeedleDif: %d\n",ADF1RelNeedleDif);
break;
please fly 1x 360 left and 1x 360 right and report the datalog.