Stefan,
Where do I find the RID numbers for J5 on the DIO. I can find the 0-63 for keys and 72-79 for J3 in the DIO manual but I can't find J4 and J5.
David
Printable View
Stefan,
Where do I find the RID numbers for J5 on the DIO. I can find the 0-63 for keys and 72-79 for J3 in the DIO manual but I can't find J4 and J5.
David
It is to easy, 0-15.
http://www.rvdijk.nl/images/RVD_PCB_...Connectors.JPG
Oh, just got it. 0-63 for the keys are "in" 0-15 are "out"
Thanks
Tested it out with FSX.
GS indicator comes on when your on or approaching the GS.
The "to" light is on. (not sure how to get the "from" indicator to light up to test it).
Very happy about how things are going so far.
Use a VOR fly to or away from them.Quote:
not sure how to get the "from" indicator to light up to test it
Great, it works perfectly.
For my next great acheivement (of course with your help), I want to do the Master Battery, Alternator, Avionics switches and the fuel pump switch.
I have tried to find a simple example in Robs project and also the cockpit project example, and I can't find a good single switch example.
Here's were I'm at:
switches.h
<code>
#ifndef __SWITCHES_H__
#define __SWITCHES_H__
void cbSwitchesBuildObjects();
void cbSwitches (int oid, int val, double dval);
#endif
</code>
switches.cpp
<code>
#include"stdafx.h"
void cbSwitchesBuildObjects()
{
MkFsbusObject (BTP_D_IN,C_SWITCH_ALTERNATOR,"MasterAltSwitch",cbSwitches,27,57);
MkFsbusObject (BTP_D_IN,C_SWITCH_MASTERBATT,"MasterBattSwitch",cbSwitches,27,56);
MkFsbusObject (BTP_D_IN,C_SWITCH_MASTERAVIONICS,"MasterAvionicsSwitch",cbSwitches,27,55);
MkFsbusObject (BTP_D_IN,C_SWITCH_FUELPUMP,"FuelboostPumpSwitch",cbSwitches,27,58);
MkFsObject(FS_ALTERNATOR,"MasterAlternatorSwitch",cbSwitches, 0x3101,1,TP_I8,FS_NORMAL);
MkFsObject(FS_MASTERBATTERYSWITCH,"MasterBattSwitch",cbSwitches, 0x281C, 4, TP_I32, FS_NORMAL);
MkFsObject(FS_MASTERAVIONICSSWITCH,"MasterAvionicsSwitch",cbSwitches, 0x2E80, 4, TP_I32, FS_NORMAL);
MkFsObject(FS_FUELPUMP,"FuelBoostPumpSwitch",cbSwitches, 0x3104, 1, TP_I8, FS_NORMAL);
}
</code>
stdafx.h
<code>
#include"switches.h"
#define OID_SWITCHES_GROUP (17 << OID_CONTROL_BITS)
#define C_SWITCH_ALTERNATOR OID_SWITCHES_GROUP +1
#define FS_ALTERNATOR OID_SWITCHES_GROUP +2
#define C_SWITCH_MASTERBATT OID_SWITCHES_GROUP +3
#define FS_MASTERBATTERYSWITCH OID_SWITCHES_GROUP +4
#define C_SWITCH_MASTERAVIONICS OID_SWITCHES_GROUP +5
#define FS_MASTERAVIONICSSWITCH OID_SWITCHES_GROUP +6
#define C_SWITCH_FUELPUMP OID_SWITCHES_GROUP +7
#define FS_FUELPUMP OID_SWITCHES_GROUP +8
</code>
What arguments (if that's the correct terminology) do I need to put in the switches.cpp file to complete it?
As it is, when I compile, I get these two errors:
switches.obj : error LNK2001: unresolved external symbol "void __cdecl cbSwitches(int,int,double)" (?cbSwitches@@YAXHHN@Z)
1>C:\Documents and Settings\David\My Documents\Visual Studio 2008\Projects\Davids Flight sim\Debug\Davids Flight sim.exe : fatal error LNK1120: 1 unresolved externals
Thanks again,
David
hi,
as first i found.
Master Battery switch = 0x3102
Avionics switch = 0x3103
switches.cpp
#include"stdafx.h"
void cbSwitchesBuildObjects()
{
MkFsbusObject (BTP_D_IN,C_SWITCH_ALTERNATOR,"MasterAltSwitch",cbSwitches,27,57);
MkFsbusObject (BTP_D_IN,C_SWITCH_MASTERBATT,"MasterBattSwitch",cbSwitches,27,56);
MkFsbusObject (BTP_D_IN,C_SWITCH_MASTERAVIONICS,"MasterAvionicsSwitch",cbSwitches,27,55);
MkFsbusObject (BTP_D_IN,C_SWITCH_FUELPUMP,"FuelboostPumpSwitch",cbSwitches,27,5;
MkFsObject(FS_ALTERNATOR,"MasterAlternatorSwitch",cbSwitches, 0x3101,1,TP_I8,FS_NORMAL);
MkFsObject(FS_MASTERBATTERYSWITCH,"MasterBattSwitch",cbSwitches, 0x281C, 4, TP_I32, FS_NORMAL);
MkFsObject(FS_MASTERAVIONICSSWITCH,"MasterAvionicsSwitch",cbSwitches, 0x2E80, 4, TP_I32, FS_NORMAL);
MkFsObject(FS_FUELPUMP,"FuelBoostPumpSwitch",cbSwitches, 0x3104, 1, TP_I8, FS_NORMAL);
}
void cbSwitches (int oid, int val, double dval);
{
switch (oid)
{
case C_SWITCH_ALTERNATOR:
FsWrite (FS_ALTERNATOR, !val); // i donīt know whether that work
break;
}
}
If that not work you have to do the long form, like at the LED part from yesterday.
Regards,
Stefan
Hi Stefan,
I'm getting this error message on compiling:
switches.cpp(17) : error C2447: '{' : missing function header (old-style formal list?)
my fault.
void cbSwitches (int oid, int val, double dval)
It's always something simple. Compiled fine.
I'll test that it works in FSX then add the other switches.
Thanks
David
Stefan,
In the DOS box, I am getting error message:
FSBUS DLL:
ObjectID-551(17,7) still in use
press any key to exit....
Any ideas what that means?
I have only just started FSX and only just powered up my boards and only just run the .exe (through compiling)
That mean you have twice the same object ID.
The message also say what object.
Group: 17
Object: 7
Is this where I should be looking?
The message is referring to the C_SWITCH_FUELPUMP OID_SWITCHES_GROUP +7
#include"switches.h"
#define OID_SWITCHES_GROUP (17 << OID_CONTROL_BITS)
#define C_SWITCH_ALTERNATOR OID_SWITCHES_GROUP +1
#define FS_ALTERNATOR OID_SWITCHES_GROUP +2
#define C_SWITCH_MASTERBATT OID_SWITCHES_GROUP +3
#define FS_BATTERY OID_SWITCHES_GROUP +4
#define C_SWITCH_MASTERAVIONICS OID_SWITCHES_GROUP +5
#define FS_AVIONICS OID_SWITCHES_GROUP +6
#define C_SWITCH_FUELPUMP OID_SWITCHES_GROUP +7
#define FS_FUELPUMP OID_SWITCHES_GROUP +8
Hi Stefan,
I've done a bit of detective work and this is what I've found. Yes, I did have a duplicate Fuel offset (I was experimenting weeks ago and forgot to delete it.
So now the project compiles.
All of the switches work ie: Master Battery, avionics and alternator and fuel pump.
Interestingly, if I turn the fuel pump switch on, if I use any of the above switches,(except the Alternator switch) not only does it turn the switch that it's meant to turn on, but it also switches off the fuel pump.
It does the same even if I // out all lines relating to the fuel pump.
ok, in that case i would make an if - else like at the LEDīs.
Stefan,
Can you give me an example.
In the LEDs, I only have :
case FS_NAV1GSFLAG:
FsbusWrite (C_LEDGLIDESLOPEFLAG, val);
break;
Which I've used,
For the To/From LEDs, I have the if - else
case FS_NAV1TOFROM:
if (val==0)
{
FsbusWrite (C_LEDFROM, val);
FsbusWrite (C_LEDTO, val);
}
else if (val==1)
{
FsbusWrite (C_LEDFROM, 0);
FsbusWrite (C_LEDTO, 1);
}
else if (val==2)
{
FsbusWrite (C_LEDFROM, 1);
FsbusWrite (C_LEDTO, 0);
}
break;
But it's to light 2 leds from the one offset.
Thanks
David
case C_SWITCH_ALTERNATOR:
if (val==0)
FsWrite (FS_ALTERNATOR, 1);
else
FsWrite (FS_ALTERNATOR, 0);
break;
Thanks Stefan,
That works for all the switches but the same problem persists.
The Batt and Avionics switch turns off the fuel pump (that is whether you turn the switch on or off, if you turn the fuel pump switch on, whichever way your turn the Batt or Avionics switch, it turns the fuel pump off). It won't turn it on, it just turns it off.
Tha Master Alt switch does not turn the fuel pump off. I can't see what I've done differently for the Alt switch.
Any other thoughts?
Thanks
David
Ok, I'm totally confused.
I deleted all of my switches and started from scratch.
I moved the fuel pump switch to a different group completely, and re-wrote the Master switches from scratch.
The group that I moved the fuel pump to does not affect the fuel pump switch but the same ones as before still change the fuel pump ie: MasterBatt, MasterAvionics.
Very confusing.
I moved the fuel pump switch to a different group and made sure they all worked right. Then I re-wrote the other switches file one switch at a time and tested it to make sure it wasn't affecting the fuel pump switch again and slowly but surely I rebuilt the file and it now works.
Not sure what the problem was, but it doesn't matter now.
Thanks again for your help.
David
Hey Stefan,
Need your help again if your willing. (or anyone else who knows Fsbus dll well.
I am now programming my fuel, oil press, temp, amps and fuel pressure gauges (6 in all).
They are aircore (voltmeters) and there is no example in the documentation to use.
I am starting with Left fuel gauge. Offset is
<TABLE dir=ltr style="WIDTH: 504px; HEIGHT: 66px" cellSpacing=0 cellPadding=7 width=504 border=1><TBODY><TR><TD vAlign=top width="33%" height=12>0B7C
</TD><TD vAlign=top width="33%" height=12>4
</TD><TD vAlign=top width="33%" height=12>Fuel: left main tank level, % * 128 * 65536
</TD></TR></TBODY></TABLE>
I need an example calculation for this and then I should be able to work the other gauges out from there.
Stefan, I know you have helped me out lots with this and I can't begin to tell you how much it is appreciated. This thread will be very helpful to anyone like me who is learning FSBusdll. So I hope you can continue to help.
Thanks
David
Hi,
do you have a picture of this Gauge?
I donīt know what Values you need as output.
Stefan
Hi Stefan,
These are not the exact same but I bought them from this company and this is the closest they have now.
http://www.futurlec.com.au/Panel_Meters.jsp It's the ones down the bottom.
I have tested the meter in FSAdmin, and I'm getting no response using J3 Analogue out, but if I leave it plugged into J3 and press Auto in the Digital out, the LEDS I have connected to J5 light and the meter is randomly moved (hard, due to voltage) in there. I don't know if I'm missing something. I've followed the instructions in the DIO manual.
Thanks for helping.
David
Did you connect a resistor and capacity to the circuit like on the schematic?
Yes, I've tried with the 10uf cap and the 5k6 resistor and without.
Ok than try other resistors to get a smooth movement wit the Analog Out fader.
On the board in R4-R11 I have 1k resistors and caps in C8-C15.
Should these be there? I have no measurable voltage on the pins of J3.
that is a PWM no Voltage you can measure. you need after J3 a low pass for you gauge.
I figured that is why I couldn't measure a voltage. So it is ok to have the 1k resistors and the caps on the board as well as the cap and resistor after J3.
If so, I have everything covered but no movement on the needle. You suggested changing the resistor after J3. What do you suggest I try at present, it's a 5k6. (Bear in mind that I didn't get any movement with or without the cap and resistor.
Sorry i donīt know. I never try to work with the analog output.
Maybee look to the datasheet of the gauge there you have the values you need for the gauge.
I bought these so long ago, I can't remember what they were ie: amp or volt meters. They may be amp meters as putting a 1.5volt battery (even a flat one) across it makes the needle hit the other side with force.
I may have to souce some new meter and redo the artwork inside them.
Also, on compiling what I've coded, I assigned the fuel gauges BTP_A_OUT with CID 27 and RID 0, it compiles but then says in the DOS box that it is out of range and it should be 80 to 87. Is that right, as the assignments on the image of Rob's board says 00-07.
I had to peel the artwork off of one to see what it was and it's a VU meter which from what I understand is of no use. (unless it is possible to rewind the coil to make it a voltmeter)
Can you give me a general idea of the calculation anyway. You know, what it should look like after the :
switch cbPwmgauges (int oid, int val, double dval) line.
Thanks. I'll have to see what I can work out with these panel meters.
Stefan,
Wondering if you can point me in the right direction.
I am coding in the oil pressure gauge offset 0x3B60 which is a FLOAT64
In FSInterrogate, readings go from 0 at engine off up to 6000 at full rpm so I would estimate that it would go to 10000 if there was an overpressure.
Have used the calibrate function:
void cbVoltmeters (int oid, int val, double dval)
{
switch (oid)
{
case FS_GENERALENGINE1OILPRESSURE:
{
static CALTAB OILPRESSUREGauge[] = {
(0,0),(6000,255)
};
val = Calibrate (val, OILPRESSUREGauge,2);
FsbusWrite (C_OILPRESSURE, val);
}
break;
When I start the engine the needle has full deflection and when I stop the engine, as soon as the oil pressure hits 0 in interrogate, the needle drops to zero.
I have tried all combinations of numbers to get it to show some kind of parity with the gauge in the software, but it seem either off or full on.
I have also tried more numbers in the table, not just 2.
Any help you can offer.
Thanks
David
Hi.
to check the FSUIPC Output, put a print funktion over the calibration.
case FS_GENERALENGINE1OILPRESSURE:
{
printf("GENERALENGINE1OILPRESSURE %d%%\n", val);
static CALTAB OILPRESSUREGauge[] = {
(0,0),(6000,255)
};
val = Calibrate (val, OILPRESSUREGauge,2);
FsbusWrite (C_OILPRESSURE, val);
}
break;
Stefan
The values are the same as what I got from FSInterrogate.
0 for no pressure
3000 plus when engine starts.
But as I said before, When I start the engine the needle moves to full deflection and when I stop the engine, as soon as the oil pressure winds down and hits 0 in interrogate, the needle drops to zero.
It stays fully deflected the moment the pressure moves above 0.
Am I missing something in the calculation. Is this how you would have done it?
I have full deflection from 0 to 100% deflection using the Analog out in FSAdmin, so I shouldn't have to use a different resistor? I am still using the 5k6 resisitor as in the manual.
I had a go at doing the left fuel gauge, and at 0% in the tank, the needle dropped to 0, anything above 0 and it's fully deflected at 100%
Hope that makes sense.
Thanks
David
That dosenīt look at an analog out.
I would make a small programm with a Poti and a Analog Out and put the value of the poti to the analog out. There you can see output signal of the analog output on a definied input.
Stefan
wow, that may be beyond my ability. I am only just beginning to understand a little of C++.
If anyone else wants to help and contribute to this thread, I am more than willing to share to code for my Cessna cockpit.
I only have mine built due to other peoples input.
So this will be a complete Cessna package when it's complete.