-
Posts
1775 -
Joined
-
Last visited
-
Days Won
1
Content Type
Profiles
Forums
Events
Everything posted by Hansolo
-
Hello Mole, IMHO it doesn't work that way. A port is 8 pins, no more and no less. So if you only need 5 pins you need to set the remaining as un-actuated. From you switch map inner dial 0.0 reads = 1 1 1 1 1. Does this mean that there is continuity from you common pin to these 5 pins? Middle dial: 10. and lowest blank are the same! Cheers Solo
-
Hi Mole, Check out this post of mine; https://forums.eagle.ru/showpost.php?p=3336218&postcount=180 I think this may be what you looking for especially the port registers. However this does require that the airframe works with DCS-BIOS, which means that the airframe has to be released and someone has to make the module for DCS-BIOS. If you post a map of the switch may be able to assist a little further. Cheers Solo
-
I would look for Grayhill or JANCO. I did a quick test of the Tornado landing gear lever; This was done with only 12VDC and works nicely. At least mine already has a fly-back diode on the panel itself so you don't have to worry about that; Only make sure that you apply polarity correctly. Cheers Hans
-
I would energize it similar to how I energize the magnetic held switches https://forums.eagle.ru/showpost.php?p=3121287&postcount=148 If you run joystick controllers I would just apply 12VDC to it when you start your pit. I have a similar unit. Else you should be able to use DCS-BIOS. I haven't done it but presune you can get the radar elevation out with DCS-BIOS, then make a logice that if elevation is above 30 feet then cool is energi ed. Cheers
-
Add a few drops of vinegar into a cup of water and clean up the toggle switch using a sponge like this After a few minutes you will have removed the dirt. I use this trick I got of Deadman on all my used toggle switches. Works beautifully. Granted you need to check the rubber seals beforehand. Else have the toggle bat point downwards. You should be able to give the coil on the Tornado landing gear just 12VDC and it will energize. Then you don't need to push the red button to retract the landing gear. Nice finds on the toggle switches btw. :thumbup: Cheers Solo
-
No I am afraid not. Progress goes quiet slow now. They next project will be the AN/ARC-164 head which hopefully will be a fun challange getting to work. Attached is the pinout of mine which I got of Ebay in the UK probably two years ago. Cheers Hans AN_ARC-164(V) UHF pinout - PE101472-001, ver. 2.pdf
-
GSS Rain asked me a question on YT regarding the lighting on the numbers and text. In DCS they are being controlled by two different potentiometers on the Int/Ext light panel. However at least on my two AN/ARC-186's there is only one light. This is how they look when light plate has been powered; An yes the second AN/ARC-186 is now also running :-) Next should be the AN/ARC-164 which is a completely different beast. Cheers Hans
-
Controls box for Virpil Desk Mount (Arduino)
Hansolo replied to Karon's topic in PC Hardware and Related Software
That is a very nice post you have made @Karon :thumbup: What is the push button board you have on the right side on the last picture? And if I understand the setup correctly it will work with momentary switches/push buttons only since there is no diodes, right? But great and cheap setup to make some stuff for the pit. Great work Sir. Cheers Hans -
Prety neat setup you have gotten there @rudellj :thumbup: What kind of controller do you have in the top of the centre pedistal ? Looking forward for more photos Sir. Cheers Hans
-
Honeywell 3 position toggle switches https://rover.ebay.com/rover/0/0/0?mpre=https%3A%2F%2Fwww.ebay.com%2Fulk%2Fitm%2F362291231430
-
draken152, Warhog and GSS Rain many thanks for you kind comments. With regard to getting parts I monitor Ebay (both .com, .de and .co.uk) 3-4 times a day. I got about 100 searches most of them without A-10 in the search name. I also monitor Facebook sites, Viperpits, Flyingfalcon. For the majority of the parts I have gotten they have not been listed as A-10 parts but as something else. I think the KY-58 was listed as radio panel, crypto panel or something. Some of the panels aren't exactly A-10. E.g. the radios most probably aren't since the preset wheel is red. The LOAD button is also deeper in the panel than on the A-10 so perhaps a helo. I got them for $300-400 for the set plus shipping. For free? Absolutely not but I wanted them. There have been a few other sets up which actually was spot on. I think one of the sets sold long after I stopped bidding for something like $1500. Thing is that especially for the radios they may be made into green tagged parts if you have a company certified for doing just that. And then probably the same radio can sell for $10.000. So sometimes you fight professional companies. The IFF can be found on a regular basis on Ebay at anything from $120-150 though the only listed one right now is $400 but it has a yellow tag on it. Normally when I find something I am not allowed to purchase or won't I try to list them in the Ebay section of ED. So unfortunately it's not like I have a site called A-10C_Warthog_panel.com where I can just buy all the stuff and at no cost at all. I consider almost anything at $150-200 plus shipping a good buy. Is that nuts? Well not exactly sane I guess :-) but it's a decision I have taken some time back. The good thing I think about our small community is that it all depends on what you as a builder wants. Do you want a single frame pit or one that can handle a lot of different airframes, do you even want something to press on at all. Do you want to spend a lot of money for the right feel and clicks, how much are you willing and able to spend, what are you abillities and tools. This is up for the individual builder/simmer to descide. You @Warhog has gotten an amazing skill set and tools for cnc'ing which you have aqquired over working life. @GSS Rain has electronics knowledge like I have never seen before. I would hack off an arm for the combined skills of the two of you. It may have made my life a lot easier and possibly cheaper but possibly also more time consuming I guess :megalol: Cheers Hans
-
Building Recreational Flight Simulators, by Mike Powell https://www.ebay.com/itm/Building-Recreational-Flight-Simulators/162974810207?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2060353.m1438.l2649
-
AN/ARC-186 Thansk pavespawn and glad you got it working :thumbup: Whoohoo got the AN/ARC-186 up and running. Acquired a set 2 years a go where all the internals had been removed, so not exactly a working radio. Think seller had tried to see if he could convert it into a sim but had never finished. The only PCB available in the ones I had was the one that hold the switches. Since it obviously wasn't prepared for DCS-BIOS but for a working unit there was a large numbers of diode on the PCB to give the radio controller board (missing) the inputs needed. I gave up on trying to figure out head and tails on the diode setup so de-solderen them all. After removing them I found out that the PCB is at least three layers so no wonder I wasn't able to trace the line. Had initially hope that the 40 pin on that back side was able to provide me with enough info but had to abandon that idea. After de-soldering the diodes I was able to measure enough point that would allow me to determine the position of the rotary. For frequencies MHz in tenths (0 – 9), and MHz in hundredths I only got 9 input so the code basically checks is it has one of the 9 input or else it's in the tenth position. The Preset selector only used 5 pins for the 20 channels but it's not binary nor grey code. Fact is it doesn't matter because I just used the same mapping system I used on the TACAN. The comparison code base from the TACAN is also the same. /* The following #define tells DCS-BIOS that this is a RS-485 slave device. It also sets the address of this slave device. The slave address should be between 1 and 126 and must be unique among all devices on the same bus. */ #define DCSBIOS_RS485_SLAVE 26 /* The Arduino pin that is connected to the /RE and DE pins on the RS-485 transceiver. */ #define TXENABLE_PIN 2 #include "DcsBios.h" #include <timer.h> Timer tm; // set pin numbers: const int Freq1_3 = 57; const int Freq1_4 = 58; const int Freq1_5 = 59; const int Freq1_6 = 60; const int Freq1_7 = 61; const int Freq1_8 = 62; const int Freq1_10 = 63; const int Freq1_11 = 64; const int Freq1_12 = 65; const int Freq1_13 = 66; const int Freq1_14 = 67; const int Freq1_15 = 68; const int Freq2_1 = 35; const int Freq2_2 = 36; const int Freq2_3 = 37; const int Freq2_4 = 38; const int Freq2_5 = 39; const int Freq2_6 = 40; const int Freq2_7 = 41; const int Freq2_8 = 42; const int Freq2_9 = 43; const int Freq3_1 = 12; const int Freq3_2 = 11; const int Freq3_3 = 10; const int Freq3_4 = 9; const int Freq3_5 = 8; const int Freq3_6 = 7; const int Freq3_7 = 6; const int Freq3_8 = 5; const int Freq3_9 = 4; const int Freq4_00 = 53; const int Freq4_50 = 52; const int Freq4_75 = 51; const int Mode_1 = 56; const int Mode_2 = 55; //Variables int Freq1_DCS = 9; //Initial value set for 12 int Freq2_DCS = 0; //Initial value set for 0 int Freq3_DCS = 0; //Initial value set for 0 int Freq4_DCS = 0; //Initial value set for .00 int Mode_DCS = 0; //Initial value set for OFF int Preset_DCS = 0; //Initial value set for 1 /* paste code snippets from the reference documentation here */ //Frequency selecto1 1 void onVhfamFreq1Change(unsigned int newValue) { Freq1_DCS = newValue; } DcsBios::IntegerBuffer vhfamFreq1Buffer(0x118e, 0x000f, 0, onVhfamFreq1Change); //Frequency selector 2 void onVhfamFreq2Change(unsigned int newValue) { Freq2_DCS = newValue; } DcsBios::IntegerBuffer vhfamFreq2Buffer(0x118e, 0x00f0, 4, onVhfamFreq2Change); //Frequency selector 3 void onVhfamFreq3Change(unsigned int newValue) { Freq3_DCS = newValue; } DcsBios::IntegerBuffer vhfamFreq3Buffer(0x118e, 0x0f00, 8, onVhfamFreq3Change); //Frequency selector 4 void onVhfamFreq4Change(unsigned int newValue) { Freq4_DCS = newValue; } DcsBios::IntegerBuffer vhfamFreq4Buffer(0x118e, 0x7000, 12, onVhfamFreq4Change); //Frequency Selection Dial FM/AM/MAN/PRE const byte vhfamFreqemerPins[4] = {50, 49, 48, 47}; DcsBios::SwitchMultiPos vhfamFreqemer("VHFAM_FREQEMER", vhfamFreqemerPins, 4); //Mode dial void onVhfamModeChange(unsigned int newValue) { Mode_DCS = newValue; } DcsBios::IntegerBuffer vhfamModeBuffer(0x1186, 0x0300, 8, onVhfamModeChange); //Load Button DcsBios::Switch2Pos vhfamLoad("VHFAM_LOAD", 46); //Squelch DcsBios::Switch3Pos vhfamSquelch("VHFAM_SQUELCH", 45, 44); //VHF FM Volume Control DcsBios::Potentiometer vhfamVol("VHFAM_VOL", A0); //VHF FM Preset void onVhfamPresetChange(unsigned int newValue) { Preset_DCS = newValue; } DcsBios::IntegerBuffer vhfamPresetBuffer(0x117c, 0xf800, 11, onVhfamPresetChange); //Master caution lamp - coms test DcsBios::LED masterCaution(0x1012, 0x0800, 13); void setup() { DcsBios::setup(); //Preset inputs DDRA = B00000000; // set PINA (digital 29-22) as inputs PORTA = B11111111; // Sets (digital 29-22) with internal pull up //Inputs pinMode(Freq1_3, INPUT_PULLUP); pinMode(Freq1_4, INPUT_PULLUP); pinMode(Freq1_4, INPUT_PULLUP); pinMode(Freq1_6, INPUT_PULLUP); pinMode(Freq1_7, INPUT_PULLUP); pinMode(Freq1_8, INPUT_PULLUP); pinMode(Freq1_10, INPUT_PULLUP); pinMode(Freq1_11, INPUT_PULLUP); pinMode(Freq1_12, INPUT_PULLUP); pinMode(Freq1_13, INPUT_PULLUP); pinMode(Freq1_14, INPUT_PULLUP); pinMode(Freq1_15, INPUT_PULLUP); pinMode(Freq2_1, INPUT_PULLUP); pinMode(Freq2_2, INPUT_PULLUP); pinMode(Freq2_3, INPUT_PULLUP); pinMode(Freq2_4, INPUT_PULLUP); pinMode(Freq2_5, INPUT_PULLUP); pinMode(Freq2_6, INPUT_PULLUP); pinMode(Freq2_7, INPUT_PULLUP); pinMode(Freq2_8, INPUT_PULLUP); pinMode(Freq2_9, INPUT_PULLUP); pinMode(Freq3_1, INPUT_PULLUP); pinMode(Freq3_2, INPUT_PULLUP); pinMode(Freq3_3, INPUT_PULLUP); pinMode(Freq3_4, INPUT_PULLUP); pinMode(Freq3_5, INPUT_PULLUP); pinMode(Freq3_6, INPUT_PULLUP); pinMode(Freq3_7, INPUT_PULLUP); pinMode(Freq3_8, INPUT_PULLUP); pinMode(Freq3_9, INPUT_PULLUP); pinMode(Freq4_00, INPUT_PULLUP); pinMode(Freq4_50, INPUT_PULLUP); pinMode(Freq4_75, INPUT_PULLUP); pinMode(Mode_1, INPUT_PULLUP); pinMode(Mode_2, INPUT_PULLUP); tm.startTimer(200, setVHF); } int inputFreq1() { int valueFreq1; if (digitalRead(Freq1_3) == LOW) { ///OBS! valueFreq1 = 0; } else if (digitalRead(Freq1_4) == LOW) { //OBS! valueFreq1 = 1; } else if (digitalRead(Freq1_5) == LOW) { //OBS! valueFreq1 = 2; } if (digitalRead(Freq1_6) == LOW) { valueFreq1 = 3; } if (digitalRead(Freq1_7) == LOW) { valueFreq1 = 4; } if (digitalRead(Freq1_8) == LOW) { valueFreq1 = 5; } if (digitalRead(Freq1_10) == LOW) { valueFreq1 = 7; } if (digitalRead(Freq1_11) == LOW) { valueFreq1 = 8; } if (digitalRead(Freq1_12) == LOW) { valueFreq1 = 9; } if (digitalRead(Freq1_13) == LOW) { valueFreq1 = 10; } if (digitalRead(Freq1_14) == LOW) { valueFreq1 = 11; } if (digitalRead(Freq1_15) == LOW) { valueFreq1 = 12; } return valueFreq1; } int inputFreq2() { int valueFreq2; if (digitalRead(Freq2_1) == LOW) { valueFreq2 = 1; } else if (digitalRead(Freq2_2) == LOW) { valueFreq2 = 2; } else if (digitalRead(Freq2_3) == LOW) { valueFreq2 = 3; } else if (digitalRead(Freq2_4) == LOW) { valueFreq2 = 4; } else if (digitalRead(Freq2_5) == LOW) { valueFreq2 = 5; } else if (digitalRead(Freq2_6) == LOW) { valueFreq2 = 6; } else if (digitalRead(Freq2_7) == LOW) { valueFreq2 = 7; } else if (digitalRead(Freq2_8) == LOW) { valueFreq2 = 8; } else if (digitalRead(Freq2_9) == LOW) { valueFreq2 = 9; } else { valueFreq2 = 0; } return valueFreq2; } int inputFreq3() { int valueFreq3; if (digitalRead(Freq3_1) == LOW) { valueFreq3 = 1; } else if (digitalRead(Freq3_2) == LOW) { valueFreq3 = 2; } else if (digitalRead(Freq3_3) == LOW) { valueFreq3 = 3; } else if (digitalRead(Freq3_4) == LOW) { valueFreq3 = 4; } else if (digitalRead(Freq3_5) == LOW) { valueFreq3 = 5; } else if (digitalRead(Freq3_6) == LOW) { valueFreq3 = 6; } else if (digitalRead(Freq3_7) == LOW) { valueFreq3 = 7; } else if (digitalRead(Freq3_8) == LOW) { valueFreq3 = 8; } else if (digitalRead(Freq3_9) == LOW) { valueFreq3 = 9; } else { valueFreq3 = 0; } return valueFreq3; } int inputFreq4() { int valueFreq4; if (digitalRead(Freq4_00) == LOW) { valueFreq4 = 0; } else if (digitalRead(Freq4_50) == LOW) { valueFreq4 = 2; } else if (digitalRead(Freq4_75) == LOW) { valueFreq4 = 3; } else { valueFreq4 = 1; } return valueFreq4; } int inputMode() { int valueMode; if (digitalRead(Mode_1) == HIGH && digitalRead(Mode_2) == HIGH) { valueMode = 0; } else if (digitalRead(Mode_1) == LOW && digitalRead(Mode_2) == HIGH) { valueMode = 1; } else if (digitalRead(Mode_1) == LOW && digitalRead(Mode_2) == LOW){ valueMode = 2; } return valueMode; } int inputPreset() { int valuePreset; if (PINA == B11111110) { valuePreset = 0; } if (PINA == B11111101) { valuePreset = 1; } if (PINA == B11111100) { valuePreset = 2; } if (PINA == B11101111) { valuePreset = 3; } if (PINA == B11101110) { valuePreset = 4; } if (PINA == B11101101) { valuePreset = 5; } if (PINA == B11101100) { valuePreset = 6; } if (PINA == B11011111) { valuePreset = 7; } if (PINA == B11011110) { valuePreset = 8; } if (PINA == B11111011) { valuePreset = 9; } if (PINA == B11111010) { valuePreset = 10; } if (PINA == B11111001) { valuePreset = 11; } if (PINA == B11111000) { valuePreset = 12; } if (PINA == B11101011) { valuePreset = 13; } if (PINA == B11101010) { valuePreset = 14; } if (PINA == B11101001) { valuePreset = 15; } if (PINA == B11101000) { valuePreset = 16; } if (PINA == B11011011) { valuePreset = 17; } if (PINA == B11011010) { valuePreset = 18; } if (PINA == B11110111) { valuePreset = 19; } return valuePreset; } void loop() { DcsBios::loop(); tm.runTimers(); } void setVHF(int timer){ //Adjust frequency selector #1 if (Freq1_DCS < inputFreq1()) { sendDcsBiosMessage("VHFAM_FREQ1", "INC"); } if (Freq1_DCS > inputFreq1()) { sendDcsBiosMessage("VHFAM_FREQ1", "DEC"); } //Adjust frequency selector #2 if (Freq2_DCS < inputFreq2()) { sendDcsBiosMessage("VHFAM_FREQ2", "INC"); } if (Freq2_DCS > inputFreq2()) { sendDcsBiosMessage("VHFAM_FREQ2", "DEC"); } //Adjust frequency selector #3 if (Freq3_DCS < inputFreq3()) { sendDcsBiosMessage("VHFAM_FREQ3", "INC"); } if (Freq3_DCS > inputFreq3()) { sendDcsBiosMessage("VHFAM_FREQ3", "DEC"); } //Adjust frequency selector #4 if (Freq4_DCS < inputFreq4()) { sendDcsBiosMessage("VHFAM_FREQ4", "INC"); } if (Freq4_DCS > inputFreq4()) { sendDcsBiosMessage("VHFAM_FREQ4", "DEC"); } //Adjust Mode if (Mode_DCS < inputMode()) { sendDcsBiosMessage("VHFAM_MODE", "INC"); } if (Mode_DCS > inputMode()) { sendDcsBiosMessage("VHFAM_MODE", "DEC"); } //Adjust Prestes if (Preset_DCS < inputPreset()) { sendDcsBiosMessage("VHFAM_PRESET", "INC"); } if (Preset_DCS > inputPreset()) { sendDcsBiosMessage("VHFAM_PRESET", "DEC"); } } Now the sharp observer will note a few OBS! in the IF code for the first selector. For some odd reason I could use IF ELSE nor IF al the way on this one. I have probably made a mistake but the code works as it is. A few more photos; Another thing which I would like to improve later on is for the code to take the easiest way, i.e. when shifting from preset 18 to preset 3 I would like it to step up not down. *CDU update* A few weeks ago Tekkx offered to sell me a LCD setup for the CDU running with DCS-BIOS. The setup included the LCD shield and AUNO. I took the offer and it arrived just before easter. He had already loaded the sketch on the UNO so it was literally plug 'n play and it is running; This is just from the first tests to it's only taped to the casing and therefore needs a little readjusting. There is a little delay when writting a new screen but I think it is only noticeable when I focus on it. When using the CDU normally then I don't register that it refreshes the screen. Later I will combine the keypresses and LCD code into one and runn off RS485 as well Cheers Hans
-
I don't know how to change the DCS-BIOS code to facilitate the M2000. I am just using the already available 'DCS-BIOS control references' for the A-10C. So have no idea how to set up a new module, i.e. the M2000, but Ian has made some instructions for this; http://dcs-bios.a10c.de/docs/v0.7.0/developerguide.html Cheers
-
Mr.Fenestron, the link it for Gadroc's version of DCS-BIOS. IMHO he made some changes to Ian's setup that would benefit his setup. So be careful if you mix the two different versions. They may or may not be compatible. Cheers Solo
-
@frogger, you can do the same with the Uno's and Mega's. You just need to check the pinout before using an analog pin as digital one Nano pinout; Here you can see that A6 & A7 is exclusively analog pins. Uno pinout, Here there is no notification that some of the pins are exclusively analog. And the Mega; Appears to be no notification that some of the pins are exclusively analog. In fact I am working on a project where I use almost all the analog pins on a Mega for digital inputs. The only issue I found was that I could not use the pin designation as A1-A14 but had to designate them as 55-68. Cheers Solo
-
IMHO yoreh is on to the problem. Pins 0 and 1 are used for USB communication so don't use them. If you run out of digital pins use one of the analog ones. Instead of writting e.g. 5 in the pin assignment just write eg. A0. For a Nano you can do this with A0-A5. A6-A7 only works as analog pins. You may also run into issues with using pin 13 as digital input due to the onboard LED but it can be de-soldered Cheers
-
Thanks Tekkx. If you already have the LCD's in stock I might as well buy it of you instead of waiting. PM inbound Sir Cheers
-
Side console chopped Had a day off so decided to chop my right side console up :music_whistling: It's been on my list for some time because the amount of panels I have made working lately won't fit. The beam along the side of the console won't allow for the ILS nor TACAN to be inserted. They are simply too deep with all the mechanical switches as well as the Arduino setup. Also the MDF sections fill up too much. It hasn't been much of a problem before simply because the depth wasn't that big. Here is a few shot showing the beam removed and also the individual plates cut. Both consoles have done a pretty good job so far and I have had them since the beginning which is 6 years ago. I found some old DZUS rails on Ebay a while back and decided to install those. I mounted a 25x2mm aluminum flat bar between the console side wall and the DZUS. It's far from perfect but I got the side up and running again for tonight's flight and then I also have some idea of what kind of a beat I am up against when I eventually will try and make the side consoles in aluminum :cry: As I have run out of room in the left console until that is being chopped up, the intercom panel will temporarily live in the right side; I'll have to find a screen for the CDU (C-130) which hopefully can run via DCS-BIOS instead of a viewport. The HARS panels isn't correct for the A-10. It has a rotary switch instead of the toggle DG-SLAVE. It may be off an F-15 but apart from that it is in pretty good shape. I am still working on a setup for getting the needle gauge to work, got hold of a chip that can convert 5VDC into plus-minus 10VDC. This was the initial trial so still some tweaking to do :-) Cheers Solo
-
Anyone out there using a motion rig? Got a decent SimTools DCS Plugin?
Hansolo replied to moespeeds's topic in Home Cockpits
Trip Rodriguesz is using a full motion; https://forums.eagle.ru/showthread.php?p=3140983 Cheers -
SageOT & Greekbull purchase the molds to cast knobs for the Hornet a while back but unsure if they ever started a production; https://forums.eagle.ru/showthread.php?t=173349 Cheers
-
TACAN working full range Thanks guys :) Been working a little extra on getting the TACAN to work for all channels. I had tried to do converting from characters to integer but failed. The other day I got an idea of trying to map each of the characters from DCS to an integer in a similar way as I did with the rotary switches; int DCS_Tacan_right() { int DCS_valueTacan_right; if (Tacan_ingame1 == '0') { DCS_valueTacan_right = 0; } if (Tacan_ingame1 == '1') { DCS_valueTacan_right = 1; } if (Tacan_ingame1 == '2') { DCS_valueTacan_right = 2; } if (Tacan_ingame1 == '3') { DCS_valueTacan_right = 3; } if (Tacan_ingame1 == '4') { DCS_valueTacan_right = 4; } if (Tacan_ingame1 == '5') { DCS_valueTacan_right = 5; } if (Tacan_ingame1 == '6') { DCS_valueTacan_right = 6; } if (Tacan_ingame1 == '7') { DCS_valueTacan_right = 7; } if (Tacan_ingame1 == '8') { DCS_valueTacan_right = 8; } if (Tacan_ingame1 == '9') { DCS_valueTacan_right = 9; } return DCS_valueTacan_right; } In each IF statements the Arduino check if the character received from DCS is equal value e.g. '0' then assigned the interter to the value 0 (zero). It actually works :lol: This is what it looks like when running. Sorry for a slight desync when I overlayed the second video. As you can see it still ones in a while overshoots but returns to the actual value. This is the complete code; /* The following #define tells DCS-BIOS that this is a RS-485 slave device. It also sets the address of this slave device. The slave address should be between 1 and 126 and must be unique among all devices on the same bus. */ #define DCSBIOS_RS485_SLAVE 23 /* The Arduino pin that is connected to the /RE and DE pins on the RS-485 transceiver. */ #define TXENABLE_PIN 2 #include "DcsBios.h" #include <timer.h> Timer tm; int Tacan_ingame1; // hold value from DCS for ones int Tacan_ingame10; // hold value from DCS for tens int Tacan_ingame100; // hold value from DCS for hundreds /* paste code snippets from the reference documentation here */ //TACAN test button DcsBios::Switch2Pos tacanTestBtn("TACAN_TEST_BTN", 3); //TACAN test light DcsBios::LED tacanTest(0x10da, 0x0400, 13); //TACAN Channel X/Y Toggle const byte tacanXyPins[2] = {4, 5}; DcsBios::SwitchMultiPos tacanXy("TACAN_XY", tacanXyPins, 2); //TACAN Mode Dial const byte tacanModePins[5] = {6, 7, 8, 9, 10}; DcsBios::SwitchMultiPos tacanMode("TACAN_MODE", tacanModePins, 5); //TACAN Signal Volume DcsBios::Potentiometer tacanVol("TACAN_VOL", A0); //TACAN Channel void onTacanChannelChange(char* newValue) { Tacan_ingame1 = newValue[2]; //TACAN Right Channel Tacan_ingame10 = newValue[1]; //TACAN Left Channel Tacan_ingame100 =newValue[0]; //Tacan left channel hundrets } DcsBios::StringBuffer<4> tacanChannelBuffer(0x1162, onTacanChannelChange); void setup() { DcsBios::setup(); //TACAN_1 inputs DDRA = B00000000; // set PINA (digital 29-22) as inputs PORTA = B11111111; // Sets (digital 29-22) with internal pull up //TACAN_10 inputs DDRC = B00000000; // set PINA (digital 30-37) as inputs PORTC = B11111111; // Sets (digital 30-37) with internal pull up tm.startTimer(200, setTacan); } int inputTacan_right() { int valueTacan_right; if (PINA == B11110010) { valueTacan_right = 0; } if (PINA == B11110101) { valueTacan_right = 1; } if (PINA == B11101011) { valueTacan_right = 2; } if (PINA == B11101111) { valueTacan_right = 3; } if (PINA == B11101110) { valueTacan_right = 4; } if (PINA == B11011101) { valueTacan_right = 5; } if (PINA == B11011011) { valueTacan_right = 6; } if (PINA == B11011111) { valueTacan_right = 7; } if (PINA == B10111110) { valueTacan_right = 8; } if (PINA == B00111101) { valueTacan_right = 9; } return valueTacan_right; } int inputTacan_left() { int valueTacan_left; if (PINC == B11110010) { valueTacan_left = 0; } if (PINC == B11110101) { valueTacan_left = 1; } if (PINC == B11101011) { valueTacan_left = 2; } if (PINC == B11101111) { valueTacan_left = 3; } if (PINC == B11101110) { valueTacan_left = 4; } if (PINC == B11011101) { valueTacan_left = 5; } if (PINC == B11011011) { valueTacan_left = 6; } if (PINC == B11011111) { valueTacan_left = 7; } if (PINC == B10111110) { valueTacan_left = 8; } if (PINC == B00111101) { valueTacan_left = 9; } if (PINC == B00111011) { valueTacan_left = 10; } if (PINC == B01111111) { valueTacan_left = 11; } if (PINC == B11111110) { valueTacan_left = 12; } return valueTacan_left; } int DCS_Tacan_right() { int DCS_valueTacan_right; if (Tacan_ingame1 == '0') { DCS_valueTacan_right = 0; } if (Tacan_ingame1 == '1') { DCS_valueTacan_right = 1; } if (Tacan_ingame1 == '2') { DCS_valueTacan_right = 2; } if (Tacan_ingame1 == '3') { DCS_valueTacan_right = 3; } if (Tacan_ingame1 == '4') { DCS_valueTacan_right = 4; } if (Tacan_ingame1 == '5') { DCS_valueTacan_right = 5; } if (Tacan_ingame1 == '6') { DCS_valueTacan_right = 6; } if (Tacan_ingame1 == '7') { DCS_valueTacan_right = 7; } if (Tacan_ingame1 == '8') { DCS_valueTacan_right = 8; } if (Tacan_ingame1 == '9') { DCS_valueTacan_right = 9; } return DCS_valueTacan_right; } int DCS_Tacan_left() { int DCS_valueTacan_left; if ( Tacan_ingame100 == '0'){ if (Tacan_ingame10 == '0') { DCS_valueTacan_left = 0; } if (Tacan_ingame10 == '1') { DCS_valueTacan_left = 1; } if (Tacan_ingame10 == '2') { DCS_valueTacan_left = 2; } if (Tacan_ingame10 == '3') { DCS_valueTacan_left = 3; } if (Tacan_ingame10 == '4') { DCS_valueTacan_left = 4; } if (Tacan_ingame10 == '5') { DCS_valueTacan_left = 5; } if (Tacan_ingame10 == '6') { DCS_valueTacan_left = 6; } if (Tacan_ingame10 == '7') { DCS_valueTacan_left = 7; } if (Tacan_ingame10 == '8') { DCS_valueTacan_left = 8; } if (Tacan_ingame10 == '9') { DCS_valueTacan_left = 9; } } else { if (Tacan_ingame10 == '0') { DCS_valueTacan_left = 10; } if (Tacan_ingame10 == '1') { DCS_valueTacan_left = 11; } if (Tacan_ingame10 == '2') { DCS_valueTacan_left = 12; } } return DCS_valueTacan_left; } void loop() { DcsBios::loop(); tm.runTimers(); } void setTacan(int timer){ if (DCS_Tacan_right() < inputTacan_right()) { sendDcsBiosMessage("TACAN_1", "INC"); } if (DCS_Tacan_right() > inputTacan_right()) { sendDcsBiosMessage("TACAN_1", "DEC"); } if (DCS_Tacan_left() < inputTacan_left()) { sendDcsBiosMessage("TACAN_10", "INC"); } if (DCS_Tacan_left() > inputTacan_left()) { sendDcsBiosMessage("TACAN_10", "DEC"); } } I may see if I can assign a preliminary value to the three integers Tacan_ingame1, 10 & 100 so that it doesn't start to send as soon as I power up the Arduino. Cheers Hans
-
Sounds good. Yes firstly correct to PINC Yes sir. Check your connection from post 11 and be mindful of the order in which the pins come in; //TACAN_10 inputs continued DDRC = B00000000; // set PINA (digital 30-37) as inputs PORTC = B11111111; // Sets (digital 30-37) with internal pull up Cheers
-
Well you are not calling the function 'setTacan()' at all in the loop thus it is never executed :music_whistling: Try using this loop instead; Here you can see that the 'setTacan()' is being called, and I added a small delay of 200ms ad the end of the loop which means the Arduino will stay here for 200ms before starting all over. It's not the right way of doing it but for simplicity it will do the trick for now. Can you spot the error her; int inputTacan_left() { int valueTacan_left; if (PINA == B11111110) { valueTacan_left = 0; } if (PINA == B11111101) { valueTacan_left = 1; } if (PINA == B11111011) { valueTacan_left = 2; } if (PINA == B11110111) { valueTacan_left = 3; } if (PINA == B11101111) { valueTacan_left = 4; } if (PINA == B11011111) { valueTacan_left = 5; } if (PINA == B10111111) { valueTacan_left = 6; } if (PINA == B01111111) { valueTacan_left = 7; } if (PINC == B11101111) { valueTacan_left = 8; } if (PINC == B11110111) { valueTacan_left = 9; } if (PINC == B11111011) { valueTacan_left = 10; } if (PINC == B11111101) { valueTacan_left = 11; } if ([b]PINA == B11111110[/b]) { valueTacan_left = 12; } return valueTacan_left; } Correct it and you will find that channels 0-7 works however 8-12 does not at least not if you are using the pins you listed. Try and see if you can figure out why 8-12 wont work. Cheers Hans
-
Yes that wouldn't work. First thing is that the sequence of the numbers in the commentary matters. If I recall correctly then we talk about most significant and least significant numbers from left to right. Input 29 is the most significant number and input 22 is the least significant number. So in your code for the first position you are looking for a HIGH value on input no. 29, where you should have been looking input 22. So the order is in reverse. Now you may say that then you should still get a reaction for position number 7. Well no. You remember that when you connect a toggle switch to the Arduino with DCS-BIOS then you use ground for one side of the toggle and then connect the other side of the toggle to the input. So when the toggle if OFF then the Arduino reads the input as HIGH, then when switched into ON the input is grounded and goes LOW. My code is set for internal pullup similar to how the DCS-BIOS code is done. PORTA = B11111111; // Sets (digital 29-22) with internal pull up So if you do not connect anything to the inputs 29-22 then you will be able to measure 5VDC between each input and GND. You have used this in your code; if (PINA == B10000000) { valueTacan_left = 0; Which the Ardiuno based upon the internal pullup will interprets as "inputs 28-22 shall be LOW (connected to GND) then valueTacan_left is zero" I assume that the common pin on the rotary has been connected to GND like the other toggle switches and based upon that this will be the code; if (PINA == B11111110) { valueTacan_left = 0; Cheers