Jump to content

DCS-BIOS: Strange behaviour over RS485 Network


molevitch

Recommended Posts

Hi DCS-BIOS Gurus,

 

So I now have 3 panels all working on the network. Each was tested as a standalone under serial irq, before adjusting the code for slavery.

 

I am running 9v 1a power into the network via vin. Apart from the requisite Mga Master, I am running a Nano for a Radio selector board (SPU-7), another Nano for a Freq Preset Dialler and a Mega which is for the ARK-9/15 for which Hans helped me write the Sketch.

 

The strange result I am getting is... the input response is slow, and varies a lot. For example, I turn a dial and it can take 10 seconds for the dial to change in DCS. Some panels are slower than others. And some switches respond immediately.

 

And then after a period of time the network just sort of..... stops.

 

Any opinions on what is causing this will be happily received.

 

Thanks,

 

Molevich

SCAN Intel Core i9 10850K "Comet Lake", 32GB DDR4, 10GB NVIDIA RTX 3080, HP Reverb G2

Custom Mi-24 pit with magnetic braked cyclic and collective. See it here: Molevitch Mi-24 Pit.

 

[sIGPIC][/sIGPIC] www.blacksharkden.com

bsd sig 2021.jpg

Link to comment
Share on other sites

DCS-BIOS: Strange behaviour over RS485 Network

 

You haven’t set 2 panels with the same id number in any sketch by mistake?

 

Or check that you don’t have any strange delay() in the sketch for some reason?

 

 

It’s never too late to give up


Edited by outbaxx
Link to comment
Share on other sites

You haven’t set 2 panels with the same id number in any sketch by mistake?

 

Or check that you don’t have any strange delay() in the sketch for some reason?

 

 

It’s never too late to give up

 

Hi Outbaxx

 

I will double check, but I don't think its that. My slaves are numbered 126, 125 and 124.

 

I had 2 panels working on Nanos, and it became messed up when I added the third with a Mega. The Mega only has a green and a yellow light glowing... no reds. I wonder what that is telling me.

SCAN Intel Core i9 10850K "Comet Lake", 32GB DDR4, 10GB NVIDIA RTX 3080, HP Reverb G2

Custom Mi-24 pit with magnetic braked cyclic and collective. See it here: Molevitch Mi-24 Pit.

 

[sIGPIC][/sIGPIC] www.blacksharkden.com

bsd sig 2021.jpg

Link to comment
Share on other sites

I bought a mega off the internet that had the TX and RX pins incorrectly marked, they were transposed. Caused me all sorts af weird problems, maybe you should check the pinouts marked against a reference board. I did do a thread on it, will try to find it.

 

Cheers

 

Les

 

 

+1 on this, My Megas are marked wrong too,didn’t remember that one.

 

 

It’s never too late to give up

Link to comment
Share on other sites

Hi molevitch,

 

How does your communication look when DCS is not running but your RS-485 is? I had an issue a few years back when running potentiometers.

They kept updating which gave a lot of communication. I had seen same when I ran Helios. The communication was simply flooded with information.

 

I solved this in the by adding a deadband around the current value. If the value from the potentiometer was within the deadband then no update was sent;

 

https://forums.eagle.ru/showpost.php?p=3020643&postcount=127

 

I think Ian added something more clever but I am still running this.

 

Cheers

Hans

Link to comment
Share on other sites

Hi molevitch,

 

How does your communication look when DCS is not running but your RS-485 is? I had an issue a few years back when running potentiometers.

They kept updating which gave a lot of communication. I had seen same when I ran Helios. The communication was simply flooded with information.

 

I solved this in the by adding a deadband around the current value. If the value from the potentiometer was within the deadband then no update was sent;

 

https://forums.eagle.ru/showpost.php?p=3020643&postcount=127

 

I think Ian added something more clever but I am still running this.

 

Cheers

Hans

 

Thanks Hans, thanks guys,

 

I will try running without DCs, see what output it gives me. The slave number is correct. I checked the Tx Rex pins also

 

I will check pots, but I don’t think that’s the issue. I unplugged the slave mega and the network is running the other 2 boards no problem. So I need to start there. It worked as a serial irq panel, but not as a slave, or at least not well. Maybe a dodgy board. But something caused all 3 boards to slow done or in an unexpected way.

 

Will do some more tests....

 

Molevich

SCAN Intel Core i9 10850K "Comet Lake", 32GB DDR4, 10GB NVIDIA RTX 3080, HP Reverb G2

Custom Mi-24 pit with magnetic braked cyclic and collective. See it here: Molevitch Mi-24 Pit.

 

[sIGPIC][/sIGPIC] www.blacksharkden.com

bsd sig 2021.jpg

Link to comment
Share on other sites

Hi molevitch,

 

Is the MAX487 chip on your Mega slave hot. I seem to recall having a similar issue and exchanged the chip. Didn't solve the problem. Then a changed to a third one which worked. IIRCC then the ones I had that didn't work were quite warm/hot.

 

Cheers

Hans

Link to comment
Share on other sites

Dodgy Max487

 

Hi molevitch,

 

Is the MAX487 chip on your Mega slave hot. I seem to recall having a similar issue and exchanged the chip. Didn't solve the problem. Then a changed to a third one which worked. IIRCC then the ones I had that didn't work were quite warm/hot.

 

Cheers

Hans

 

Hi Hans,

 

Yes, it was a bad Max487 chip... All running now!

 

Mole

SCAN Intel Core i9 10850K "Comet Lake", 32GB DDR4, 10GB NVIDIA RTX 3080, HP Reverb G2

Custom Mi-24 pit with magnetic braked cyclic and collective. See it here: Molevitch Mi-24 Pit.

 

[sIGPIC][/sIGPIC] www.blacksharkden.com

bsd sig 2021.jpg

Link to comment
Share on other sites

More strange behaviour under RS485 Network

 

Excellent work work molevitch :thumbup: Glad you got it running again sir

 

Cheers

Hans

 

Soooooo, I have a weird thing happening now.....

 

My sketch for the ARK-9 works perfectly under serial_irq as a test. The dials work, the switches work, it all looks good.

I change the code to set it as a slave, put the Max487 chip back in, plug the panel into the network board. Reset the board by unplugging the USB, power it down, re-power and replug the USB to the Master.

I run DCS, instant action Mi8. Look at the ARK-9. The dials tell the right numbers. I turn the dials and the numbers change.... great! I flip some switches.... nothing. No switches work.:noexpression:

 

I check the Sketch, all seems correct.

 

I don’t understand...

 

Help! Please!

 

Mole.

SCAN Intel Core i9 10850K "Comet Lake", 32GB DDR4, 10GB NVIDIA RTX 3080, HP Reverb G2

Custom Mi-24 pit with magnetic braked cyclic and collective. See it here: Molevitch Mi-24 Pit.

 

[sIGPIC][/sIGPIC] www.blacksharkden.com

bsd sig 2021.jpg

Link to comment
Share on other sites

Hi Mole,

 

What does your communications window look like without running DCS. It should look like this

 

I.e. you should be able to see commands from the slave board for both dials and switches

 

Cheers

Hans

 

Hi Hans,

 

When I run the Master outside DCS, I see a constant stream of the dials outputs being checked and updated. If I flip a switch which is on the same sketch/Mega there is no sign of it, but if I flick a switch on one of the other panels on the same network, it shows in that Master data stream.

 

I have included the Timer.h library.

 

As I say, the Sketch works as a stand-alone panel, so I could run it simply on it's own outside the network, but it should work on the network really.

 

Hi Outbaxx,

 

Yes, the dials work, but the switches do not.... Puzzling!

 

Thanks guys for your interest and help, I have put the code down below in the Spoiler tag.

 

Mole

 

 

/*
 Tell DCS-BIOS to use a serial connection and use interrupt-driven
 communication. The main program will be interrupted to prioritize
 processing incoming data.

 This should work on any Arduino that has an ATMega328 controller
 (Uno, Pro Mini, many others).
*/

/*
 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 124

/*
 The Arduino pin that is connected to the
 /RE and DE pins on the RS-485 transceiver.
*/
#define TXENABLE_PIN 2 

/*#define DCSBIOS_IRQ_SERIAL*/

#include "DcsBios.h"

#include <Timer.h>

int DCS_valueDial_1; // MAIN/1 0-1KHZ DIAL/ARK-9 TUNE
int DCS_valueDial_2; // MAIN/1 10KHZ DIAL
int DCS_valueDial_3; // MAIN/1 100KHZ DIAL
int DCS_valueDial_4; // BACK/1 0-1KHZ DIAL/ARK-9 TUNE
int DCS_valueDial_5; // BACK/1 10KHZ DIAL
int DCS_valueDial_6; // BACK/1 100KHZ DIAL

/* paste code snippets from the reference documentation here */


/*/////////////////////////////////* Switches and toggles*/

const byte arc9ModePins[4] = {6, 7, 8, 9};
DcsBios::SwitchMultiPos arc9Mode("ARC9_MODE", arc9ModePins, 4);

const byte arc9MainBackupPins[2] = {3, 4};
DcsBios::SwitchMultiPos arc9MainBackup("ARC9_MAIN_BACKUP", arc9MainBackupPins, 2);

const byte arc9TlfTlgPins[2] = {14,15};
DcsBios::SwitchMultiPos arc9TlfTlg("ARC9_TLF_TLG", arc9TlfTlgPins, 2);

const byte arc9LoopPins[1] = {16};
DcsBios::SwitchMultiPos arc9Loop("ARC_9_LOOP", arc9LoopPins, 1);

/////////////////////////////////////////////


void onArc9MainTuneChange(unsigned int newValue) {
 DCS_valueDial_1 = newValue;
}
DcsBios::IntegerBuffer arc9MainTuneBuffer(0x2672, 0xffff, 0, onArc9MainTuneChange);

void onArcMain10khzChange(unsigned int newValue) {
 DCS_valueDial_2 = newValue;
}
DcsBios::IntegerBuffer arcMain10khzBuffer(0x26a2, 0x00f0, 4, onArcMain10khzChange);

void onArcMain100khzChange(unsigned int newValue) {
 DCS_valueDial_3 = newValue;
}
DcsBios::IntegerBuffer arcMain100khzBuffer(0x26a2, 0x000f, 0, onArcMain100khzChange);

void onArc9BckTuneChange(unsigned int newValue) {
   DCS_valueDial_4 = newValue;
}
DcsBios::IntegerBuffer arc9BckTuneBuffer(0x2670, 0xffff, 0, onArc9BckTuneChange);

void onArcBck10khzChange(unsigned int newValue) {
  DCS_valueDial_5 = newValue;
}
DcsBios::IntegerBuffer arcBck10khzBuffer(0x26a0, 0xf000, 12, onArcBck10khzChange);

void onArcBck100khzChange(unsigned int newValue) {
   DCS_valueDial_6 = newValue;
}
DcsBios::IntegerBuffer arcBck100khzBuffer(0x26a0, 0x0f00, 8, onArcBck100khzChange);



void setup() {
 DcsBios::setup();

 //ARK-9 DIAL_1 MAIN INPUTS 0-9.5/ -10-+20
 DDRC = B00000000; // set PIND (digital 37-30) as inputs
 PORTC = B11111111; // Sets (digital 37-30) with internal pull up
 //ARK-9 DIAL_2 MAIN inputs- 0-90 kHz Main
 DDRD = B00000000; // set PIND (digital 38+21-18) as inputs
 PORTD = B11111111; // Sets (digital 38+21-18) with internal pull up
 //ARK-9 DIAL_3 MAIN inputs- 100 kHz Main
 DDRA = B00000000; // set PINA (digital 29-22) as inputs
 PORTA = B11111111; // Sets (digital 29-22) with internal pull up
 //ARK-9 DIAL_4 BACK INPUTS 0-9.5/ -10-+20
 DDRB = B00000000; // set PIND (digital 37-30) as inputs
 PORTB = B11111111; // Sets (digital 37-30) with internal pull up
 //ARK-9 DIAL_5 BACK inputs- 0-90 kHz Main
 DDRL = B00000000; // set PIND (digital 38+21-18) as inputs
 PORTL = B11111111; // Sets (digital 38+21-18) with internal pull up
 //ARK-9 DIAL_6 BACK inputs- 100 kHz Main
 DDRK = B00000000; // set PINA (digital 29-22) as inputs
 PORTK = B11111111; // Sets (digital 29-22) with internal pull up
 
}

/////MAIN FREQUENCY TUNE DIAL; DIAL 1 ///////////////////////
int inputDial_1()
{
 int valueDial_1;
 if (PINC == B11111111) {
   valueDial_1 = 0;
 }

 if (PINC == B11111110) {
   valueDial_1 = 1;
 }

 if (PINC == B11101111) {
   valueDial_1 = 2;
 }

 if (PINC == B11101110) {
   valueDial_1 = 3;
 }

 if (PINC == B11111101) {
   valueDial_1 = 4;
 }

 if (PINC == B11111100) {
   valueDial_1 = 5;
 }

 if (PINC == B11101101) {
   valueDial_1 = 6;
 }

 if (PINC == B11101100) {
   valueDial_1 = 7;
 }

 if (PINC == B11110101) {
   valueDial_1 = 8;
 }

 if (PINC == B11110100) {
   valueDial_1 = 9;
 }

 if (PINC == B11100101) {
   valueDial_1 = 10;
 }

 if (PINC == B11100100) {
   valueDial_1 = 11;
 }

 if (PINC == B11111001) {
   valueDial_1 = 12;
 }

 if (PINC == B11111000) {
   valueDial_1 = 13;
 }

 if (PINC == B11101001) {
   valueDial_1 = 14;
 }

 if (PINC == B11101000) {
   valueDial_1 = 15;
 }

 if (PINC == B11110001) {
   valueDial_1 = 16;
 }

 if (PINC == B11110000) {
   valueDial_1 = 17;
 }

 if (PINC == B11100001) {
   valueDial_1 = 18;
 }

 if (PINC == B11100000) {
   valueDial_1 = 19;
 }

 return valueDial_1;
}

///// END OF MAIN FREQUENCY TUNER DIAL_1///////////////////

/////MAIN 10KHZ ROTARY DIAL///////////////////////////////////////////////////
//ARK-9 DIAL_2 inputs- 0-90 kHz Main

//DDRB = B00000000; // set PIND digital 53-50,10-13 as inputs
//PORTB = B11111111; // Sets digital 53-50,10-13 with internal pull up
//}

int inputDial_2()
{
 int valueDial_2;
 if (PIND == B11111111) {
   valueDial_2 = 0;
 }

 if (PIND == B11110111) {
   valueDial_2 = 1;
 }

 if (PIND == B11111011) {
   valueDial_2 = 2;
 }

 if (PIND == B11110011) {
   valueDial_2 = 3;
 }

 if (PIND == B01111010) {
   valueDial_2 = 4;
 }

 if (PIND == B01110010) {
   valueDial_2 = 5;
 }

 if (PIND == B01111001) {
   valueDial_2 = 6;
 }

 if (PIND == B01110001) {
   valueDial_2 = 7;
 }

 if (PIND == B01111000) {
   valueDial_2 = 8;
 }

 if (PIND == B01110000) {
   valueDial_2 = 9;
 }

 return valueDial_2;
}
////222222//END OF MAIN 10KHZ ROTARY DIAL_2////////////////

//33333///MAIN 100KHZ  DIAL_3 ///////////////////////
int inputDial_3()
{
 int valueDial_3;
 if (PINA == B11111111) {
   valueDial_3 = 1;
 }

 if (PINA == B11110111) {
   valueDial_3 = 2;
 }

 if (PINA == B11111110) {
   valueDial_3 = 3;
 }

 if (PINA == B11110110) {
   valueDial_3 = 4;
 }

 if (PINA == B11111010) {
   valueDial_3 = 5;
 }

 if (PINA == B11110010) {
   valueDial_3 = 6;
 }

 if (PINA == B11111100) {
   valueDial_3 = 7;
 }

 if (PINA == B11110100) {
   valueDial_3 = 8;
 }

 if (PINA == B11111000) {
   valueDial_3 = 9;
 }

 if (PINA == B11110000) {
   valueDial_3 = 10;
 }

 if (PINA == B11101111) {
   valueDial_3 = 11;
 }

 if (PINA == B11100111) {
   valueDial_3 = 12;
 }

 if (PINA == B11101110) {
   valueDial_3 = 13;
 }

 if (PINA == B11100110) {
   valueDial_3 = 14;
 }

 if (PINA == B11101010) {
   valueDial_3 = 15;
 }

 if (PINA == B11100010) {
   valueDial_3 = 16;
 }

 if (PINA == B11101100) {
   valueDial_3 = 17;
 }

 if (PINA == B11100100) {
   valueDial_3 = 18;
 }

 if (PINA == B11100100) {
   valueDial_3 = 19;
 }

 if (PINA == B11100100) {
   valueDial_3 = 20;
 }

 return valueDial_3;
}

////333333333////END OF MAIN 100KHZ DIAL 3  

/////BACK FREQUENCY TUNE DIAL; DIAL 1 ///////////////////////
int inputDial_4()
{
 int valueDial_4;
 if (PINB == B11111111) {
   valueDial_4 = 0;
 }

 if (PINB == B11111110) {
   valueDial_4 = 1;
 }

 if (PINB == B11101111) {
   valueDial_4 = 2;
 }

 if (PINB == B11101110) {
   valueDial_4 = 3;
 }

 if (PINB == B11111101) {
   valueDial_4 = 4;
 }

 if (PINB == B11111100) {
   valueDial_4 = 5;
 }

 if (PINB == B11101101) {
   valueDial_4 = 6;
 }

 if (PINB == B11101100) {
   valueDial_4 = 7;
 }

 if (PINB == B11110101) {
   valueDial_4 = 8;
 }

 if (PINB == B11110100) {
   valueDial_4 = 9;
 }

 if (PINB == B11100101) {
   valueDial_4 = 10;
 }

 if (PINB == B11100100) {
   valueDial_4 = 11;
 }

 if (PINB == B11111001) {
   valueDial_4 = 12;
 }

 if (PINB == B11111000) {
   valueDial_4 = 13;
 }

 if (PINB == B11101001) {
   valueDial_4 = 14;
 }

 if (PINB == B11101000) {
   valueDial_4 = 15;
 }

 if (PINB == B11110001) {
   valueDial_4 = 16;
 }

 if (PINB == B11110000) {
   valueDial_4 = 17;
 }

 if (PINB == B11100001) {
   valueDial_4 = 18;
 }

 if (PINB == B11100000) {
   valueDial_4 = 19;
 }

 return valueDial_4;
}

///// END OF BACK FREQUENCY TUNER DIAL_1///////////////////

/////BACK 10KHZ ROTARY DIAL 5///////////////////////////////////////////////////
//ARK-9 DIAL_5 inputs- 0-90 kHz BACK


int inputDial_5()
{
 int valueDial_5;
 if (PINL == B11111111) {
   valueDial_5 = 0;
 }

 if (PINL == B11110111) {
   valueDial_5 = 1;
 }

 if (PINL == B11111011) {
   valueDial_5 = 2;
 }

 if (PINL == B11110011) {
   valueDial_5 = 3;
 }

 if (PINL == B11101010) {
   valueDial_5 = 4;
 }

 if (PINL == B11100010) {
   valueDial_5 = 5;
 }

 if (PINL == B11101001) {
   valueDial_5 = 6;
 }

 if (PINL == B11100001) {
   valueDial_5 = 7;
 }

 if (PINL == B11101000) {
   valueDial_5 = 8;
 }

 if (PINL == B11100000) {
   valueDial_5 = 9;
 }

 return valueDial_5;
}
////555555//END OF BACK 10KHZ ROTARY DIAL_5////////////////

//666666///BACK 100KHZ  DIAL_6 ///////////////////////
int inputDial_6()
{
 int valueDial_6;
 if (PINK == B11111111) {
   valueDial_6 = 1;
 }

 if (PINK == B11110111) {
   valueDial_6 = 2;
 }

 if (PINK == B11111110) {
   valueDial_6 = 3;
 }

 if (PINK == B11110110) {
   valueDial_6 = 4;
 }

 if (PINK == B11111010) {
   valueDial_6 = 5;
 }

 if (PINK == B11110010) {
   valueDial_6 = 6;
 }

 if (PINK == B11111100) {
   valueDial_6 = 7;
 }

 if (PINK == B11110100) {
   valueDial_6 = 8;
 }

 if (PINK == B11111000) {
   valueDial_6 = 9;
 }

 if (PINK == B11110000) {
   valueDial_6 = 10;
 }

 if (PINK == B11101111) {
   valueDial_6 = 11;
 }

 if (PINK == B11100111) {
   valueDial_6 = 12;
 }

 if (PINK == B11101110) {
   valueDial_6 = 13;
 }

 if (PINK == B11100110) {
   valueDial_6 = 14;
 }

 if (PINK == B11101010) {
   valueDial_6 = 15;
 }

 if (PINK == B11100010) {
   valueDial_6 = 16;
 }

 if (PINK == B11101100) {
   valueDial_6 = 17;
 }

 if (PINK == B11100100) {
   valueDial_6 = 18;
 }

 if (PINK == B11100100) {
   valueDial_6 = 19;
 }

 if (PINK == B11100100) {
   valueDial_6 = 20;
 }

 return valueDial_6;
}

////666666////END OF BACK 100KHZ DIAL 6  

void loop() {
 DcsBios::loop();

 // Check and adjust 1st dial
 if (DCS_valueDial_1 != inputDial_1()) {
   if ( inputDial_1() == 0) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "0");
   }
   if ( inputDial_1() == 1) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "3200");
   }
   if ( inputDial_1() == 2) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "6400");
   }
   if ( inputDial_1() == 3) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "9600");
   }
   if ( inputDial_1() == 4) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "12800");
   }
   if ( inputDial_1() == 5) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "16000");
   }
   if ( inputDial_1() == 6) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "19200");
   }
   if ( inputDial_1() == 7) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "22400");
   }
   if ( inputDial_1() == 8) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "25600");
   }
   if ( inputDial_1() == 9) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "28800");
   }
   if ( inputDial_1() == 10) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "32000");
   }
   if ( inputDial_1() == 11) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "35200");
   }
   if ( inputDial_1() == 12) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "38400");
   }
   if ( inputDial_1() == 13) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "41600");
   }
   if ( inputDial_1() == 14) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "44800");
   }
   if ( inputDial_1() == 15) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "48000");
   }
   if ( inputDial_1() == 16) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "51200");
   }
   if ( inputDial_1() == 17) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "54400");
   }
   if ( inputDial_1() == 18) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "57600");
   }
   if ( inputDial_1() == 19) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "60800");
   }
 }


 // Check and adjust 2nd dial
 if (DCS_valueDial_2 != inputDial_2()) {
   if ( inputDial_2() == 0) {
     sendDcsBiosMessage("ARC_MAIN_10KHZ", "0");
   }
   if ( inputDial_2() == 1) {
     sendDcsBiosMessage("ARC_MAIN_10KHZ", "1");
   }
   if ( inputDial_2() == 2) {
     sendDcsBiosMessage("ARC_MAIN_10KHZ", "2");
   }
   if ( inputDial_2() == 3) {
     sendDcsBiosMessage("ARC_MAIN_10KHZ", "3");
   }
   if ( inputDial_2() == 4) {
     sendDcsBiosMessage("ARC_MAIN_10KHZ", "4");
   }
   if ( inputDial_2() == 5) {
     sendDcsBiosMessage("ARC_MAIN_10KHZ", "5");
   }
   if ( inputDial_2() == 6) {
     sendDcsBiosMessage("ARC_MAIN_10KHZ", "6");
   }
   if ( inputDial_2() == 7) {
     sendDcsBiosMessage("ARC_MAIN_10KHZ", "7");
   }
   if ( inputDial_2() == 8) {
     sendDcsBiosMessage("ARC_MAIN_10KHZ", "8");
   }
   if ( inputDial_2() == 9) {
     sendDcsBiosMessage("ARC_MAIN_10KHZ", "9");
   }
 }
// Check and adjust 3RD dial
 if (DCS_valueDial_3 != inputDial_3()) {
   if ( inputDial_3() == 3) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "1");
   }
   if ( inputDial_3() == 4) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "2");
   }
   if ( inputDial_3() == 5) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "3");
   }
   if ( inputDial_3() == 6) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "4");
   }
   if ( inputDial_3() == 7) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "5");
   }
   if ( inputDial_3() == 8) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "6");
   }
   if ( inputDial_3() == 9) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "7");
   }
   if ( inputDial_3() == 10) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "8");
   }
   if ( inputDial_3() == 11) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "9");
   }
   if ( inputDial_3() == 12) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "10");
   }
   if ( inputDial_3() == 13) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "11");
   }
   if ( inputDial_3() == 14) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "12");
   }
   if ( inputDial_3() == 15) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "13");
   }
   if ( inputDial_3() == 16) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "14");
   }
   if ( inputDial_3() == 17) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "15");
   }
   if ( inputDial_3() == 18) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "16");
   }
   if ( inputDial_3() == 19) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "17");
   }
   if ( inputDial_3() == 20) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "18");
   }
   if ( inputDial_3() == 1) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "19");
   }
   if ( inputDial_3() == 2) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "20");
   }
 }
// Check and adjust 4TH dial
 if (DCS_valueDial_4 != inputDial_4()) {
   if ( inputDial_4() == 0) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "0");
   }
   if ( inputDial_4() == 1) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "3200");
   }
   if ( inputDial_4() == 2) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "6400");
   }
   if ( inputDial_4() == 3) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "9600");
   }
   if ( inputDial_4() == 4) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "12800");
   }
   if ( inputDial_4() == 5) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "16000");
   }
   if ( inputDial_4() == 6) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "19200");
   }
   if ( inputDial_4() == 7) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "22400");
   }
   if ( inputDial_4() == 8) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "25600");
   }
   if ( inputDial_4() == 9) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "28800");
   }
   if ( inputDial_4() == 10) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "32000");
   }
   if ( inputDial_4() == 11) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "35200");
   }
   if ( inputDial_4() == 12) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "38400");
   }
   if ( inputDial_4() == 13) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "41600");
   }
   if ( inputDial_4() == 14) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "44800");
   }
   if ( inputDial_4() == 15) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "48000");
   }
   if ( inputDial_4() == 16) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "51200");
   }
   if ( inputDial_4() == 17) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "54400");
   }
   if ( inputDial_4() == 18) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "57600");
   }
   if ( inputDial_4() == 19) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "60800");
   }
 }


 // Check and adjust 5TH dial
 if (DCS_valueDial_5 != inputDial_5()) {
   if ( inputDial_5() == 0) {
     sendDcsBiosMessage("ARC_BCK_10KHZ", "0");
   }
   if ( inputDial_5() == 1) {
     sendDcsBiosMessage("ARC_BCK_10KHZ", "1");
   }
   if ( inputDial_5() == 2) {
     sendDcsBiosMessage("ARC_BCK_10KHZ", "2");
   }
   if ( inputDial_5() == 3) {
     sendDcsBiosMessage("ARC_BCK_10KHZ", "3");
   }
   if ( inputDial_5() == 4) {
     sendDcsBiosMessage("ARC_BCK_10KHZ", "4");
   }
   if ( inputDial_5() == 5) {
     sendDcsBiosMessage("ARC_BCK_10KHZ", "5");
   }
   if ( inputDial_5() == 6) {
     sendDcsBiosMessage("ARC_BCK_10KHZ", "6");
   }
   if ( inputDial_5() == 7) {
     sendDcsBiosMessage("ARC_BCK_10KHZ", "7");
   }
   if ( inputDial_5() == 8) {
     sendDcsBiosMessage("ARC_BCK_10KHZ", "8");
   }
   if ( inputDial_5() == 9) {
     sendDcsBiosMessage("ARC_BCK_10KHZ", "9");
   }
 }
// Check and adjust 6TH dial
 if (DCS_valueDial_6 != inputDial_6()) {
   if ( inputDial_6() == 3) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "1");
   }
   if ( inputDial_6() == 4) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "2");
   }
   if ( inputDial_6() == 5) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "3");
   }
   if ( inputDial_6() == 6) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "4");
   }
   if ( inputDial_6() == 7) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "5");
   }
   if ( inputDial_6() == 8) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "6");
   }
   if ( inputDial_6() == 9) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "7");
   }
   if ( inputDial_6() == 10) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "8");
   }
   if ( inputDial_6() == 11) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "9");
   }
   if ( inputDial_6() == 12) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "10");
   }
   if ( inputDial_6() == 13) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "11");
   }
   if ( inputDial_6() == 14) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "12");
   }
   if ( inputDial_6() == 15) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "13");
   }
   if ( inputDial_6() == 16) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "14");
   }
   if ( inputDial_6() == 17) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "15");
   }
   if ( inputDial_6() == 18) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "16");
   }
   if ( inputDial_6() == 19) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "17");
   }
   if ( inputDial_6() == 20) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "18");
   }
   if ( inputDial_6() == 1) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "19");
   }
   if ( inputDial_6() == 2) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "20");
   }
 }

}

 

SCAN Intel Core i9 10850K "Comet Lake", 32GB DDR4, 10GB NVIDIA RTX 3080, HP Reverb G2

Custom Mi-24 pit with magnetic braked cyclic and collective. See it here: Molevitch Mi-24 Pit.

 

[sIGPIC][/sIGPIC] www.blacksharkden.com

bsd sig 2021.jpg

Link to comment
Share on other sites

Hi mole,

 

I tried to load your sketch but can't replicate the problem;

 

 

I did a few alterations to your sketch. First I rename the Timer.h, which is most likely a name difference between yours an my library. I don't think your Timer.h does anything for you as it is not called again later in your sketch, and the time is not defined.

 

The I added initial positions so that I could get a stable output.

 

The only pin I couldn't get to work is pin16, but what the latest of the 'old' DCS-BIOS it looks like that was supposed to be a 3-position switch

 

Here is your sketch with my few alterations

 

/*
 Tell DCS-BIOS to use a serial connection and use interrupt-driven
 communication. The main program will be interrupted to prioritize
 processing incoming data.

 This should work on any Arduino that has an ATMega328 controller
 (Uno, Pro Mini, many others).
*/

/*
 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 124

/*
 The Arduino pin that is connected to the
 /RE and DE pins on the RS-485 transceiver.
*/
#define TXENABLE_PIN 2 

/*#define DCSBIOS_IRQ_SERIAL*/

#include "DcsBios.h"

#include <timer.h>     //Mine is called timer.h not Timer.h hence the renaming

//Added initial positions to have a stable test setup
int DCS_valueDial_1=0; // MAIN/1 0-1KHZ DIAL/ARK-9 TUNE
int DCS_valueDial_2=0; // MAIN/1 10KHZ DIAL
int DCS_valueDial_3=1; // MAIN/1 100KHZ DIAL
int DCS_valueDial_4=0; // BACK/1 0-1KHZ DIAL/ARK-9 TUNE
int DCS_valueDial_5=0; // BACK/1 10KHZ DIAL
int DCS_valueDial_6=1; // BACK/1 100KHZ DIAL

/* paste code snippets from the reference documentation here */


/*/////////////////////////////////* Switches and toggles*/

const byte arc9ModePins[4] = {6, 7, 8, 9};
DcsBios::SwitchMultiPos arc9Mode("ARC9_MODE", arc9ModePins, 4);

const byte arc9MainBackupPins[2] = {3, 4};
DcsBios::SwitchMultiPos arc9MainBackup("ARC9_MAIN_BACKUP", arc9MainBackupPins, 2);

const byte arc9TlfTlgPins[2] = {14,15};
DcsBios::SwitchMultiPos arc9TlfTlg("ARC9_TLF_TLG", arc9TlfTlgPins, 2);

const byte arc9LoopPins[1] = {16};                                            //This appears to to have been a 3 position originally
DcsBios::SwitchMultiPos arc9Loop("ARC_9_LOOP", arc9LoopPins, 1);

/////////////////////////////////////////////


void onArc9MainTuneChange(unsigned int newValue) {
 DCS_valueDial_1 = newValue;
}
DcsBios::IntegerBuffer arc9MainTuneBuffer(0x2672, 0xffff, 0, onArc9MainTuneChange);

void onArcMain10khzChange(unsigned int newValue) {
 DCS_valueDial_2 = newValue;
}
DcsBios::IntegerBuffer arcMain10khzBuffer(0x26a2, 0x00f0, 4, onArcMain10khzChange);

void onArcMain100khzChange(unsigned int newValue) {
 DCS_valueDial_3 = newValue;
}
DcsBios::IntegerBuffer arcMain100khzBuffer(0x26a2, 0x000f, 0, onArcMain100khzChange);

void onArc9BckTuneChange(unsigned int newValue) {
   DCS_valueDial_4 = newValue;
}
DcsBios::IntegerBuffer arc9BckTuneBuffer(0x2670, 0xffff, 0, onArc9BckTuneChange);

void onArcBck10khzChange(unsigned int newValue) {
  DCS_valueDial_5 = newValue;
}
DcsBios::IntegerBuffer arcBck10khzBuffer(0x26a0, 0xf000, 12, onArcBck10khzChange);

void onArcBck100khzChange(unsigned int newValue) {
   DCS_valueDial_6 = newValue;
}
DcsBios::IntegerBuffer arcBck100khzBuffer(0x26a0, 0x0f00, 8, onArcBck100khzChange);



void setup() {
 DcsBios::setup();

 //ARK-9 DIAL_1 MAIN INPUTS 0-9.5/ -10-+20
 DDRC = B00000000; // set PIND (digital 37-30) as inputs
 PORTC = B11111111; // Sets (digital 37-30) with internal pull up
 //ARK-9 DIAL_2 MAIN inputs- 0-90 kHz Main
 DDRD = B00000000; // set PIND (digital 38+21-18) as inputs
 PORTD = B11111111; // Sets (digital 38+21-18) with internal pull up
 //ARK-9 DIAL_3 MAIN inputs- 100 kHz Main
 DDRA = B00000000; // set PINA (digital 29-22) as inputs
 PORTA = B11111111; // Sets (digital 29-22) with internal pull up
 //ARK-9 DIAL_4 BACK INPUTS 0-9.5/ -10-+20
 DDRB = B00000000; // set PIND (digital 37-30) as inputs
 PORTB = B11111111; // Sets (digital 37-30) with internal pull up
 //ARK-9 DIAL_5 BACK inputs- 0-90 kHz Main
 DDRL = B00000000; // set PIND (digital 38+21-18) as inputs
 PORTL = B11111111; // Sets (digital 38+21-18) with internal pull up
 //ARK-9 DIAL_6 BACK inputs- 100 kHz Main
 DDRK = B00000000; // set PINA (digital 29-22) as inputs
 PORTK = B11111111; // Sets (digital 29-22) with internal pull up
 
}

/////MAIN FREQUENCY TUNE DIAL; DIAL 1 ///////////////////////
int inputDial_1()
{
 int valueDial_1;
 if (PINC == B11111111) {
   valueDial_1 = 0;
 }

 if (PINC == B11111110) {
   valueDial_1 = 1;
 }

 if (PINC == B11101111) {
   valueDial_1 = 2;
 }

 if (PINC == B11101110) {
   valueDial_1 = 3;
 }

 if (PINC == B11111101) {
   valueDial_1 = 4;
 }

 if (PINC == B11111100) {
   valueDial_1 = 5;
 }

 if (PINC == B11101101) {
   valueDial_1 = 6;
 }

 if (PINC == B11101100) {
   valueDial_1 = 7;
 }

 if (PINC == B11110101) {
   valueDial_1 = 8;
 }

 if (PINC == B11110100) {
   valueDial_1 = 9;
 }

 if (PINC == B11100101) {
   valueDial_1 = 10;
 }

 if (PINC == B11100100) {
   valueDial_1 = 11;
 }

 if (PINC == B11111001) {
   valueDial_1 = 12;
 }

 if (PINC == B11111000) {
   valueDial_1 = 13;
 }

 if (PINC == B11101001) {
   valueDial_1 = 14;
 }

 if (PINC == B11101000) {
   valueDial_1 = 15;
 }

 if (PINC == B11110001) {
   valueDial_1 = 16;
 }

 if (PINC == B11110000) {
   valueDial_1 = 17;
 }

 if (PINC == B11100001) {
   valueDial_1 = 18;
 }

 if (PINC == B11100000) {
   valueDial_1 = 19;
 }

 return valueDial_1;
}

///// END OF MAIN FREQUENCY TUNER DIAL_1///////////////////

/////MAIN 10KHZ ROTARY DIAL///////////////////////////////////////////////////
//ARK-9 DIAL_2 inputs- 0-90 kHz Main

//DDRB = B00000000; // set PIND digital 53-50,10-13 as inputs
//PORTB = B11111111; // Sets digital 53-50,10-13 with internal pull up
//}

int inputDial_2()
{
 int valueDial_2;
 if (PIND == B11111111) {
   valueDial_2 = 0;
 }

 if (PIND == B11110111) {
   valueDial_2 = 1;
 }

 if (PIND == B11111011) {
   valueDial_2 = 2;
 }

 if (PIND == B11110011) {
   valueDial_2 = 3;
 }

 if (PIND == B01111010) {
   valueDial_2 = 4;
 }

 if (PIND == B01110010) {
   valueDial_2 = 5;
 }

 if (PIND == B01111001) {
   valueDial_2 = 6;
 }

 if (PIND == B01110001) {
   valueDial_2 = 7;
 }

 if (PIND == B01111000) {
   valueDial_2 = 8;
 }

 if (PIND == B01110000) {
   valueDial_2 = 9;
 }

 return valueDial_2;
}
////222222//END OF MAIN 10KHZ ROTARY DIAL_2////////////////

//33333///MAIN 100KHZ  DIAL_3 ///////////////////////
int inputDial_3()
{
 int valueDial_3;
 if (PINA == B11111111) {
   valueDial_3 = 1;
 }

 if (PINA == B11110111) {
   valueDial_3 = 2;
 }

 if (PINA == B11111110) {
   valueDial_3 = 3;
 }

 if (PINA == B11110110) {
   valueDial_3 = 4;
 }

 if (PINA == B11111010) {
   valueDial_3 = 5;
 }

 if (PINA == B11110010) {
   valueDial_3 = 6;
 }

 if (PINA == B11111100) {
   valueDial_3 = 7;
 }

 if (PINA == B11110100) {
   valueDial_3 = 8;
 }

 if (PINA == B11111000) {
   valueDial_3 = 9;
 }

 if (PINA == B11110000) {
   valueDial_3 = 10;
 }

 if (PINA == B11101111) {
   valueDial_3 = 11;
 }

 if (PINA == B11100111) {
   valueDial_3 = 12;
 }

 if (PINA == B11101110) {
   valueDial_3 = 13;
 }

 if (PINA == B11100110) {
   valueDial_3 = 14;
 }

 if (PINA == B11101010) {
   valueDial_3 = 15;
 }

 if (PINA == B11100010) {
   valueDial_3 = 16;
 }

 if (PINA == B11101100) {
   valueDial_3 = 17;
 }

 if (PINA == B11100100) {
   valueDial_3 = 18;
 }

 if (PINA == B11100100) {
   valueDial_3 = 19;
 }

 if (PINA == B11100100) {
   valueDial_3 = 20;
 }

 return valueDial_3;
}

////333333333////END OF MAIN 100KHZ DIAL 3  

/////BACK FREQUENCY TUNE DIAL; DIAL 1 ///////////////////////
int inputDial_4()
{
 int valueDial_4;
 if (PINB == B11111111) {
   valueDial_4 = 0;
 }

 if (PINB == B11111110) {
   valueDial_4 = 1;
 }

 if (PINB == B11101111) {
   valueDial_4 = 2;
 }

 if (PINB == B11101110) {
   valueDial_4 = 3;
 }

 if (PINB == B11111101) {
   valueDial_4 = 4;
 }

 if (PINB == B11111100) {
   valueDial_4 = 5;
 }

 if (PINB == B11101101) {
   valueDial_4 = 6;
 }

 if (PINB == B11101100) {
   valueDial_4 = 7;
 }

 if (PINB == B11110101) {
   valueDial_4 = 8;
 }

 if (PINB == B11110100) {
   valueDial_4 = 9;
 }

 if (PINB == B11100101) {
   valueDial_4 = 10;
 }

 if (PINB == B11100100) {
   valueDial_4 = 11;
 }

 if (PINB == B11111001) {
   valueDial_4 = 12;
 }

 if (PINB == B11111000) {
   valueDial_4 = 13;
 }

 if (PINB == B11101001) {
   valueDial_4 = 14;
 }

 if (PINB == B11101000) {
   valueDial_4 = 15;
 }

 if (PINB == B11110001) {
   valueDial_4 = 16;
 }

 if (PINB == B11110000) {
   valueDial_4 = 17;
 }

 if (PINB == B11100001) {
   valueDial_4 = 18;
 }

 if (PINB == B11100000) {
   valueDial_4 = 19;
 }

 return valueDial_4;
}

///// END OF BACK FREQUENCY TUNER DIAL_1///////////////////

/////BACK 10KHZ ROTARY DIAL 5///////////////////////////////////////////////////
//ARK-9 DIAL_5 inputs- 0-90 kHz BACK


int inputDial_5()
{
 int valueDial_5;
 if (PINL == B11111111) {
   valueDial_5 = 0;
 }

 if (PINL == B11110111) {
   valueDial_5 = 1;
 }

 if (PINL == B11111011) {
   valueDial_5 = 2;
 }

 if (PINL == B11110011) {
   valueDial_5 = 3;
 }

 if (PINL == B11101010) {
   valueDial_5 = 4;
 }

 if (PINL == B11100010) {
   valueDial_5 = 5;
 }

 if (PINL == B11101001) {
   valueDial_5 = 6;
 }

 if (PINL == B11100001) {
   valueDial_5 = 7;
 }

 if (PINL == B11101000) {
   valueDial_5 = 8;
 }

 if (PINL == B11100000) {
   valueDial_5 = 9;
 }

 return valueDial_5;
}
////555555//END OF BACK 10KHZ ROTARY DIAL_5////////////////

//666666///BACK 100KHZ  DIAL_6 ///////////////////////
int inputDial_6()
{
 int valueDial_6;
 if (PINK == B11111111) {
   valueDial_6 = 1;
 }

 if (PINK == B11110111) {
   valueDial_6 = 2;
 }

 if (PINK == B11111110) {
   valueDial_6 = 3;
 }

 if (PINK == B11110110) {
   valueDial_6 = 4;
 }

 if (PINK == B11111010) {
   valueDial_6 = 5;
 }

 if (PINK == B11110010) {
   valueDial_6 = 6;
 }

 if (PINK == B11111100) {
   valueDial_6 = 7;
 }

 if (PINK == B11110100) {
   valueDial_6 = 8;
 }

 if (PINK == B11111000) {
   valueDial_6 = 9;
 }

 if (PINK == B11110000) {
   valueDial_6 = 10;
 }

 if (PINK == B11101111) {
   valueDial_6 = 11;
 }

 if (PINK == B11100111) {
   valueDial_6 = 12;
 }

 if (PINK == B11101110) {
   valueDial_6 = 13;
 }

 if (PINK == B11100110) {
   valueDial_6 = 14;
 }

 if (PINK == B11101010) {
   valueDial_6 = 15;
 }

 if (PINK == B11100010) {
   valueDial_6 = 16;
 }

 if (PINK == B11101100) {
   valueDial_6 = 17;
 }

 if (PINK == B11100100) {
   valueDial_6 = 18;
 }

 if (PINK == B11100100) {
   valueDial_6 = 19;
 }

 if (PINK == B11100100) {
   valueDial_6 = 20;
 }

 return valueDial_6;
}

////666666////END OF BACK 100KHZ DIAL 6  

void loop() {
 DcsBios::loop();

 // Check and adjust 1st dial
 if (DCS_valueDial_1 != inputDial_1()) {
   if ( inputDial_1() == 0) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "0");
   }
   if ( inputDial_1() == 1) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "3200");
   }
   if ( inputDial_1() == 2) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "6400");
   }
   if ( inputDial_1() == 3) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "9600");
   }
   if ( inputDial_1() == 4) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "12800");
   }
   if ( inputDial_1() == 5) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "16000");
   }
   if ( inputDial_1() == 6) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "19200");
   }
   if ( inputDial_1() == 7) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "22400");
   }
   if ( inputDial_1() == 8) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "25600");
   }
   if ( inputDial_1() == 9) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "28800");
   }
   if ( inputDial_1() == 10) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "32000");
   }
   if ( inputDial_1() == 11) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "35200");
   }
   if ( inputDial_1() == 12) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "38400");
   }
   if ( inputDial_1() == 13) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "41600");
   }
   if ( inputDial_1() == 14) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "44800");
   }
   if ( inputDial_1() == 15) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "48000");
   }
   if ( inputDial_1() == 16) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "51200");
   }
   if ( inputDial_1() == 17) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "54400");
   }
   if ( inputDial_1() == 18) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "57600");
   }
   if ( inputDial_1() == 19) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "60800");
   }
 }


 // Check and adjust 2nd dial
 if (DCS_valueDial_2 != inputDial_2()) {
   if ( inputDial_2() == 0) {
     sendDcsBiosMessage("ARC_MAIN_10KHZ", "0");
   }
   if ( inputDial_2() == 1) {
     sendDcsBiosMessage("ARC_MAIN_10KHZ", "1");
   }
   if ( inputDial_2() == 2) {
     sendDcsBiosMessage("ARC_MAIN_10KHZ", "2");
   }
   if ( inputDial_2() == 3) {
     sendDcsBiosMessage("ARC_MAIN_10KHZ", "3");
   }
   if ( inputDial_2() == 4) {
     sendDcsBiosMessage("ARC_MAIN_10KHZ", "4");
   }
   if ( inputDial_2() == 5) {
     sendDcsBiosMessage("ARC_MAIN_10KHZ", "5");
   }
   if ( inputDial_2() == 6) {
     sendDcsBiosMessage("ARC_MAIN_10KHZ", "6");
   }
   if ( inputDial_2() == 7) {
     sendDcsBiosMessage("ARC_MAIN_10KHZ", "7");
   }
   if ( inputDial_2() == 8) {
     sendDcsBiosMessage("ARC_MAIN_10KHZ", "8");
   }
   if ( inputDial_2() == 9) {
     sendDcsBiosMessage("ARC_MAIN_10KHZ", "9");
   }
 }
// Check and adjust 3RD dial
 if (DCS_valueDial_3 != inputDial_3()) {
   if ( inputDial_3() == 3) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "1");
   }
   if ( inputDial_3() == 4) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "2");
   }
   if ( inputDial_3() == 5) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "3");
   }
   if ( inputDial_3() == 6) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "4");
   }
   if ( inputDial_3() == 7) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "5");
   }
   if ( inputDial_3() == 8) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "6");
   }
   if ( inputDial_3() == 9) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "7");
   }
   if ( inputDial_3() == 10) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "8");
   }
   if ( inputDial_3() == 11) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "9");
   }
   if ( inputDial_3() == 12) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "10");
   }
   if ( inputDial_3() == 13) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "11");
   }
   if ( inputDial_3() == 14) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "12");
   }
   if ( inputDial_3() == 15) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "13");
   }
   if ( inputDial_3() == 16) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "14");
   }
   if ( inputDial_3() == 17) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "15");
   }
   if ( inputDial_3() == 18) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "16");
   }
   if ( inputDial_3() == 19) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "17");
   }
   if ( inputDial_3() == 20) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "18");
   }
   if ( inputDial_3() == 1) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "19");
   }
   if ( inputDial_3() == 2) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "20");
   }
 }
// Check and adjust 4TH dial
 if (DCS_valueDial_4 != inputDial_4()) {
   if ( inputDial_4() == 0) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "0");
   }
   if ( inputDial_4() == 1) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "3200");
   }
   if ( inputDial_4() == 2) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "6400");
   }
   if ( inputDial_4() == 3) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "9600");
   }
   if ( inputDial_4() == 4) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "12800");
   }
   if ( inputDial_4() == 5) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "16000");
   }
   if ( inputDial_4() == 6) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "19200");
   }
   if ( inputDial_4() == 7) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "22400");
   }
   if ( inputDial_4() == 8) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "25600");
   }
   if ( inputDial_4() == 9) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "28800");
   }
   if ( inputDial_4() == 10) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "32000");
   }
   if ( inputDial_4() == 11) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "35200");
   }
   if ( inputDial_4() == 12) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "38400");
   }
   if ( inputDial_4() == 13) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "41600");
   }
   if ( inputDial_4() == 14) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "44800");
   }
   if ( inputDial_4() == 15) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "48000");
   }
   if ( inputDial_4() == 16) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "51200");
   }
   if ( inputDial_4() == 17) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "54400");
   }
   if ( inputDial_4() == 18) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "57600");
   }
   if ( inputDial_4() == 19) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "60800");
   }
 }


 // Check and adjust 5TH dial
 if (DCS_valueDial_5 != inputDial_5()) {
   if ( inputDial_5() == 0) {
     sendDcsBiosMessage("ARC_BCK_10KHZ", "0");
   }
   if ( inputDial_5() == 1) {
     sendDcsBiosMessage("ARC_BCK_10KHZ", "1");
   }
   if ( inputDial_5() == 2) {
     sendDcsBiosMessage("ARC_BCK_10KHZ", "2");
   }
   if ( inputDial_5() == 3) {
     sendDcsBiosMessage("ARC_BCK_10KHZ", "3");
   }
   if ( inputDial_5() == 4) {
     sendDcsBiosMessage("ARC_BCK_10KHZ", "4");
   }
   if ( inputDial_5() == 5) {
     sendDcsBiosMessage("ARC_BCK_10KHZ", "5");
   }
   if ( inputDial_5() == 6) {
     sendDcsBiosMessage("ARC_BCK_10KHZ", "6");
   }
   if ( inputDial_5() == 7) {
     sendDcsBiosMessage("ARC_BCK_10KHZ", "7");
   }
   if ( inputDial_5() == 8) {
     sendDcsBiosMessage("ARC_BCK_10KHZ", "8");
   }
   if ( inputDial_5() == 9) {
     sendDcsBiosMessage("ARC_BCK_10KHZ", "9");
   }
 }
// Check and adjust 6TH dial
 if (DCS_valueDial_6 != inputDial_6()) {
   if ( inputDial_6() == 3) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "1");
   }
   if ( inputDial_6() == 4) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "2");
   }
   if ( inputDial_6() == 5) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "3");
   }
   if ( inputDial_6() == 6) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "4");
   }
   if ( inputDial_6() == 7) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "5");
   }
   if ( inputDial_6() == 8) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "6");
   }
   if ( inputDial_6() == 9) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "7");
   }
   if ( inputDial_6() == 10) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "8");
   }
   if ( inputDial_6() == 11) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "9");
   }
   if ( inputDial_6() == 12) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "10");
   }
   if ( inputDial_6() == 13) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "11");
   }
   if ( inputDial_6() == 14) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "12");
   }
   if ( inputDial_6() == 15) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "13");
   }
   if ( inputDial_6() == 16) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "14");
   }
   if ( inputDial_6() == 17) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "15");
   }
   if ( inputDial_6() == 18) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "16");
   }
   if ( inputDial_6() == 19) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "17");
   }
   if ( inputDial_6() == 20) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "18");
   }
   if ( inputDial_6() == 1) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "19");
   }
   if ( inputDial_6() == 2) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "20");
   }
 }

}

 

If you still can't get it to work then it could be an issue with the ground wire for all the switches, although it sounds a bit strange since it worked via USB.

 

In this code I added what I think is needed to get the timer function to work;

 

/*
 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 124

/*
 The Arduino pin that is connected to the
 /RE and DE pins on the RS-485 transceiver.
*/
#define TXENABLE_PIN 2

#include "DcsBios.h"

/* paste code snippets from the reference documentation here */
#include <timer.h>
Timer tm;                        // Added

int DCS_valueDial_1=0; // MAIN/1 0-1KHZ DIAL/ARK-9 TUNE
int DCS_valueDial_2=0; // MAIN/1 10KHZ DIAL
int DCS_valueDial_3=1; // MAIN/1 100KHZ DIAL
int DCS_valueDial_4=0; // BACK/1 0-1KHZ DIAL/ARK-9 TUNE
int DCS_valueDial_5=0; // BACK/1 10KHZ DIAL
int DCS_valueDial_6=1; // BACK/1 100KHZ DIAL

/* paste code snippets from the reference documentation here */


/*/////////////////////////////////* Switches and toggles*/

const byte arc9ModePins[4] = {6, 7, 8, 9};
DcsBios::SwitchMultiPos arc9Mode("ARC9_MODE", arc9ModePins, 4);

const byte arc9MainBackupPins[2] = {3, 4};
DcsBios::SwitchMultiPos arc9MainBackup("ARC9_MAIN_BACKUP", arc9MainBackupPins, 2);

const byte arc9TlfTlgPins[2] = {14,15};
DcsBios::SwitchMultiPos arc9TlfTlg("ARC9_TLF_TLG", arc9TlfTlgPins, 2);

const byte arc9LoopPins[1] = {16};                                        //This appears to to have been a 3 position originally
DcsBios::SwitchMultiPos arc9Loop("ARC_9_LOOP", arc9LoopPins, 1);

/////////////////////////////////////////////


void onArc9MainTuneChange(unsigned int newValue) {
 DCS_valueDial_1 = newValue;
}
DcsBios::IntegerBuffer arc9MainTuneBuffer(0x2672, 0xffff, 0, onArc9MainTuneChange);

void onArcMain10khzChange(unsigned int newValue) {
 DCS_valueDial_2 = newValue;
}
DcsBios::IntegerBuffer arcMain10khzBuffer(0x26a2, 0x00f0, 4, onArcMain10khzChange);

void onArcMain100khzChange(unsigned int newValue) {
 DCS_valueDial_3 = newValue;
}
DcsBios::IntegerBuffer arcMain100khzBuffer(0x26a2, 0x000f, 0, onArcMain100khzChange);

void onArc9BckTuneChange(unsigned int newValue) {
   DCS_valueDial_4 = newValue;
}
DcsBios::IntegerBuffer arc9BckTuneBuffer(0x2670, 0xffff, 0, onArc9BckTuneChange);

void onArcBck10khzChange(unsigned int newValue) {
  DCS_valueDial_5 = newValue;
}
DcsBios::IntegerBuffer arcBck10khzBuffer(0x26a0, 0xf000, 12, onArcBck10khzChange);

void onArcBck100khzChange(unsigned int newValue) {
   DCS_valueDial_6 = newValue;
}
DcsBios::IntegerBuffer arcBck100khzBuffer(0x26a0, 0x0f00, 8, onArcBck100khzChange);



void setup() {
 DcsBios::setup();

 //ARK-9 DIAL_1 MAIN INPUTS 0-9.5/ -10-+20
 DDRC = B00000000; // set PIND (digital 37-30) as inputs
 PORTC = B11111111; // Sets (digital 37-30) with internal pull up
 //ARK-9 DIAL_2 MAIN inputs- 0-90 kHz Main
 DDRD = B00000000; // set PIND (digital 38+21-18) as inputs
 PORTD = B11111111; // Sets (digital 38+21-18) with internal pull up
 //ARK-9 DIAL_3 MAIN inputs- 100 kHz Main
 DDRA = B00000000; // set PINA (digital 29-22) as inputs
 PORTA = B11111111; // Sets (digital 29-22) with internal pull up
 //ARK-9 DIAL_4 BACK INPUTS 0-9.5/ -10-+20
 DDRB = B00000000; // set PIND (digital 37-30) as inputs
 PORTB = B11111111; // Sets (digital 37-30) with internal pull up
 //ARK-9 DIAL_5 BACK inputs- 0-90 kHz Main
 DDRL = B00000000; // set PIND (digital 38+21-18) as inputs
 PORTL = B11111111; // Sets (digital 38+21-18) with internal pull up
 //ARK-9 DIAL_6 BACK inputs- 100 kHz Main
 DDRK = B00000000; // set PINA (digital 29-22) as inputs
 PORTK = B11111111; // Sets (digital 29-22) with internal pull up

   tm.startTimer(200, setDials);                     // Added
}

/////MAIN FREQUENCY TUNE DIAL; DIAL 1 ///////////////////////
int inputDial_1()
{
 int valueDial_1;
 if (PINC == B11111111) {
   valueDial_1 = 0;
 }

 if (PINC == B11111110) {
   valueDial_1 = 1;
 }

 if (PINC == B11101111) {
   valueDial_1 = 2;
 }

 if (PINC == B11101110) {
   valueDial_1 = 3;
 }

 if (PINC == B11111101) {
   valueDial_1 = 4;
 }

 if (PINC == B11111100) {
   valueDial_1 = 5;
 }

 if (PINC == B11101101) {
   valueDial_1 = 6;
 }

 if (PINC == B11101100) {
   valueDial_1 = 7;
 }

 if (PINC == B11110101) {
   valueDial_1 = 8;
 }

 if (PINC == B11110100) {
   valueDial_1 = 9;
 }

 if (PINC == B11100101) {
   valueDial_1 = 10;
 }

 if (PINC == B11100100) {
   valueDial_1 = 11;
 }

 if (PINC == B11111001) {
   valueDial_1 = 12;
 }

 if (PINC == B11111000) {
   valueDial_1 = 13;
 }

 if (PINC == B11101001) {
   valueDial_1 = 14;
 }

 if (PINC == B11101000) {
   valueDial_1 = 15;
 }

 if (PINC == B11110001) {
   valueDial_1 = 16;
 }

 if (PINC == B11110000) {
   valueDial_1 = 17;
 }

 if (PINC == B11100001) {
   valueDial_1 = 18;
 }

 if (PINC == B11100000) {
   valueDial_1 = 19;
 }

 return valueDial_1;
}

///// END OF MAIN FREQUENCY TUNER DIAL_1///////////////////

/////MAIN 10KHZ ROTARY DIAL///////////////////////////////////////////////////
//ARK-9 DIAL_2 inputs- 0-90 kHz Main

//DDRB = B00000000; // set PIND digital 53-50,10-13 as inputs
//PORTB = B11111111; // Sets digital 53-50,10-13 with internal pull up
//}

int inputDial_2()
{
 int valueDial_2;
 if (PIND == B11111111) {
   valueDial_2 = 0;
 }

 if (PIND == B11110111) {
   valueDial_2 = 1;
 }

 if (PIND == B11111011) {
   valueDial_2 = 2;
 }

 if (PIND == B11110011) {
   valueDial_2 = 3;
 }

 if (PIND == B01111010) {
   valueDial_2 = 4;
 }

 if (PIND == B01110010) {
   valueDial_2 = 5;
 }

 if (PIND == B01111001) {
   valueDial_2 = 6;
 }

 if (PIND == B01110001) {
   valueDial_2 = 7;
 }

 if (PIND == B01111000) {
   valueDial_2 = 8;
 }

 if (PIND == B01110000) {
   valueDial_2 = 9;
 }

 return valueDial_2;
}
////222222//END OF MAIN 10KHZ ROTARY DIAL_2////////////////

//33333///MAIN 100KHZ  DIAL_3 ///////////////////////
int inputDial_3()
{
 int valueDial_3;
 if (PINA == B11111111) {
   valueDial_3 = 1;
 }

 if (PINA == B11110111) {
   valueDial_3 = 2;
 }

 if (PINA == B11111110) {
   valueDial_3 = 3;
 }

 if (PINA == B11110110) {
   valueDial_3 = 4;
 }

 if (PINA == B11111010) {
   valueDial_3 = 5;
 }

 if (PINA == B11110010) {
   valueDial_3 = 6;
 }

 if (PINA == B11111100) {
   valueDial_3 = 7;
 }

 if (PINA == B11110100) {
   valueDial_3 = 8;
 }

 if (PINA == B11111000) {
   valueDial_3 = 9;
 }

 if (PINA == B11110000) {
   valueDial_3 = 10;
 }

 if (PINA == B11101111) {
   valueDial_3 = 11;
 }

 if (PINA == B11100111) {
   valueDial_3 = 12;
 }

 if (PINA == B11101110) {
   valueDial_3 = 13;
 }

 if (PINA == B11100110) {
   valueDial_3 = 14;
 }

 if (PINA == B11101010) {
   valueDial_3 = 15;
 }

 if (PINA == B11100010) {
   valueDial_3 = 16;
 }

 if (PINA == B11101100) {
   valueDial_3 = 17;
 }

 if (PINA == B11100100) {
   valueDial_3 = 18;
 }

 if (PINA == B11100100) {
   valueDial_3 = 19;
 }

 if (PINA == B11100100) {
   valueDial_3 = 20;
 }

 return valueDial_3;
}

////333333333////END OF MAIN 100KHZ DIAL 3  

/////BACK FREQUENCY TUNE DIAL; DIAL 1 ///////////////////////
int inputDial_4()
{
 int valueDial_4;
 if (PINB == B11111111) {
   valueDial_4 = 0;
 }

 if (PINB == B11111110) {
   valueDial_4 = 1;
 }

 if (PINB == B11101111) {
   valueDial_4 = 2;
 }

 if (PINB == B11101110) {
   valueDial_4 = 3;
 }

 if (PINB == B11111101) {
   valueDial_4 = 4;
 }

 if (PINB == B11111100) {
   valueDial_4 = 5;
 }

 if (PINB == B11101101) {
   valueDial_4 = 6;
 }

 if (PINB == B11101100) {
   valueDial_4 = 7;
 }

 if (PINB == B11110101) {
   valueDial_4 = 8;
 }

 if (PINB == B11110100) {
   valueDial_4 = 9;
 }

 if (PINB == B11100101) {
   valueDial_4 = 10;
 }

 if (PINB == B11100100) {
   valueDial_4 = 11;
 }

 if (PINB == B11111001) {
   valueDial_4 = 12;
 }

 if (PINB == B11111000) {
   valueDial_4 = 13;
 }

 if (PINB == B11101001) {
   valueDial_4 = 14;
 }

 if (PINB == B11101000) {
   valueDial_4 = 15;
 }

 if (PINB == B11110001) {
   valueDial_4 = 16;
 }

 if (PINB == B11110000) {
   valueDial_4 = 17;
 }

 if (PINB == B11100001) {
   valueDial_4 = 18;
 }

 if (PINB == B11100000) {
   valueDial_4 = 19;
 }

 return valueDial_4;
}

///// END OF BACK FREQUENCY TUNER DIAL_1///////////////////

/////BACK 10KHZ ROTARY DIAL 5///////////////////////////////////////////////////
//ARK-9 DIAL_5 inputs- 0-90 kHz BACK


int inputDial_5()
{
 int valueDial_5;
 if (PINL == B11111111) {
   valueDial_5 = 0;
 }

 if (PINL == B11110111) {
   valueDial_5 = 1;
 }

 if (PINL == B11111011) {
   valueDial_5 = 2;
 }

 if (PINL == B11110011) {
   valueDial_5 = 3;
 }

 if (PINL == B11101010) {
   valueDial_5 = 4;
 }

 if (PINL == B11100010) {
   valueDial_5 = 5;
 }

 if (PINL == B11101001) {
   valueDial_5 = 6;
 }

 if (PINL == B11100001) {
   valueDial_5 = 7;
 }

 if (PINL == B11101000) {
   valueDial_5 = 8;
 }

 if (PINL == B11100000) {
   valueDial_5 = 9;
 }

 return valueDial_5;
}
////555555//END OF BACK 10KHZ ROTARY DIAL_5////////////////

//666666///BACK 100KHZ  DIAL_6 ///////////////////////
int inputDial_6()
{
 int valueDial_6;
 if (PINK == B11111111) {
   valueDial_6 = 1;
 }

 if (PINK == B11110111) {
   valueDial_6 = 2;
 }

 if (PINK == B11111110) {
   valueDial_6 = 3;
 }

 if (PINK == B11110110) {
   valueDial_6 = 4;
 }

 if (PINK == B11111010) {
   valueDial_6 = 5;
 }

 if (PINK == B11110010) {
   valueDial_6 = 6;
 }

 if (PINK == B11111100) {
   valueDial_6 = 7;
 }

 if (PINK == B11110100) {
   valueDial_6 = 8;
 }

 if (PINK == B11111000) {
   valueDial_6 = 9;
 }

 if (PINK == B11110000) {
   valueDial_6 = 10;
 }

 if (PINK == B11101111) {
   valueDial_6 = 11;
 }

 if (PINK == B11100111) {
   valueDial_6 = 12;
 }

 if (PINK == B11101110) {
   valueDial_6 = 13;
 }

 if (PINK == B11100110) {
   valueDial_6 = 14;
 }

 if (PINK == B11101010) {
   valueDial_6 = 15;
 }

 if (PINK == B11100010) {
   valueDial_6 = 16;
 }

 if (PINK == B11101100) {
   valueDial_6 = 17;
 }

 if (PINK == B11100100) {
   valueDial_6 = 18;
 }

 if (PINK == B11100100) {
   valueDial_6 = 19;
 }

 if (PINK == B11100100) {
   valueDial_6 = 20;
 }

 return valueDial_6;
 
}

////666666////END OF BACK 100KHZ DIAL 6  

void loop() {
 DcsBios::loop();
   tm.runTimers();                                // Added
}

//Changed setup
void setDials(int timer){
 // Check and adjust 1st dial
 if (DCS_valueDial_1 != inputDial_1()) {
   if ( inputDial_1() == 0) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "0");
   }
   if ( inputDial_1() == 1) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "3200");
   }
   if ( inputDial_1() == 2) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "6400");
   }
   if ( inputDial_1() == 3) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "9600");
   }
   if ( inputDial_1() == 4) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "12800");
   }
   if ( inputDial_1() == 5) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "16000");
   }
   if ( inputDial_1() == 6) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "19200");
   }
   if ( inputDial_1() == 7) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "22400");
   }
   if ( inputDial_1() == 8) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "25600");
   }
   if ( inputDial_1() == 9) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "28800");
   }
   if ( inputDial_1() == 10) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "32000");
   }
   if ( inputDial_1() == 11) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "35200");
   }
   if ( inputDial_1() == 12) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "38400");
   }
   if ( inputDial_1() == 13) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "41600");
   }
   if ( inputDial_1() == 14) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "44800");
   }
   if ( inputDial_1() == 15) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "48000");
   }
   if ( inputDial_1() == 16) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "51200");
   }
   if ( inputDial_1() == 17) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "54400");
   }
   if ( inputDial_1() == 18) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "57600");
   }
   if ( inputDial_1() == 19) {
     sendDcsBiosMessage("ARC9_MAIN_TUNE", "60800");
   }
 }


 // Check and adjust 2nd dial
 if (DCS_valueDial_2 != inputDial_2()) {
   if ( inputDial_2() == 0) {
     sendDcsBiosMessage("ARC_MAIN_10KHZ", "0");
   }
   if ( inputDial_2() == 1) {
     sendDcsBiosMessage("ARC_MAIN_10KHZ", "1");
   }
   if ( inputDial_2() == 2) {
     sendDcsBiosMessage("ARC_MAIN_10KHZ", "2");
   }
   if ( inputDial_2() == 3) {
     sendDcsBiosMessage("ARC_MAIN_10KHZ", "3");
   }
   if ( inputDial_2() == 4) {
     sendDcsBiosMessage("ARC_MAIN_10KHZ", "4");
   }
   if ( inputDial_2() == 5) {
     sendDcsBiosMessage("ARC_MAIN_10KHZ", "5");
   }
   if ( inputDial_2() == 6) {
     sendDcsBiosMessage("ARC_MAIN_10KHZ", "6");
   }
   if ( inputDial_2() == 7) {
     sendDcsBiosMessage("ARC_MAIN_10KHZ", "7");
   }
   if ( inputDial_2() == 8) {
     sendDcsBiosMessage("ARC_MAIN_10KHZ", "8");
   }
   if ( inputDial_2() == 9) {
     sendDcsBiosMessage("ARC_MAIN_10KHZ", "9");
   }
 }
// Check and adjust 3RD dial
 if (DCS_valueDial_3 != inputDial_3()) {
   if ( inputDial_3() == 3) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "1");
   }
   if ( inputDial_3() == 4) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "2");
   }
   if ( inputDial_3() == 5) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "3");
   }
   if ( inputDial_3() == 6) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "4");
   }
   if ( inputDial_3() == 7) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "5");
   }
   if ( inputDial_3() == 8) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "6");
   }
   if ( inputDial_3() == 9) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "7");
   }
   if ( inputDial_3() == 10) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "8");
   }
   if ( inputDial_3() == 11) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "9");
   }
   if ( inputDial_3() == 12) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "10");
   }
   if ( inputDial_3() == 13) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "11");
   }
   if ( inputDial_3() == 14) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "12");
   }
   if ( inputDial_3() == 15) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "13");
   }
   if ( inputDial_3() == 16) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "14");
   }
   if ( inputDial_3() == 17) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "15");
   }
   if ( inputDial_3() == 18) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "16");
   }
   if ( inputDial_3() == 19) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "17");
   }
   if ( inputDial_3() == 20) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "18");
   }
   if ( inputDial_3() == 1) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "19");
   }
   if ( inputDial_3() == 2) {
     sendDcsBiosMessage("ARC_MAIN_100KHZ", "20");
   }
 }
// Check and adjust 4TH dial
 if (DCS_valueDial_4 != inputDial_4()) {
   if ( inputDial_4() == 0) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "0");
   }
   if ( inputDial_4() == 1) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "3200");
   }
   if ( inputDial_4() == 2) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "6400");
   }
   if ( inputDial_4() == 3) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "9600");
   }
   if ( inputDial_4() == 4) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "12800");
   }
   if ( inputDial_4() == 5) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "16000");
   }
   if ( inputDial_4() == 6) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "19200");
   }
   if ( inputDial_4() == 7) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "22400");
   }
   if ( inputDial_4() == 8) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "25600");
   }
   if ( inputDial_4() == 9) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "28800");
   }
   if ( inputDial_4() == 10) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "32000");
   }
   if ( inputDial_4() == 11) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "35200");
   }
   if ( inputDial_4() == 12) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "38400");
   }
   if ( inputDial_4() == 13) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "41600");
   }
   if ( inputDial_4() == 14) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "44800");
   }
   if ( inputDial_4() == 15) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "48000");
   }
   if ( inputDial_4() == 16) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "51200");
   }
   if ( inputDial_4() == 17) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "54400");
   }
   if ( inputDial_4() == 18) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "57600");
   }
   if ( inputDial_4() == 19) {
     sendDcsBiosMessage("ARC9_BCK_TUNE", "60800");
   }
 }


 // Check and adjust 5TH dial
 if (DCS_valueDial_5 != inputDial_5()) {
   if ( inputDial_5() == 0) {
     sendDcsBiosMessage("ARC_BCK_10KHZ", "0");
   }
   if ( inputDial_5() == 1) {
     sendDcsBiosMessage("ARC_BCK_10KHZ", "1");
   }
   if ( inputDial_5() == 2) {
     sendDcsBiosMessage("ARC_BCK_10KHZ", "2");
   }
   if ( inputDial_5() == 3) {
     sendDcsBiosMessage("ARC_BCK_10KHZ", "3");
   }
   if ( inputDial_5() == 4) {
     sendDcsBiosMessage("ARC_BCK_10KHZ", "4");
   }
   if ( inputDial_5() == 5) {
     sendDcsBiosMessage("ARC_BCK_10KHZ", "5");
   }
   if ( inputDial_5() == 6) {
     sendDcsBiosMessage("ARC_BCK_10KHZ", "6");
   }
   if ( inputDial_5() == 7) {
     sendDcsBiosMessage("ARC_BCK_10KHZ", "7");
   }
   if ( inputDial_5() == 8) {
     sendDcsBiosMessage("ARC_BCK_10KHZ", "8");
   }
   if ( inputDial_5() == 9) {
     sendDcsBiosMessage("ARC_BCK_10KHZ", "9");
   }
 }
// Check and adjust 6TH dial
 if (DCS_valueDial_6 != inputDial_6()) {
   if ( inputDial_6() == 3) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "1");
   }
   if ( inputDial_6() == 4) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "2");
   }
   if ( inputDial_6() == 5) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "3");
   }
   if ( inputDial_6() == 6) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "4");
   }
   if ( inputDial_6() == 7) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "5");
   }
   if ( inputDial_6() == 8) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "6");
   }
   if ( inputDial_6() == 9) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "7");
   }
   if ( inputDial_6() == 10) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "8");
   }
   if ( inputDial_6() == 11) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "9");
   }
   if ( inputDial_6() == 12) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "10");
   }
   if ( inputDial_6() == 13) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "11");
   }
   if ( inputDial_6() == 14) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "12");
   }
   if ( inputDial_6() == 15) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "13");
   }
   if ( inputDial_6() == 16) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "14");
   }
   if ( inputDial_6() == 17) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "15");
   }
   if ( inputDial_6() == 18) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "16");
   }
   if ( inputDial_6() == 19) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "17");
   }
   if ( inputDial_6() == 20) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "18");
   }
   if ( inputDial_6() == 1) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "19");
   }
   if ( inputDial_6() == 2) {
     sendDcsBiosMessage("ARC_BCK_100KHZ", "20");
   }
 }

}

 

Cheers

Hans

Link to comment
Share on other sites

ARK-9/15 Amended (improved!) Sketch by HanSolo

 

Hey Hans,

 

Once again your kindness astonishes me! I have yet to test it, it’s still early and I saw your reply late. Thank you, I will give it a go this morning.

 

Regarding timer.h, the sketch worked over USB without it, and I had only just put in the library include before I sent it here. I should have read a bit more about it!

 

I used a stripped down version of the old code to make a sketch for another panel, a 20 position channel/frequency dialler. It too uses 5 mechanical switches to output binary codes. Analogue systems before silicon became the norm. I love this old stuff, and getting it to talk to digital PCs.

 

The next few panels are all basic on-off or on-off-on switches and variants, more simple than challenging, but I have one more Soviet era unit to decipher.

 

Hopefully ED/DCS will deliver the Mi24 sooner rather than later. Then I hope some DCSBIOS whizzard will do the code for it! Very excited.

 

Thank you once again, and I look forward to talking to you again, (no doubt...).

 

How is your own pit progressing? Is it complete? (Are they ever. :music_whistling:)

 

Mole

SCAN Intel Core i9 10850K "Comet Lake", 32GB DDR4, 10GB NVIDIA RTX 3080, HP Reverb G2

Custom Mi-24 pit with magnetic braked cyclic and collective. See it here: Molevitch Mi-24 Pit.

 

[sIGPIC][/sIGPIC] www.blacksharkden.com

bsd sig 2021.jpg

Link to comment
Share on other sites

Attn. HanSolo: Timer issue.

 

Hi Hans,

 

Please ignore the PM I sent you. I found a new Timer library which works now, so all good. The ARK-9/15 is now fully functional on the RS485 network.

 

Thank you once again.

 

I feel I should start a new thread about my Mi-24 pit now. It has changed a lot with many new features, some probably worth sharing, or at least, showing off....

 

Thanks as always,

 

Mole

SCAN Intel Core i9 10850K "Comet Lake", 32GB DDR4, 10GB NVIDIA RTX 3080, HP Reverb G2

Custom Mi-24 pit with magnetic braked cyclic and collective. See it here: Molevitch Mi-24 Pit.

 

[sIGPIC][/sIGPIC] www.blacksharkden.com

bsd sig 2021.jpg

Link to comment
Share on other sites

Outstanding mole.

 

Yeah sorry for late reply. Been quite busy lately. Just replied to your PM, sorry for the delay.

 

And no my pit has run to a grinding halt at the moment, but I hope to get a little done during winter :cry:

 

Have a great weekend.

 

Cheers

Hans

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...