Jump to content

Recommended Posts

Posted

Hi all

I have elected to use a Mega to serve all six IFF BCD wheels, and they are working fine.

However I want to add the remaining toggle switches on the IFF panel to the Mega, a total of seven 3 position toggles and one 2 position. I can successfully add four of the eight, however once I add a fifth it seems to make the sketch not work in game. All the switches work fine if you comment out the BCD switches, so on their own all eight toggle switches function correctly. 

However you can only add four to the sketch before it falls over. It doesn't matter which, it's predicated on the number of switches rather than a particular one or ones.

I have made sure I only use pins 3 though 7 and 22 through 53 for everything, and nothing else is connected to it. At the moment testing is via USB, I have not connected via RS485 yet. The sketch I have used is below. Is there any reason why there is an apparent limit to the number of switches? Is there a way to write the sketch differently to make them work?


#define DCSBIOS_IRQ_SERIAL

//#define DCSBIOS_RS485_SLAVE 75
//#define TXENABLE_PIN 2


#include <DcsBios.h>
#include <Wire.h>
#include <SPI.h>


void setup()   {                
   {

// Thumbwheel Code
//Mode-1 Wheel 1 
DcsBios::BcdWheel iffMode1Wheel1("IFF_MODE1_WHEEL1", 53, 52, 50);

//Mode-1 Wheel 2 
DcsBios::BcdWheel iffMode1Wheel2("IFF_MODE1_WHEEL2", 47, 49, 51);
 
//Mode-3A Wheel 1 
DcsBios::BcdWheel iffMode3aWheel1("IFF_MODE3A_WHEEL1", 35, 33, 31);
 
//Mode-3A Wheel 2 
DcsBios::BcdWheel iffMode3aWheel2("IFF_MODE3A_WHEEL2", 29, 27, 25);
 
//Mode-3A Wheel 3 
DcsBios::BcdWheel iffMode3aWheel3("IFF_MODE3A_WHEEL3", 23, 37, 39);
 
//Mode-3A Wheel 4 
DcsBios::BcdWheel iffMode3aWheel4("IFF_MODE3A_WHEEL4", 41, 43, 45);

DcsBios::Switch2Pos iffOnOut("IFF_ON_OUT", 48);

DcsBios::Switch3Pos iffMicIdent("IFF_MIC_IDENT", 24, 22);

DcsBios::Switch3Pos iffOutAudioLight("IFF_OUT_AUDIO_LIGHT", 44, 46);

//DcsBios::Switch3Pos iffTestM1("IFF_TEST_M1", 42, 40);

DcsBios::Switch3Pos iffRadtest("IFF_RADTEST", 26, 28);

//DcsBios::Switch3Pos iffTestM4("IFF_TEST_M4", 32, 30);

//DcsBios::Switch3Pos iffTestM2("IFF_TEST_M2", 7, 36);

//DcsBios::Switch3Pos iffTestM3("IFF_TEST_M3", 38, 34);  
  
}
DcsBios::setup();
}



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

Cheers

Les

Posted

Thanks for that, just tried it and unfortunately the same

As the toggle switches are large ones with screw terminals I can route the extra ones to other nanos, it just won't be as neat; the biggest hit will really be to my OCD. It's academic now, but it would be interesting to know why the limit is there 

cheers

 

Les

Posted

OK, so it looks like you're only able to run 10 named switches?

You say you've tried 6 BCD and 4 toggle, but have you tried any other combinations up to 10? e.g. 5 BCD and 5 toggle, 4 BCD and 6 toggle, etc.?

  • Recently Browsing   0 members

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