-
Re: Progamming help with FSBus dll
Not sure what you mean.
Here is my OID details for these lights:
#include"indicatorlights.h"
#define OID_INDICATORLIGHTS_GROUP (3 << OID_CONTROL_BITS)
#define C_LEDOUTERMARKER OID_INDICATORLIGHTS_GROUP +1
#define C_LEDMIDDLEMARKER OID_INDICATORLIGHTS_GROUP +2
#define C_LEDINNERMARKER OID_INDICATORLIGHTS_GROUP +3
#define FS_INNERMARKER OID_INDICATORLIGHTS_GROUP +4
#define FS_MIDDLEMARKER OID_INDICATORLIGHTS_GROUP +5
#define FS_OUTERMARKER OID_INDICATORLIGHTS_GROUP +6
If I comment out the outermarker code, it compiles ok (the outermarker light is on at present and paused)
If I change FS_OUTERMARKER to +7 the error is 103, if I change it to +8, the error is 04, so it has something to do with FS_OUTERMARKER
-
Re: Progamming help with FSBus dll
My error again. I was writing to FS_OUTERMARKER instead of C_LEDOUTERMARKER.
Now it compiles and I'll test it.
And of course, now it works.
Thanks for your patience with my learning.
Regards
David
PS I will soon start on the MCP. I will try to use Rob's code without change other than changing the Eventhandler format.
-
Re: Progamming help with FSBus dll
Started on the MCP now.
Set up Rob's code and made some minor formating changes as usual.
Everything seems to work ok except for the AP_Altitude. Seems lots of people have trouble with this one.
This is what Rob has and I've added the FsWrite as it wasn't writing to FSX.
If I use the software knob with the mouse, my Display increments in 100's but does this:
00000
00100
00200
3300
3400
00500
00600
3070
I'll stop there but you get the idea.
If I use the physical rotary, it trys to move on the display will go to 100, 200 and then 00000 again. In the software, it won't move up, but will go down from 00000 to 99900 99800 and then 00000
Here's Robs code:
Code:
case C_RALTITUDE:
//EventHandler(S_RHEADING, 0, 0); // sound rotary
Altitude += val * 10000 / 100; // val can be >1 or <-1
// printf("Altitude %d\n", Altitude);
FsbusWrite(C_DALTITUDE, Altitude);
FsWrite(FS_AP_ALTITUDE, Altitude); // to cockpit display
break;
Do you have any thoughts on this.
-
Re: Progamming help with FSBus dll
Hi,
please donīt use Robs code so much it isnīt finished.
Look to the FSUIPC SDK then you see the error.
My code:
Code:
case CR_APALT:
apalt += val*100;
if (apalt < 0)
apalt = 0;
if (apalt > 39000)
apalt = 39000;
FsbusWrite (CD_APALT, apalt);
FsWrite(FS_AP_ALTITUDE, apalt*19975);
break;
define apalt als static int on top.
Stefan
-
Re: Progamming help with FSBus dll
Hi Stefan,
Thanks again, you're a life saver.
I don't really have a lot of choice for using Rob's code, as I have no other reference to use, and as I don't really know how to code (or rather, I am learning as I'm going), I have no other starting point.
So I hope you can understand how helpful it has been that you have been so willing to help me.
I will change to code and see how it goes.
Gratitude,
David
-
Re: Progamming help with FSBus dll
Wow, there are a lot of errors in Rob's code. I've commented out pretty well everything after this piece of code and it what you have given me increments well. A few minor problems, but usable. Only problem is FSX is not writing to Fsbus.
If I change the altitude in the software, my display doesn't update.
There appears to be other sections of code later on that is also writing to FS_AP_ALTITUDE. When I don't comment this out, the display doesn't increment properly.
This is probably a big ask, but if you have a working sample of a complete MCP code, would you share it with me?
It would save lots of questions.
-
Re: Progamming help with FSBus dll
Hey Stefan,
Do you know if there is going to be a simple key type card like the old FSbus.
I need more space for switches and it seem a waste to build an entire DIO board just for switches. I still have my old Key card, I guess it's is of no use with FSbus dll v2.
Also, I was looking at the pcb layouts with the V2, and in the display pcb, there are about 6 different tabs down the bottom with some very interesting layouts for ... I'm not sure. Can you tell me what they are for (other than the obvious 6 pack and display cards).
Thanks
David
-
Re: Progamming help with FSBus dll
hi,
Quote:
This is probably a big ask, but if you have a working sample of a complete MCP code, would you share it with me?
Yes i have code for you but i only share the Rotarys and ther backway. The switches and LED you can make by your self. The reason for that isnīt i donīt what give you the code, I donīt have the code. All my code samples are from my VasFmc projekt and the Switches talk direkt to VasFmc and not to FSX.
Code:
case CR_APHEADING:
aphdg -= val;
if (aphdg > 360)
aphdg = 1;
if (aphdg < 1)
aphdg = 360;
x = (aphdg * 65536 - 180) / 360;
FsbusWrite (CD_APHEADING, aphdg);
FsWrite(FS_AP_HEADING, x);
break;
case FS_AP_HEADING:
aphdg=(val+1)*360/65536;
if (aphdg == 0)
aphdg = 360;
FsbusWrite (CD_APHEADING, aphdg);
break;
case CR_APALT:
apalt += val*100;
if (apalt < 0)
apalt = 0;
if (apalt > 39000)
apalt = 39000;
FsbusWrite (CD_APALT, apalt);
FsWrite(FS_AP_ALTITUDE, apalt*19975);
break;
case FS_AP_ALTITUDE:
apalt = (val / 19975);
FsbusWrite (CD_APALT, apalt);
break;
case CR_APVSpeed:
apvspeed += val*100;
if (apvspeed < -7600)
apvspeed = -7600;
if (apvspeed > 6000)
apvspeed = 6000;
FsbusWrite (CD_APVSpeed, apvspeed);
FsWrite(FS_AP_VS, apvspeed);
break;
case FS_AP_VS:
apvspeed = val ;
FsbusWrite (CD_APVSpeed, apvspeed);
break;
case CR_APCours:
apvcours -= val;
while (apvcours > 360)
apvcours -= 360;
while (apvcours <= 0)
apvcours += 360;
FsbusWrite (CD_APCours, apvcours);
FsWrite(FS_NAV1OBS, apvcours);
break;
case FS_NAV1OBS:
apvcours = val;
if (apvcours == 0)
apvcours = 360;
FsbusWrite (CD_APCours, apvcours);
break;
case CR_APSpeed:
apias -= val;
if (apias < 100)
apias = 100;
if (apias > 340)
apias = 340;
FsWrite(FS_AP_AIRSPEED, apias);
FsbusWrite (CD_APSpeed, apias);
break;
case FS_AP_AIRSPEED:
apias = val;
FsbusWrite (CD_APSpeed, apias);
break;
For Switches and LED you have enough experiance, to find the right solution.
Also you can use Robs code, that looks ok.
Quote:
I need more space for switches and it seem a waste to build an entire DIO board just for switches.
I donīt think so, DIO is to 80% input. If you calculate there are only 2 (3US$) for the Outs and analog part. That is to low to make a new PCB with ONLY inputs.
Your second question i donīt understand, can you make a drawing of the part? (use the pictures from the docu, or Robs page)
Stefan
-
Re: Progamming help with FSBus dll
First of all, Thank you for the code.
I understand what you are saying about the cost of building a DIO as compared to just the input part. I guess it's more about the space or size of the board, but that's ok, I have all the parts to make another one.
Lastly, the pcb layouts:
If you open the pcb folder under the main FSbus dll folder, then open dsp_7.lay in sprint-Layout, at the bottom of the window you will see tabs named: Platine 1, Platine 2, Platine 3, Platine 4, Platine 1 (yes, another 1), Platine 6, AD, Platine 1 (yes, yet another 1).
The first 1 through 4 are specifically for the 6 pack and the singles, and the 7 digit led cards.
The remainder I have never seen before but they have me curious. The second Platine 1 looks like it is an ATC switch panel with microswitches (numbers 1 to 0 type of keypad)
The third Platine 1 looks like a mounting card for 6 slide potentiometers. Any idea what they all are?
David
-
Re: Progamming help with FSBus dll
No idea, btw. i look for the first time in that file.
Stefan
-
Re: Progamming help with FSBus dll
Other than the obvious ones, none of them resemble any of the boards Rob has on his site.
-
Re: Progamming help with FSBus dll
Stefan,
Another question regarding the code for MCP.
For the flight director switch, using Rob's code for the switch, he has coded it for a momentary switch ie: push, turns on, push again, turns off etc.
How do I change this to be a toggle as it should be ie: switch in up position, ON, switch in down position, OFF (I'm sure you understand what I mean).
Here is the code he has:
Code:
case C_SFLIGHTDIRL:
if (val == 0) {
printf("C_SFLIGHTDIRL event, ValFlightDir=%d\n", ValFlightDir);
if (ValFlightDir == 0)
{
// printf("DIRL0, val=%d\n", val);
FsbusWrite(C_LFLIGHTDIRL, 1);
FsbusWrite(C_LMASTFLIGHTL, 1);
FsbusWrite(C_LFLIGHTDIRR, 0);
FsbusWrite(C_LMASTFLIGHTR, 0);
FsWrite(FS_FLIGHTDIRECTOR,1);
ValFlightDir = 1;
}
elseif (ValFlightDir == 1)
{
// printf("DIRL1, val=%d\n", val);
FsbusWrite(C_LFLIGHTDIRL, 0);
FsbusWrite(C_LMASTFLIGHTL, 0);
FsWrite(FS_FLIGHTDIRECTOR, 0);
FsbusWrite(C_LMASTFLIGHTR, 0);
ValFlightDir = 0;
}
elseif (ValFlightDir == 2)
{
// printf("DIRL2, val=%d\n", val);
FsbusWrite(C_LFLIGHTDIRL, 1);
FsbusWrite(C_LMASTFLIGHTL, 0);
FsWrite(FS_FLIGHTDIRECTOR, 1);
ValFlightDir = 4;
}
elseif (ValFlightDir == 3)
{
// printf("DIRL3, val=%d\n", val);
FsbusWrite(C_LFLIGHTDIRL, 0);
FsbusWrite(C_LMASTFLIGHTL, 0);
FsbusWrite(C_LMASTFLIGHTR, 1);
FsWrite(FS_FLIGHTDIRECTOR, 1);
ValFlightDir = 2;
}
elseif (ValFlightDir == 4)
{
// printf("DIRL4, val=%d\n", val);
FsbusWrite(C_LFLIGHTDIRL, 0);
FsbusWrite(C_LMASTFLIGHTL, 0);
ValFlightDir = 2;
}
}
break;
Thanks again,
David
-
Re: Progamming help with FSBus dll
Hi,
do you need the Logic from the 737 with Left and Right FD, Master and FD Light???
Please discribe what you have build as hardware and what funktion do you need?
Stefan
-
1 Attachment(s)
Re: Progamming help with FSBus dll
I have custom designed my mcp as it is only a single seater cockpit. So there is only one FD switch, I'll describe from left to right (it's loosely based on a 777).
Course Rotary - Course Display
F/D toggle switch
Auto-throttle arm toggle - A/T led indicator
Speed hold momentary
IAS/MACH Display - IAS rotary - IAS/MACH selector momentary
Heading Select momentary / Heading Select Rotary /Heading selectDisplay
Nav momentary / VOR loc momentary / App momentary
Altitude Rotary - Altitude Display - Altitude hold momentary
V/S Display - V/S Hold - V/S Rotary
A/P CMD momentary
A/P Disengage (self centering toggle switch)
I've also attached a 737 mcp image that I've made changes to to give you an idea of what I've done.
Thanks
David
-
Re: Progamming help with FSBus dll
ok, i only mean the FD Funktion but ok.
Code:
case C_SFLIGHTDIRL:
if (val == 0) //here you write if 1 active or 0
{
// printf("DIRL0, val=%d\n", val);
FsbusWrite(C_LFLIGHTDIRL, 1);
FsbusWrite(C_LMASTFLIGHTL, 1);
FsWrite(FS_FLIGHTDIRECTOR,1);
}
else
{
// printf("DIRL1, val=%d\n", val);
FsbusWrite(C_LFLIGHTDIRL, 0);
FsbusWrite(C_LMASTFLIGHTL, 0);
FsWrite(FS_FLIGHTDIRECTOR, 0);
}
break;
Stefan
-
Re: Progamming help with FSBus dll
Quote:
ok, i only mean the FD Funktion but ok.
Sorry, I misunderstood your question.
Thank you, thank you, thank you for your help again!!
Very much appreciated.
David
-
Re: Progamming help with FSBus dll
Stefan,
I have another question or rather asking your advice.
I have almost finished wiring up the MCP in which I have made another DIO and display 6pack.
So, my question.
I have designed and made my own Korry replicas and I have an amber light in the bottom half to indicate the switch is active, and I have a green led in the top half to light up the legend ie: APP, HDG SEL etc.
I want the green legend leds to light up when the Master Avionics switch is on.
Do I use the 0x3103 offset (which is the one I've used for the Switch)?
There are 8 green leds that I want to light using the digital out on the DIO board, so how do I write that same value to 8 different addresses.
void cbIndicatorlightsBuildObjects()
{
MkFsbusObject(BTP_D_OUT, C_LEDMCPLEGEND1,"MCP Legend LED",cbIndicatorlights,27,11);
MkFsbusObject(BTP_D_OUT, C_LEDMCPLEGEND2,"MCP Legend LED",cbIndicatorlights,27,12);
MkFsbusObject(BTP_D_OUT, C_LEDMCPLEGEND3,"MCP Legend LED",cbIndicatorlights,27,13);
MkFsbusObject(BTP_D_OUT, C_LEDMCPLEGEND4,"MCP Legend LED",cbIndicatorlights,27,14);
etc>>> to 8
MkFsObject(FS_AVIONICS,"",cbSwitches,0x3103,1,TP_I8,FS_NORMAL);
}
void cbIndicatorlights (int oid, int val, double dval)
{
switch (oid)
{
case FS_AVIONICS:
FsbusWrite (C_LEDMCPLEGEND1, val);
FsbusWrite (C_LEDMCPLEGEND2, val);
FsbusWrite (C_LEDMCPLEGEND3, val);
FsbusWrite (C_LEDMCPLEGEND4, val);
FsbusWrite (C_LEDMCPLEGEND5, val);
UP TO 8
break;
Will this do the job.
Thanks
David
-
Re: Progamming help with FSBus dll
Hi,
the way is right.
Do that work or do you have problems?
I see that FS_AVIONICS you refary to cbSwitches but you use it in cbIndicatorlights. That can be a problem. Maybe you try a global Eventhandler, than you dont have such problems.
Stefan
-
Re: Progamming help with FSBus dll
Quote:
Originally Posted by
sgaert
Hi,
the way is right.
Do that work or do you have problems?
I see that FS_AVIONICS you refary to cbSwitches but you use it in cbIndicatorlights. That can be a problem. Maybe you try a global Eventhandler, than you dont have such problems.
HI Stefan,
Go to hear from you.
Yes it does work this way.
Yes I did have a problem with declaring FS_AVIONICS twice so I moved the code into the Indicatorlights Group and all is good.
Thanks
I'm still not sure how to do the global Eventhandler though, this would have been a simpler solution to keep all the relevant code in the relevant files.
Regards
David
-
Re: Progamming help with FSBus dll
Hi Stefan,
I have a little problem I'm hoping you can help me with.
It's been a little while since I've been able to do any work on the sim.
The other day, I finally connected the ADF and Exponder displays up permanently and fired up the sim.
Strange things are happening. As you know, I have built the code up bit by bit and it has worked all the way through.
Here is what is happening:
Some switches are not working (even though they work in FSAdmin)
The servos are doing strange things (although the do follow the software gauges most of the time)
The voltmeters are doing their own thing
The displays will not display correctly (they test fine in FSADmin), they will not display what is on the screen, although the rotaries are changing the setting on the screen and on the display (not the same though), and the decimal point is missing (works in FSAdmin) then the servos in the gauges move rapidly and the displays go out. If I turn the rotaries, the displays light up again (incorrectly) and then the servos move rapidly and the displays go out.
The push button on the rotaries are not working either (they do in FSAdmin).
So, as you can see, there is a lot of things not working how they used to or should. Nothing has changed apart from time.
What can you suggest. Have you had this happen before.
Appreciate you help.
Thanks
David
-
Re: Progamming help with FSBus dll
Hi,
oh yes, that sounds realy crazy.
The first i would try is to check the code and rebuild the exe.
Stefan
-
Re: Progamming help with FSBus dll
Hi Stefan,
Thanks for responding.
I have tried rebuilding the code. Nothing really has been changed since you helped me with the FS_AVIONICS solution. That worked without any problems.
Not sure where to go from here to problem solve. Oh, one oddity. I use the same 10 pin bus cable from the Com board to the DIO and then onto the Servo board.
The servo board keeps taking on the CID of the DIO board (CID27) so I have to reflash the CID on the servo board.
This is an example of when this happens: I want to declare a rotary switch on my DIO board so I disconnect everything connected to the Com board other than the DIO board and I disconnect the Servo Board from the end of the cable.
After I've declared the Rotary (or anything else I need to do with the DIO board) I take the jumper off, connect everything back up and when I reconnect the servo board, I get 27 being displayed on the LED of the servo board which means even though the jumper is not on the Servo board or the DIO board, it's CID is being changed.
I hope I can resolve this without having to restart the coding process from the beginning.
Thanks
David
-
Re: Progamming help with FSBus dll
Ah interessting.
A year ago i had the same problem, always changing CID and non stored parameters in the controllers. My solution was to erase the Controller Chip and reflasch them new incl. the EEPROM part. Sometimes the EEPROM part was not erase or flash able. Than i renew that Controllers. Since that time i have some Controller for backup in my toolbox.
Stefan
-
Re: Progamming help with FSBus dll
I thought this might have been my next step.
So reflash each controller chip with the hex (which is the EEPROM part, is that the fusebits?).
This may sound like an obvious questions but, will I need to reset the zero points on the servos, redeclare rotaries etc. etc.
David
-
Re: Progamming help with FSBus dll
Hi,
the EEPROM part is the blue characters part in Ponyprog.
In the EEPROM part the all parameters are saved.
You have to set the parameters new.
In ponyprog you find a butten called erase.
Stefan
-
Re: Progamming help with FSBus dll
Thanks Stefan, I'll let you know how it goes.
Regards
David
-
Re: Progamming help with FSBus dll
I have reflashed the DIO to check it first. I just left the DIO board connected and tested it out.
Everything seems to work ok, although now there seems to be a time lag from changing something in the cockpit to it happening in the software (it's only fractions of a second as compared to instantly before).
I then plugged in the 6pack Display board and everything seems to work other than the decimal point (I will reflash these incase they became corrupt).
I then plugged in servo card and this is where things went funny. There may be a power problem (I have the seperate 5vdc connected to the servo card for power) for a few moments, the servos were ok, then it was like a power surge to the servos, they moved rapidly and then the displays went out. The displays can be lit up again by moving the associated rotary.
As the servos are poling to maintain a set position, there is a (I'll describe it like this) electrical wave that travels through the displays, lcd monitor, and then there is the surge in the servos and it all happens again.
The 'electrical wave' is like an electrical interferrence.
Does this information give you any ideas?
Thanks again
David
-
Re: Progamming help with FSBus dll
Quote:
I then plugged in the 6pack Display board and everything seems to work other than the decimal point (I will reflash these incase they became corrupt).
I know the problem with the decimal point. If you set them at Build of the Objekts than he not work. But if you make them later in your code every thing is ok.
Your Servo problem sounds strange. Do you checked you 5V Power supply?
Maybe put only 1 Servo to the board and try 5V from the Databus as Power.
Stefan
-
Re: Progamming help with FSBus dll
Quote:
Originally Posted by
sgaert
I know the problem with the decimal point. If you set them at Build of the Objekts than he not work. But if you make them later in your code every thing is ok.
Your Servo problem sounds strange. Do you checked you 5V Power supply?
Maybe put only 1 Servo to the board and try 5V from the Databus as Power.
Stefan
Hi Stefan,
The decimal point displayed correctly before this all happened.
I will reflash the display controllers and see.
It also may seem like there is too much load on the system ie: when the displays go out, if I leave them out, the servos stay stable. When I reactivate the displays, that is when it happens again.
I have tried a seperate power supply to the servos with no difference (I am running com board and some lighting and the servos off the same ATX power supply - this worked fine before)
I'll let you know how the reflashing goes.
Thanks
David
-
Re: Progamming help with FSBus dll
Hi Stefan,
Here's an update on my little problem.
I have reflashed and redelegated my DIO board, reflashed the Servo board (then it took on the CID of the DIO board again ie: Set the DIO to 27, removed the jumper, removed the 10 pin bus cable, set the CID on the servo, removed the jumper, verified that the leds on the boards indicated the correct CID).
I am going to use a seperate 10 pin bus cable to the servo board although this should not make a difference.
I may have found the problem with everything going funny. One of the servos has stopped working but it is getting hot. When I unplug this servo, everything seems to be ok.
I may have cooked this servo. Any thoughts?
I am yet to reflash the displays as I have all back up and running but 1 is missing the decimal point.
David
-
Re: Progamming help with FSBus dll
Hi Stefan,
Here is a further update to my problem.
I have now reflashed every chip in my collection.
Everything is now working well.
If for some reason I remove the 10 pin cable from the servo board and plug it back in, even if nothing else in plugged in, it takes on the CID of 27.
I tried to set the CID on the servo board without the jumper set (incase there was a short) and it would only reset with the jumper (as it should be).
Do you have any idea how this board can be changing it's CID on it's own like this?
It is very strange, and why 27, why not the default 31?
I look forward to your feedback (or anyone elses if someone has come across this before)
Regards
David
-
Re: Progamming help with FSBus dll
Hi David,
yes have an idea what is happend.
But at the moment the way is not verified.
We talk by PM.
Stefan
-
Re: Progamming help with FSBus dll
If the controller is resetting this often, I must have a fault somewhere.
What type of events will cause the controller to reset?
Could this be a power supply problem? I am using a Computer power supply to provide power to the servo board and it is also supplying the power to the Com board, a couple of 12vdc computer ventilation fans and a couple of other things.
I also sent you a PM in response to your PM.
Thanks again Stefan, you are always a source of good knowledge and help.
David
-
Re: Progamming help with FSBus dll
Hi David,
now we go on the way of the solution.
What i write to you, has enable a low Voltage protection. Your 5V Power goes lower than 2,4V that is one reason why the CID will be reset. Now that donīt happend anymore but the complete Controller makes the reset. :mrgreen:
You drive the Servos with the same Power??
Please check your powersupply system maybe it have to less power.
Stefan
-
Re: Progamming help with FSBus dll
Hi Stefan,
Yes, I do use the same PSU for the Com and the extra power line for the servos.
When you say "if the 5vdc power goes less than 2.4vdc" are you referring to the power coming from the com board through the 10 pin connector to the servo board or do you mean from the additional power line coming onto the servo board.
I have not yet tried your suggestion in the PM you sent.
Could I reprogram the code so that all servo commands are to contoller 27 and make the servo CID27 and change the DIO to CID25.
Is this a basic work around that should work long term?
Thanks
David
-
Re: Progamming help with FSBus dll
HI,
ok. i thought that you set the options. The Resets of the ICīs would be the result.
Yes i mean that you use the Power for the Servos over the Com Card.
You can plug the power direct to the Servo Card.
Stefan
-
Re: Progamming help with FSBus dll
Hi Stefan,
I haven't set the options you have given me in the fuse bits yet.
I wanted to check if changing the CID's I use in the programming so that the Servo card is 27 (so when it resets, it doesn't change everything) would be a simple solution before I tried the fuse bits option and possibly cooked my chips.
I have a seperate power line which supplies 5vdc to the servo from the same power supply I use for the Com board (also 5vdc)
I am willing to give the fuse bits option a go if you feel this is the best solution. No, I won't hold you responsible if I cook the chip (I will just set the servo board chip and see how it goes).
Thanks
David
-
Re: Progamming help with FSBus dll
I would try to set the Fuses, it is a protection against problems like losing CID. if you need i can make a screenshot of the Fuse Bit window in Ponyprog.
Stefan
-
Re: Progamming help with FSBus dll
Thanks, I would appreciate the screen shot just to be safe.
Regards
David
-
Re: Progamming help with FSBus dll
Hi,
i send the Screeshot by Mail.
Stefan