Results 21 to 30 of 737
Thread: Progamming help with FSBus dll
-
06-03-2009, 04:47 AM #21
- Join Date
- Feb 2008
- Location
- Krefeld, Germany
- Posts
- 318
If you need the full servo way for the gauge than you hav 0-255, as sample my Flap gauge needs 10-235.
The scale value is the 08C8 offset, you can use FSInterrogate2std to find out the value.
Stefan
-
06-03-2009, 06:17 AM #22
FsAdmin gives me the values for the full travel around the rpm gauge as 9-197.
Used FSInterogate (hopefully used it correctly);
With engine stopped 08C8 Engine Scaler read in the 16bit buffer: 5660
in the Factored Buffer: 5660
With engine at full rpm 08C8 Engine Scaler read in the 16bit buffer: 10829
in the Factored Buffer: 10829
Hope this is what you mean.
Thanks
David
-
06-03-2009, 07:36 AM #23
- Join Date
- Feb 2008
- Location
- Krefeld, Germany
- Posts
- 318
hi,
i think you have to use calibrate funktion from the V2.
As a fast solution you can try to divide the RMP by 10.
int x = (val * eng1scaler / 65536)/10;
That isnīt synchron to the scale, but better then the fast movements on low rpm.
Stefan
-
06-04-2009, 07:27 AM #24
Hi Stefan,
V2 dll is possibly going to be release mid June, so only a couple of weeks away.
Do you know what the correct syntax in context would be for the Calibrate function for when it is released.
I will try the /10 option and see how is works. Can I change this number higher or lower in order to make small adjustments?
Thanks
David
-
06-04-2009, 07:41 AM #25
- Join Date
- Feb 2008
- Location
- Krefeld, Germany
- Posts
- 318
Hi,
yes you can adjust that with small changes.
Dirk didnīt arnswer at the moment so i donīt know about a release date, but mid june sounds good.
Part of the V2 Doku
Calibrate
Syntax int Calibrate (int val, CALTAB* t, int count)
Sometimes it is necessary to convert a value from fsuipc into a special output value.
Think about servo applications, where the scale of a gauge is nonlinear or the servo
itself requires some corrections.
This function interpolates a value out of a table which you can supply. You can add an
arbitrary number of points to the table.
The input value must be in ascending order!
Example Example 1:
the input values from 10-250 are interpolated to 0-16000
CALTAB t[] = { {10, 16000},{ 250, 0} };
int x = Calibrate (50, t, sizeof(t)/sizeof(LITAB));
Example 2:
An fsbus control (C_XY) sends a value from 10 to 220. You translate it
into an output value from 0 to 16000.
void EventCallback (int oid, int v)
{
static CALTAB t[] = { {10, 0}, {40, 3000}, {70, 5800},
{100, 8500}, {130, 11000}, {160, 14000},
{190, 15000}, { 220, 16000} };
switch (oid)
{
case C_XY:
Fsrite (FS_CTRL, Calibrate(v, t, ;
break;
}
}
Stefan
-
06-05-2009, 08:34 PM #26
Hi Stefan,
How would I write the Calibrate function into my code in the .h file, I think I need to use this example:
CALTAB t[] = { {10, 16000},{ 250, 0} };
int x = Calibrate (50, t, sizeof(t)/sizeof(LITAB));
Where is it placed in relation to my existing code:
void cbEnginerpm (int oid, int val, double dval)
{
switch (oid)
{
case FS_ENGINE1RPMScaler:
eng1scaler = val;
break;
case FS_ENGINE1RPM:
int x = (val * eng1scaler / 65536)/10;
FsbusWrite (C_RPMSERVO, x);
break;
If I work this out, (with your help of course) when V2 is release, I should be able to integrate this into whatever code I have already written.
Thanks again,
David
-
06-06-2009, 02:25 AM #27
- Join Date
- Feb 2008
- Location
- Krefeld, Germany
- Posts
- 318
Hi,
it is a little bit more to do.
I give you an example from my working Flap Gauge.
Code:case FS_FLAPSINDICATORLEFT: { static CALTAB FLAPIndicator[] = { {100,20},{420,63},{830,95},{2050,115},{4100,134},{6150,148},{10250,162},{12290,180},{16390,200} }; val = Calibrate (val, FLAPIndicator,9); FsbusWrite (CAO_Flaps, val); } break;
The importen Step is to find out the records ({100,20}), an a scale of RPM i would do 8 to 12 pears for a smooth needle.
How you do that??
Put a print funtion in the code with the RPM (value of x) than you let everything run. Than you the the RMP on DosBox and can write down some needle positions.
sample:
RPM=1500
Servo position of 1500RPM in your gauge=120
you have a record of {1500,120}
As last delete the Print funktion.
Regards,
Stefan
-
Post Thanks / Like - 1 Thanks, 0 Likes, 0 DislikesRobiD thanked for this post
-
06-06-2009, 08:26 AM #28
Thanks Stefan, that gives me a good idea of how it works.
The old method has worked well as the actual gauge is virtually the same as the screen when I devide by 17.
I have now progress to the IAS but of course nothing ever goes smooth. From what I can tell, I have followed everything from the example you gave me and also the examples with the dll and I'm getting:
gauges.cpp(6) : error C3861: 'MakeFsObject': identifier not found
Hope you don't mind me posting the code. I know it's is probably something simple that I am just overlooking repeatedly.
gauges.h
#ifndef __GAUGES_H__
#define __GAUGES_H__
void cbGaugesBuildObjects();
void cbGauges (int oid, int val, double dval);
void BuildFsuipcObjects(void);
#endif
gauges.cpp
#include"stdafx.h"
void cbGaugesBuildObjects()
{
MkFsbusObject (BTP_A_OUT,C_IASSERVO,"IASGauge",cbGauges,25,80);
MakeFsObject (FS_IAS,"IASGauge",cbGauges, 0x02BC, 4, TP_I32, FS_QUICK);
}
staticint IAS;
void cbGauges (int oid, int val, double dval)
{
double dbl;
int x;
switch (oid)
{
case FS_IAS:
if (IAS != (val/12)
{
IAS = val / 128;
}
x = 250 - IAS;
x = x < 40 ? 40 : x;
FsbusWrite(C_IASSERVO, x);
break;
}
}
cockpit.cpp
#include"stdafx.h"
#include #include
int _tmain(int argc, _TCHAR* argv[])
{
int v = GetFsbusDLLVersion ();
if (v < 100)
{
printf ("Program requires Fsbus DLL version 1.0.0 or higher\r\n");
return 1;
}
CheckIn();
FsConnect();
FsbusOpen("COM1");
// TODO: add functions to create the fsbus software objects
cbLLSwitchboardBuildObjects();
cbEngineBuildObjects();
cbMagnetoBuildObjects();
cbEnginerpmBuildObjects();
cbGaugesBuildObjects();
printf ("press any key to exit ...\r\n");
while (!_kbhit())
FsbusMux(500);
CheckOut();
return 0;
}
stdafx.h
#pragmaonce
#include"targetver.h"
#include #include
// TODO: reference additional headers your program requires here
#include #include"fsbus.h"
#define OID_LLSWITCHBOARD_GROUP (1 << OID_CONTROL_BITS)
#include"switchboard.h"
#define OID_MAGNETO_GROUP (10 << OID_CONTROL_BITS)
#include"magneto.h"
#define OID_ENGINE_GROUP (2 << OID_CONTROL_BITS)
#include"engine.h"
#define OID_ENGINERPM_GROUP (11 << OID_CONTROL_BITS)
#include"enginerpm.h"
#define C_RPMSERVO OID_ENGINERPM_GROUP + 0
#define FS_ENGINE1RPM OID_ENGINERPM_GROUP + 1
#include"gauges.h"
#define OID_GAUGES_GROUP (15 << OID_CONTROL_BITS)
#define FS_IAS OID_GAUGES_GROUP +3
#define C_IASSERVO OID_GAUGES_GROUP +0
Hope you have time to check it out.
Thanks again.
David
-
06-06-2009, 10:19 AM #29
- Join Date
- Feb 2008
- Location
- Krefeld, Germany
- Posts
- 318
-
06-06-2009, 10:26 AM #30
Tried that and got the same error.
Any other thoughts?
Thanks
David
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
KIDS TEEN 9year GIRL DAUGHTER WEBSITE: OPEN IN AN ANONYMOUS BROWSER (the link does not work in...
Offsets for Trottle