Jump to content

HMA's cockpit build


Hansolo

Recommended Posts

DCS-BIOS AN/ARC-164 with 7-segments over RS485

 

Thanks a lot GSS Rain. I have gotten a little futher

 

 

Got the PCB's for the 7-segments of a senior member on Viperpits/Flying Falcon. Works great with these;

https://www.ebay.com/itm/1-Lot-of-25-Pieces-Avago-HDSP-U503-LED/291589746309?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2060353.m2749.l2649

 

Currently the code for the swiches of the AN/ARC-164 compares to the actual in DCS and then makes a command. I think I will start working on 'just' making them as they reacts in rest of DCS-BIOS i.e. send a command when the switch changes and be done with that. Should clear up the code somewhat.

 

The DISPLAY TEST won't work since the original ones are 16-segments. I'll see f I can dig some of those up. Code for the 7-segments are borrowed from Warhog :-)

 

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

/*
 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 <LedControl.h> 

LedControl lc=LedControl(30,31,32,1); //This creates an instance of a single controller named "lc"
/*
The sequence of pins used above are in the following order... LedControl(DIN,CLK,LOAD,# OF IC's) 
pin 30 is connected to the DataIn 
pin 32 is connected to the CLK 
pin 31 is connected to LOAD
the last number...(1) is for how many MAX7219 we have daisy chained.
*/
#include <timer.h>

Timer tm;

// set pin numbers:
const int Value_0 = 54;
const int Value_1 = 55;
const int Value_2 = 56;
const int Value_3 = 57;
const int Value_4 = 58;
const int Value_5 = 59;
const int Value_6 = 60;
const int Value_7 = 61;
const int Value_8 = 62;
const int Value_9 = 63;
const int Main = 44; //Function dial
const int Both = 45; //Function dial
const int Adf = 46; //Function dial
const int Squelch = 43; //Squelch

const int Selector_1 = 3; // 100Mhz
const int Selector_2 = 4; // 10Mhz
const int Selector_3 = 5; // 1MHZ
const int Selector_4 = 6; // 0.1 MHZ
const int Selector_5 = 7; // 0.25 MHZ
const int Selector_6 = 8; //Tone
const int Selector_7 = 9; //Zero
const int Selector_8 = 10; //Test
const int Selector_9 = 11; //Status
const int Selector_10 = 12; //Frequency Mode Dial MNL/PRESET/GRD

//Variables1
int DCS_Preset = 0; //Initial value set for 1
int DCS_100mhz = 0; //Initial value set for 3
int DCS_10mhz = 0; //Initial value set for 0
int DCS_1mhz = 0; //Initial value set for 0
int DCS_0_1mhz = 0; //Initial value set for 0
int DCS_0_25mhz = 0; //Initial value set for 0
int DCS_Tone = 1; // set to off
int DCS_Zero = 0; // set to off
int DCS_Test = 0; // set to off
int DCS_Status = 0; // set to off
int DCS_Mode = 0; // set to off
int DCS_Function = 0; // set to off
int DCS_Squelch = 0; // set to off

int Delay = 10; //Delay before reading

/* paste code snippets from the reference documentation here */
//UHF Prsets
void onUhfPresetSelChange(unsigned int newValue) {
   DCS_Preset = newValue;
}
DcsBios::IntegerBuffer uhfPresetSelBuffer(0x1168, 0xf800, 11, onUhfPresetSelChange);

// UHF 100mhz selector
void onUhf100mhzSelChange(unsigned int newValue) {
   DCS_100mhz = newValue;
}
DcsBios::IntegerBuffer uhf100mhzSelBuffer(0x1170, 0x0300, 8, onUhf100mhzSelChange);

// UHF 10mhz selector
void onUhf10mhzSelChange(unsigned int newValue) {
   DCS_10mhz = newValue;
}
DcsBios::IntegerBuffer uhf10mhzSelBuffer(0x1170, 0x3c00, 10, onUhf10mhzSelChange);

//uhf 1 mhz SELECTOR
void onUhf1mhzSelChange(unsigned int newValue) {
   DCS_1mhz = newValue;
}
DcsBios::IntegerBuffer uhf1mhzSelBuffer(0x1178, 0x0f00, 8, onUhf1mhzSelChange);

//UHF 0.1mhz selector
void onUhfPoint1mhzSelChange(unsigned int newValue) {
   DCS_0_1mhz = newValue;
}
DcsBios::IntegerBuffer uhfPoint1mhzSelBuffer(0x1178, 0xf000, 12, onUhfPoint1mhzSelChange);

//UHF 0.25mhz selector
void onUhfPoint25SelChange(unsigned int newValue) {
   DCS_0_25mhz = newValue;
}
DcsBios::IntegerBuffer uhfPoint25SelBuffer(0x1170, 0xc000, 14, onUhfPoint25SelChange);

//UHF L0ad
DcsBios::Switch2Pos uhfLoad("UHF_LOAD", 21);

//UHF Tone
void onUhfTToneChange(unsigned int newValue) {
   DCS_Tone = newValue;
}
DcsBios::IntegerBuffer uhfTToneBuffer(0x117c, 0x0030, 4, onUhfTToneChange);

//UHF Test
void onUhfTestChange(unsigned int newValue) {
   DCS_Test = newValue;
}
DcsBios::IntegerBuffer uhfTestBuffer(0x117c, 0x0080, 7, onUhfTestChange);

//UHF Status
void onUhfStatusChange(unsigned int newValue) {
   DCS_Status = newValue;
}
DcsBios::IntegerBuffer uhfStatusBuffer(0x117c, 0x0100, 8, onUhfStatusChange);

//UHF Mode
void onUhfModeChange(unsigned int newValue) {
   DCS_Mode = newValue;
}
DcsBios::IntegerBuffer uhfModeBuffer(0x117c, 0x0003, 0, onUhfModeChange);

//UHF Function
void onUhfFunctionChange(unsigned int newValue) {
   DCS_Function = newValue;
}
DcsBios::IntegerBuffer uhfFunctionBuffer(0x117c, 0x000c, 2, onUhfFunctionChange);

//UHF Volumen
DcsBios::Potentiometer uhfVol("UHF_VOL", A15);

//UHF Squelch
void onUhfSquelchChange(unsigned int newValue) {
   DCS_Squelch = newValue;
}
DcsBios::IntegerBuffer uhfSquelchBuffer(0x117c, 0x0040, 6, onUhfSquelchChange);

//UHF Frequency display
void onUhfFrequencyChange(char* newValue) {
  lc.setChar(0,0,newValue[0],false);
  lc.setChar(0,1,newValue[1],false);
 if ( Function_selector() == 0){
  lc.setChar(0,2,newValue[2],false); // if radio is off then don't write decimal point
 }
 else {
  lc.setChar(0,2,newValue[2],true); // if radio is ON then write decimal point 
 }
  
  lc.setChar(0,3,newValue[4],false);
  lc.setChar(0,4,newValue[5],false);
  lc.setChar(0,5,newValue[6],false);
}
DcsBios::StringBuffer<7> uhfFrequencyBuffer(0x1180, onUhfFrequencyChange);

//UHF preset display
void onUhfPresetChange(char* newValue) {
  lc.setChar(0,6,newValue[0],false);
  lc.setChar(0,7,newValue[1],false);
}
DcsBios::StringBuffer<2> uhfPresetBuffer(0x1188, onUhfPresetChange);


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

//This initializes the MAX7219 and gets it ready of use:
 lc.shutdown(0,false); //turn on the display
 lc.setIntensity(0,10);//set the brightness 
 lc.clearDisplay(0); //clear the display 

//The following series of "lc.setChar" commands are used to display the number 8 in each digit.  This allows us to see each that LED segment is actually working.
 lc.setChar(0,0,'8',false);// The first number...0,  means there are no other MAX7219's connected to the one we are using. 
 lc.setChar(0,1,'8',false);// The second number...1, indicates the digit you are sending data too...digit numbering starts at 0. 
 lc.setChar(0,2,'8',false);//  The third number in single quotes is the character thats displayed
 lc.setChar(0,3,'8',false);// The statement... true/false is to turn on or off the decimal point (dp) for that particular digit. 
 lc.setChar(0,4,'8',false);
 lc.setChar(0,5,'8',false);
 lc.setChar(0,6,'8',false);
 lc.setChar(0,7,'8',false);

 //Preset inputs
 DDRA = B00000000; // set PINA (digital 29-22) as inputs
 PORTA = B11111111; // Sets (digital 29-22) with internal pull up

 tm.startTimer(300, setUHF);
//Inputs
 pinMode(Value_0, INPUT_PULLUP);
 pinMode(Value_1, INPUT_PULLUP);
 pinMode(Value_2, INPUT_PULLUP);
 pinMode(Value_3, INPUT_PULLUP);
 pinMode(Value_4, INPUT_PULLUP);
 pinMode(Value_5, INPUT_PULLUP);
 pinMode(Value_6, INPUT_PULLUP);
 pinMode(Value_7, INPUT_PULLUP);
 pinMode(Value_8, INPUT_PULLUP);
 pinMode(Value_9, INPUT_PULLUP);
 pinMode(Main, INPUT_PULLUP);
 pinMode(Both, INPUT_PULLUP);
 pinMode(Adf, INPUT_PULLUP);
 pinMode(Squelch, INPUT_PULLUP);

 pinMode(Selector_1, OUTPUT);
 pinMode(Selector_2, OUTPUT);
 pinMode(Selector_3, OUTPUT);
 pinMode(Selector_4, OUTPUT);
 pinMode(Selector_5, OUTPUT);
 pinMode(Selector_6, OUTPUT);
 pinMode(Selector_7, OUTPUT);
 pinMode(Selector_8, OUTPUT);
 pinMode(Selector_9, OUTPUT);
 pinMode(Selector_10, OUTPUT);

 digitalWrite(Selector_1, HIGH);
 digitalWrite(Selector_2, HIGH);
 digitalWrite(Selector_3, HIGH);
 digitalWrite(Selector_4, HIGH);
 digitalWrite(Selector_5, HIGH);
 digitalWrite(Selector_6, HIGH);
 digitalWrite(Selector_7, HIGH);
 digitalWrite(Selector_8, HIGH);
 digitalWrite(Selector_9, HIGH);
 digitalWrite(Selector_10, HIGH);
}

int Preset() // Preset selector switch
{
 int valuePreset;
 if (PINA == B11111110) {
   valuePreset = 0;
 }
 if (PINA == B11111100) {
   valuePreset = 1;
 }
 if (PINA == B11111101) {
   valuePreset = 2;
 }
 if (PINA == B11111001) {
   valuePreset = 3;
 }
 if (PINA == B11111000) {
   valuePreset = 4;
 }
 if (PINA == B11111010) {
   valuePreset = 5;
 }
 if (PINA == B11111011) {
   valuePreset = 6;
 }
 if (PINA == B11110011) {
   valuePreset = 7;
 }
 if (PINA == B11110010) {
   valuePreset = 8;
 }
 if (PINA == B11110000) {
   valuePreset = 9;
 }
 if (PINA == B11110001) {
   valuePreset = 10;
 }
 if (PINA == B11110101) {
   valuePreset = 11;
 }
 if (PINA == B11110100) {
   valuePreset = 12;
 }
 if (PINA == B11110110) {
   valuePreset = 13;
 }
 if (PINA == B11110111) {
   valuePreset = 14;
 }
 if (PINA == B11100111) {
   valuePreset = 15;
 }
 if (PINA == B11100110) {
   valuePreset = 16;
 }
 if (PINA == B11100100) {
   valuePreset = 17;
 }
 if (PINA == B11100101) {
   valuePreset = 18;
 }
 if (PINA == B11100001) {
   valuePreset = 19;
 }
 return valuePreset;
}

int First_selector() //Check 1st selector
{
 int value_Selector_1;
 digitalWrite(Selector_1, LOW);
 delay(Delay);

 if (digitalRead(Value_1) == LOW) {
   value_Selector_1 = 0;
 }
 if (digitalRead(Value_2) == LOW) {
   value_Selector_1 = 1;
 }
 if (digitalRead(Value_3) == LOW) {
   value_Selector_1 = 2;
 }
 digitalWrite(Selector_1, HIGH);
 delay(Delay);
 return value_Selector_1;
}

int Second_selector() //Check 2nd selector
{
 int value_Selector_2;
 digitalWrite(Selector_2, LOW);
 delay(Delay);

 if (digitalRead(Value_0) == LOW) {
   value_Selector_2 = 0;
 }
 if (digitalRead(Value_1) == LOW) {
   value_Selector_2 = 1;
 }
 if (digitalRead(Value_2) == LOW) {
   value_Selector_2 = 2;
 }
 if (digitalRead(Value_3) == LOW) {
   value_Selector_2 = 3;
 }
 if (digitalRead(Value_4) == LOW) {
   value_Selector_2 = 4;
 }
 if (digitalRead(Value_5) == LOW) {
   value_Selector_2 = 5;
 }
 if (digitalRead(Value_6) == LOW) {
   value_Selector_2 = 6;
 }
 if (digitalRead(Value_7) == LOW) {
   value_Selector_2 = 7;
 }
 if (digitalRead(Value_8) == LOW) {
   value_Selector_2 = 8;
 }
 if (digitalRead(Value_9) == LOW) {
   value_Selector_2 = 9;
 }
 digitalWrite(Selector_2, HIGH);
 delay(Delay);
 return value_Selector_2;
}

int Third_selector() //Check 3rd selector
{
 int value_Selector_3;
 digitalWrite(Selector_3, LOW);
 delay(Delay);

 if (digitalRead(Value_0) == LOW) {
   value_Selector_3 = 0;
 }
 if (digitalRead(Value_1) == LOW) {
   value_Selector_3 = 1;
 }
 if (digitalRead(Value_2) == LOW) {
   value_Selector_3 = 2;
 }
 if (digitalRead(Value_3) == LOW) {
   value_Selector_3 = 3;
 }
 if (digitalRead(Value_4) == LOW) {
   value_Selector_3 = 4;
 }
 if (digitalRead(Value_5) == LOW) {
   value_Selector_3 = 5;
 }
 if (digitalRead(Value_6) == LOW) {
   value_Selector_3 = 6;
 }
 if (digitalRead(Value_7) == LOW) {
   value_Selector_3 = 7;
 }
 if (digitalRead(Value_8) == LOW) {
   value_Selector_3 = 8;
 }
 if (digitalRead(Value_9) == LOW) {
   value_Selector_3 = 9;
 }
 digitalWrite(Selector_3, HIGH);
 delay(Delay);
 return value_Selector_3;
}

int Fourth_selector() //Check 4th selector
{
 int value_Selector_4;
 digitalWrite(Selector_4, LOW);
 delay(Delay);

 if (digitalRead(Value_0) == LOW) {
   value_Selector_4 = 0;
 }
 if (digitalRead(Value_1) == LOW) {
   value_Selector_4 = 1;
 }
 if (digitalRead(Value_2) == LOW) {
   value_Selector_4 = 2;
 }
 if (digitalRead(Value_3) == LOW) {
   value_Selector_4 = 3;
 }
 if (digitalRead(Value_4) == LOW) {
   value_Selector_4 = 4;
 }
 if (digitalRead(Value_5) == LOW) {
   value_Selector_4 = 5;
 }
 if (digitalRead(Value_6) == LOW) {
   value_Selector_4 = 6;
 }
 if (digitalRead(Value_7) == LOW) {
   value_Selector_4 = 7;
 }
 if (digitalRead(Value_8) == LOW) {
   value_Selector_4 = 8;
 }
 if (digitalRead(Value_9) == LOW) {
   value_Selector_4 = 9;
 }
 digitalWrite(Selector_4, HIGH);
 delay(Delay);
 return value_Selector_4;
}

int Fifth_selector() //Check 5th selector
{
 int value_Selector_5;
 digitalWrite(Selector_5, LOW);
 delay(Delay);

 if (digitalRead(Value_0) == LOW) {
   value_Selector_5 = 0;
 }
 if (digitalRead(Value_1) == LOW) {
   value_Selector_5 = 1;
 }
 if (digitalRead(Value_2) == LOW) {
   value_Selector_5 = 2;
 }
 if (digitalRead(Value_3) == LOW) {
   value_Selector_5 = 3;
 }
 digitalWrite(Selector_5, HIGH);
 delay(Delay);
 return value_Selector_5;
}

int Sixth_selector() //Check Tone
{
 int value_Selector_6;
 digitalWrite(Selector_6, LOW);
 delay(Delay);

 if (digitalRead(Value_0) == LOW) {
   value_Selector_6 = 2;
 }
 if (digitalRead(Value_1) == LOW) {
   value_Selector_6 = 0;
 }
 if (digitalRead(Value_0) == HIGH && digitalRead(Value_1) == HIGH) {
   value_Selector_6 = 1;
 }
 digitalWrite(Selector_6, HIGH);
 delay(Delay);
 return value_Selector_6;
}

int Eight_selector() //Check Test
{
 int value_Selector_8;
 digitalWrite(Selector_8, LOW);
 delay(Delay);

 if (digitalRead(Value_0) == LOW) {
   value_Selector_8 = 1;
 }
 if (digitalRead(Value_0) == HIGH) {
   value_Selector_8 = 0;
 }
 digitalWrite(Selector_8, HIGH);
 delay(Delay);
 return value_Selector_8;
}

int Ninth_selector() //Check Status
{
 int value_Selector_9;
 digitalWrite(Selector_9, LOW);
 delay(Delay);

 if (digitalRead(Value_0) == LOW) {
   value_Selector_9 = 1;
 }
 if (digitalRead(Value_0) == HIGH) {
   value_Selector_9 = 0;
 }
 digitalWrite(Selector_9, HIGH);
 delay(Delay);
 return value_Selector_9;
}

int Tenth_selector() //Check Status
{
 int value_Selector_10;
 digitalWrite(Selector_10, LOW);
 delay(Delay);

 if (digitalRead(Value_0) == LOW) {
   value_Selector_10 = 2;
 }
 if (digitalRead(Value_1) == LOW) {
   value_Selector_10 = 1;
 }
 if (digitalRead(Value_2) == LOW) {
   value_Selector_10 = 0;
 }
 digitalWrite(Selector_10, HIGH);
 delay(Delay);
 return value_Selector_10;
}

int Function_selector() //Check Status
{
 int value_Function;

 if (digitalRead(Main) == LOW) {
   value_Function = 1;
 }
 else if (digitalRead(Both) == LOW) {
   value_Function = 2;
 }
 else if (digitalRead(Adf) == LOW) {
   value_Function = 3;
 }
 else {
   value_Function = 0;
 }
 return value_Function;
}

int Squelch_selector() //Check Status
{
 int value_Squelch;

 if (digitalRead(Squelch) == LOW) {
   value_Squelch = 0;
 }
 else {
   value_Squelch = 1;
 }
 return value_Squelch;
}


void loop() {
DcsBios::loop();
tm.runTimers();

}

void setUHF(int timer){
// Check and adjust presets
 if (DCS_Preset != Preset()) {
      if ( Preset() == 0){
   sendDcsBiosMessage("UHF_PRESET_SEL", "0");
 }
      if ( Preset() == 1){
   sendDcsBiosMessage("UHF_PRESET_SEL", "1");
 }
      if ( Preset() == 2){
   sendDcsBiosMessage("UHF_PRESET_SEL", "2");
 }
      if ( Preset() == 3){
   sendDcsBiosMessage("UHF_PRESET_SEL", "3");
 }
      if ( Preset() == 4){
   sendDcsBiosMessage("UHF_PRESET_SEL", "4");
 }
      if ( Preset() == 5){
   sendDcsBiosMessage("UHF_PRESET_SEL", "5");
 }
      if ( Preset() == 6){
   sendDcsBiosMessage("UHF_PRESET_SEL", "6");
 }
      if ( Preset() == 7){
   sendDcsBiosMessage("UHF_PRESET_SEL", "7");
 }
      if ( Preset() == 8){
   sendDcsBiosMessage("UHF_PRESET_SEL", "8");
 }
      if ( Preset() == 9){
   sendDcsBiosMessage("UHF_PRESET_SEL", "9");
 }
      if ( Preset() == 10){
   sendDcsBiosMessage("UHF_PRESET_SEL", "10");
 }
      if ( Preset() == 11){
   sendDcsBiosMessage("UHF_PRESET_SEL", "11");
 }
      if ( Preset() == 12){
   sendDcsBiosMessage("UHF_PRESET_SEL", "12");
 }
      if ( Preset() == 13){
   sendDcsBiosMessage("UHF_PRESET_SEL", "13");
 }
      if ( Preset() == 14){
   sendDcsBiosMessage("UHF_PRESET_SEL", "14");
 }
      if ( Preset() == 15){
   sendDcsBiosMessage("UHF_PRESET_SEL", "15");
 }
      if ( Preset() == 16){
   sendDcsBiosMessage("UHF_PRESET_SEL", "16");
 }
      if ( Preset() == 17){
   sendDcsBiosMessage("UHF_PRESET_SEL", "17");
 }
      if ( Preset() == 18){
   sendDcsBiosMessage("UHF_PRESET_SEL", "18");
 }
      if ( Preset() == 19){
   sendDcsBiosMessage("UHF_PRESET_SEL", "19");
 }
}

// Check and adjust 1st selector
   if (DCS_100mhz != First_selector()) {
    if ( First_selector() == 0){
   sendDcsBiosMessage("UHF_100MHZ_SEL", "0");
 }
    if ( First_selector() == 1){
   sendDcsBiosMessage("UHF_100MHZ_SEL", "1");
 }
    if ( First_selector() == 2){
   sendDcsBiosMessage("UHF_100MHZ_SEL", "2");
 }
    if ( First_selector() == 3){
   sendDcsBiosMessage("UHF_100MHZ_SEL", "3");
 }
    if ( First_selector() == 4){
   sendDcsBiosMessage("UHF_100MHZ_SEL", "4");
 }
    if ( First_selector() == 5){
   sendDcsBiosMessage("UHF_100MHZ_SEL", "5");
 }
    if ( First_selector() == 6){
   sendDcsBiosMessage("UHF_100MHZ_SEL", "6");
 }
    if ( First_selector() == 7){
   sendDcsBiosMessage("UHF_100MHZ_SEL", "7");
 }
    if ( First_selector() == 8){
   sendDcsBiosMessage("UHF_100MHZ_SEL", "8");
 }
    if ( First_selector() == 9){
   sendDcsBiosMessage("UHF_100MHZ_SEL", "9");
 }
}
// Check and adjust 2nd selector
   if (DCS_10mhz != Second_selector()) {
    if ( Second_selector() == 0){
   sendDcsBiosMessage("UHF_10MHZ_SEL", "0");
 }
    if ( Second_selector() == 1){
   sendDcsBiosMessage("UHF_10MHZ_SEL", "1");
 }
    if ( Second_selector() == 2){
   sendDcsBiosMessage("UHF_10MHZ_SEL", "2");
 }
    if ( Second_selector() == 3){
   sendDcsBiosMessage("UHF_10MHZ_SEL", "3");
 }
    if ( Second_selector() == 4){
   sendDcsBiosMessage("UHF_10MHZ_SEL", "4");
 }
    if ( Second_selector() == 5){
   sendDcsBiosMessage("UHF_10MHZ_SEL", "5");
 }
    if ( Second_selector() == 6){
   sendDcsBiosMessage("UHF_10MHZ_SEL", "6");
 }
    if ( Second_selector() == 7){
   sendDcsBiosMessage("UHF_10MHZ_SEL", "7");
 }
    if ( Second_selector() == 8){
   sendDcsBiosMessage("UHF_10MHZ_SEL", "8");
 }
    if ( Second_selector() == 9){
   sendDcsBiosMessage("UHF_10MHZ_SEL", "9");
 }
}

// Check and adjust 3rd selector
   if (DCS_1mhz != Third_selector()) {
    if ( Third_selector() == 0){
   sendDcsBiosMessage("UHF_1MHZ_SEL", "0");
 }
    if ( Third_selector() == 1){
   sendDcsBiosMessage("UHF_1MHZ_SEL", "1");
 }
    if ( Third_selector() == 2){
   sendDcsBiosMessage("UHF_1MHZ_SEL", "2");
 }
    if ( Third_selector() == 3){
   sendDcsBiosMessage("UHF_1MHZ_SEL", "3");
 }
    if ( Third_selector() == 4){
   sendDcsBiosMessage("UHF_1MHZ_SEL", "4");
 }
    if ( Third_selector() == 5){
   sendDcsBiosMessage("UHF_1MHZ_SEL", "5");
 }
    if ( Third_selector() == 6){
   sendDcsBiosMessage("UHF_1MHZ_SEL", "6");
 }
    if ( Third_selector() == 7){
   sendDcsBiosMessage("UHF_1MHZ_SEL", "7");
 }
    if ( Third_selector() == 8){
   sendDcsBiosMessage("UHF_1MHZ_SEL", "8");
 }
    if ( Third_selector() == 9){
   sendDcsBiosMessage("UHF_1MHZ_SEL", "9");
 }
}


// Check and adjust 4th selector
   if (DCS_0_1mhz != Fourth_selector()) {
    if ( Fourth_selector() == 0){
   sendDcsBiosMessage("UHF_POINT1MHZ_SEL", "0");
 }
    if ( Fourth_selector() == 1){
   sendDcsBiosMessage("UHF_POINT1MHZ_SEL", "1");
 }
    if ( Fourth_selector() == 2){
   sendDcsBiosMessage("UHF_POINT1MHZ_SEL", "2");
 }
    if ( Fourth_selector() == 3){
   sendDcsBiosMessage("UHF_POINT1MHZ_SEL", "3");
 }
    if ( Fourth_selector() == 4){
   sendDcsBiosMessage("UHF_POINT1MHZ_SEL", "4");
 }
    if ( Fourth_selector() == 5){
   sendDcsBiosMessage("UHF_POINT1MHZ_SEL", "5");
 }
    if ( Fourth_selector() == 6){
   sendDcsBiosMessage("UHF_POINT1MHZ_SEL", "6");
 }
    if ( Fourth_selector() == 7){
   sendDcsBiosMessage("UHF_POINT1MHZ_SEL", "7");
 }
    if ( Fourth_selector() == 8){
   sendDcsBiosMessage("UHF_POINT1MHZ_SEL", "8");
 }
    if ( Fourth_selector() == 9){
   sendDcsBiosMessage("UHF_POINT1MHZ_SEL", "9");
 }
}

// Check and adjust 5th selector
 if (DCS_0_25mhz != Fifth_selector()) {
   if ( Fifth_selector() == 0){
      sendDcsBiosMessage("UHF_POINT25_SEL", "0");
 }
  if ( Fifth_selector() == 1){
      sendDcsBiosMessage("UHF_POINT25_SEL", "1");
 }
   if ( Fifth_selector() == 2){
      sendDcsBiosMessage("UHF_POINT25_SEL", "2");
 }
   if ( Fifth_selector() == 3){
      sendDcsBiosMessage("UHF_POINT25_SEL", "3");
 }
}

// Check and adjust Tone
 if (DCS_Tone != Sixth_selector()) {
   if ( Sixth_selector() == 0){
      sendDcsBiosMessage("UHF_T_TONE", "0");
 }
  if ( Sixth_selector() == 1){
      sendDcsBiosMessage("UHF_T_TONE", "1");
 }
   if ( Sixth_selector() == 2){
      sendDcsBiosMessage("UHF_T_TONE", "2");
 }
}

// Check and adjust Test
 if (DCS_Test != Eight_selector()) {
   if ( Eight_selector() == 0){
      sendDcsBiosMessage("UHF_TEST", "0");
 }
  if ( Eight_selector() == 1){
      sendDcsBiosMessage("UHF_TEST", "1");
 }
}

// Check and adjust Status
 if (DCS_Status != Ninth_selector()) {
   if ( Ninth_selector() == 0){
      sendDcsBiosMessage("UHF_STATUS", "0");
 }
  if ( Ninth_selector() == 1){
      sendDcsBiosMessage("UHF_STATUS", "1");
 }
}

// Check and adjust Mode
if (DCS_Mode != Tenth_selector()) {
   if ( Tenth_selector() == 0){
      sendDcsBiosMessage("UHF_MODE", "0");
 }
  if ( Tenth_selector() == 1){
      sendDcsBiosMessage("UHF_MODE", "1");
 }
  if ( Tenth_selector() == 2){
      sendDcsBiosMessage("UHF_MODE", "2");
 }
}

// Check and adjust Function
if (DCS_Function != Function_selector()) {
   if ( Function_selector() == 0){
      sendDcsBiosMessage("UHF_FUNCTION", "0");
 }
  if ( Function_selector() == 1){
      sendDcsBiosMessage("UHF_FUNCTION", "1");
 }
  if ( Function_selector() == 2){
      sendDcsBiosMessage("UHF_FUNCTION", "2");
 }
  if ( Function_selector() == 3){
      sendDcsBiosMessage("UHF_FUNCTION", "3");
 }
}

// Check and adjust Squelch
if (DCS_Squelch != Squelch_selector()) {
   if ( Squelch_selector() == 0){
      sendDcsBiosMessage("UHF_SQUELCH", "0");
 }
  if ( Squelch_selector() == 1){
      sendDcsBiosMessage("UHF_SQUELCH", "1");
 }
}

}

 

Cheers

Hans


Edited by Hansolo
Corrected decimal point while radio is off
Link to comment
Share on other sites

You stopped your video too soon. It was good but left me wanting more. I can’t believe how real that looks. Bravo.

I’m not at home with the sim, I’m actually out of state visiting family for the 4th of July. But this may work for the display test. When new data comes in, you can do a test to see if it is the special character. I don’t have access to the UHF code but I used char compare or string compare to see if it was that special symbol, if it was then I replaced it with the number 8 and then sent it to the display. But when you install those 16 segments that will cover you too and look even better at the same time.

 

The other thing I did was being that my VHF, UHF, ILS, Tacan, and Fuel qty used displays, I watch the status of the battery switch and generator switches and I blank the displays based on the position of those switches. Ian helped me with this code. Well basically he came up with it.

 

// Monitor the electrical panel to see the state of the Battery switch and Generator switches

DcsBios::IntegerBuffer eppBatteryPwrBuffer(0x1110, 0x0002, 1, NULL);

DcsBios::IntegerBuffer eppAcGenPwrLBuffer(0x110c, 0x8000, 15, NULL);

DcsBios::IntegerBuffer eppAcGenPwrRBuffer(0x1110, 0x0001, 0, NULL);

 

I put this part in the subroutine of the Void onUhfFrequencyChange for example.

if ((eppAcGenPwrLBuffer.getData() == 0) && (eppAcGenPwrRBuffer.getData() == 0) && (eppBatteryPwrBuffer.getData() == 0))

{

Blank display

}

Else

{

Normal code

}

 

When I install the circuit breaker panel later down the road, I was going to add the CB position to also check to see if power would be on or off at the box.


Edited by GSS Rain
Link to comment
Share on other sites

Thanks Joe. Very good suggestion to check for special characters. I will try and look into this. It would be cool if we could 'just' get the status of the power to the panel but that sound like a good workaround.

 

Thanks a lot Sir

 

Cheers

Hans

Link to comment
Share on other sites

  • 2 weeks later...

Next project. I managed to get a simulated AAU-9A Vertical Velocity Indicator a while back;

 

hPPcXuql.jpg

 

I took the hat off to see whats inside and plan to try and figure out the schematics for the PCB.

5aHFEbbl.jpg

 

So far I have identified a positive and negative voltage regulator, a quad channel operational amplifier as well as a high voltage/current operational amplifier. The motor appears to be just a DC motor with potentiometer feed back.

oAUNJLfl.jpg

 

My initial guess is that it should be fed by +-15VDC and then the command signal is somewhat in the same levels.

 

Cheers

Hans

Link to comment
Share on other sites

  • 2 weeks later...

Alright got a little further. Haven't been able to do the complete schematics but enough to get a general idea of what the pcb does. The board needs -15-0+15VDC and a command signal. Test shows that the command signal needs to be app. +-10VDC for full deflection.

 

The +-15VDC power supply used is from Sparkfun; https://www.sparkfun.com/products/14101

 

In the first test the command signal is send via a 10Kohms potentiometer;

 

It can't be seen on the YT but I did get some stuttering when running low speeds. So far it appears to be a problem with the command potentiometer messing up the loops for the amplifiers.

 

Test 2 is where the Arduino is sending the command via PWM in a slow fading sketch;

 

And test 3 is also with the Arduino but with a fast fading sketch

 

Next is to make a circuit that allows the arduinos 0-5VDC to become +-10VDC. The idea is to use this method

jJ95T0Rl.png

found here; https://electronics.stackexchange.com/questions/3042/converting-scaling-a-voltage-range-0v-5v-to-5v-5v

 

Anyway that is for a little later.

 

Cheers

Hans

Link to comment
Share on other sites

Hallo Hans.

It's always fun, watching you at work :)

 

Edit: I wrote a concern here. But than I deleted that just a few minutes later because it was arbitrary.

(I thought those 2k are too small.) :)

 

So just left my admiration to Hans' work ;)


Edited by Tekkx

Manual for my version of RS485-Hardware, contact: tekkx@dresi.de

Please do not PM me with DCS-BIOS-related questions. If the answer might also be useful to someone else, it belongs in a public thread where it can be discovered by everyone using the search function. Thank You.

Link to comment
Share on other sites

  • 1 month later...

Small update

 

Alright the circuit I posted in #231 wasn't to correct but I found one that worked;

 

gObpjtw.png

https://electronics.stackexchange.com/questions/96317/whats-wrong-with-this-circuit-to-convert-0-5v-to-10-10v

 

This worked perfectly;

 

 

Just need to implement it via RS485, but that is for later.

 

Then I managed to install both AN/ARC-186's, the AN/ARC-164, the KY-58 and the LASTE panel in DZUS rails. It's only the light plate on the LASTE panel which is original, the finger guard is missing the screws but I'll fix that later.

 

S0ktz0ul.jpg

 

Still need some small items like the covers for the displays on the AN/ARC-164 but time is currently scarce due to work .

 

Cheers

Solo


Edited by Hansolo
Link to comment
Share on other sites

  • 4 weeks later...

If i may. can i ask that by purchasing the boards that u are using, and then connecting it to the computer. ur saying that the computer will automatically allow dcs world to pick it up ? to make it clear. ur saying when i build the panel and switches, i have to wire switch to the board ur talking about, then connect board to the pc, then have dcs world turned on and thats it ? how does the mapping get done as far as the procedure to doing it ? Yes im super new to doing it. lol. i just started the building of an f18 and im starting from left panel to right. im wondering does the cpu do the mapping or do i do the mapping when i plug in the circuit board or IO board to the pc ?

ICEMAN2647

Link to comment
Share on other sites

If i may. can i ask that by purchasing the boards that u are using, and then connecting it to the computer. ur saying that the computer will automatically allow dcs world to pick it up ? to make it clear. ur saying when i build the panel and switches, i have to wire switch to the board ur talking about, then connect board to the pc, then have dcs world turned on and thats it ? how does the mapping get done as far as the procedure to doing it ? Yes im super new to doing it. lol. i just started the building of an f18 and im starting from left panel to right. im wondering does the cpu do the mapping or do i do the mapping when i plug in the circuit board or IO board to the pc ?

 

No I don’t think I have said it like that.

 

First of all you need to install DCS-BIOS and add it to the export.lua, and start the communications program SOCAT which connects DCS-BIOS to a COM port on the PC please see;

 

Then you need some Adruino boards, I presume these are the boards you are referring to? Then you need to program these boards for your specific needs. The software for doing the programming you can get here;

https://www.arduino.cc/en/Main/Software

 

Currently when you make a board for e.g. landing gear panel on the F/A-18 Hornet then it doesn’t work for the A-10C. Reason for this is that the commands that the Arduino boards are sending back through SOCAT to DCS are aircraft specific.

 

There is no mapping done in DCS when using DCS-BIOS. The commands are being programmed within the Arduino boards So this is what it looks like when DCS-BIOS SOCAT is running and I flip a switch;

 

 

In this example I switch A-10C AAP STEER PT into MARK then back into MISSION, then I turn left generator ON then OFF, followed by right generator ON then OFF.

 

So it's not exactly plug n' play. You need a little bit of handling yourself but most of the commands you can find already done within DCS-BIOS. In case of the F/A-18 Hornet the mayority of the work is done by AndrewW :thumbup:

 

But what DCS-BIOS and the Arduino's allow you to do is to get input/output to(from DCS at a very reasonable price. I used to run may caution panel for years on a Phidgets LED board at around $80. Here I needed Helios to get it running and that worked fine. Now I use DCS-BIOS, and a Arduino setup with a MAX7219 chip at a total cost of less than $10.

 

Cheers

Solo

Link to comment
Share on other sites

  • 3 weeks later...

Update to IFF panel functionallity

 

Firstly I updated the A10C.lua with code from quick, so that GSS Rain/Joe Sim reported item no1 (Audio/Out/Light 3-position switch) is working; https://forums.eagle.ru/showpost.php?p=3583300&postcount=2

 

The missing feature of IFF Reply and Test lamp , item 2 & 3;

https://forums.eagle.ru/showthread.php?t=189774

 

was fixed by adding following lines the end of DCS-BIOS's A10C.lua;

 

defineIndicatorLight("IFF_REPLY_LAMP", 798, "IFF", "IFF REPLY LAMP Indicator")

defineIndicatorLight("IFF_TEST_LAMP", 799, "IFF", "IFF TEST LAMP Indicator")

 

Just before; BIOS.protocol.endModule()

 

NOTE!! It is important to add the change to the end just before "BIOS.protocol.endModule()" as otherwise a lot of addresses within the DCS-BIOS control references will be changed and you need to update all your boards!!!! The changes are done in the JSON file when loading a mission.

 

Adding these two lines will give correct function of IFF Reply and Test lamps when the Arduino code updated with following lines;

//REPLY

DcsBios::LED iffReplyLamp(0x11BC, 0x800, 13);

 

//TEST

DcsBios::LED iffTestLamp(0x11BC, 0x1000, 12);

 

In this small video you may notice that pressing test of Reply and Test on panel does not affect DCS.

 

This is because the lamp tests are hardwired and I did not find it useful to make a relay function in order to give it back to DCS.

 

Link to updated A10C.lua; https://drive.google.com/open?id=10u98XT8yZqQdy6kBQ-R0ygNc9-4aM-qN

Link to full Arduino code; https://drive.google.com/open?id=1BFYPCbJKKGopBkiOIJ5HfqgNFmTNIGLI

 

The IFF update is slave no 20

 

Cheers

Hans

Link to comment
Share on other sites

  • 1 month later...

Brilliant work. That is very cool Hans. Glad Mr. Quick and you solved it. I’m still in a hotel at the moment and all my stuff is still in storage. Not sure how long I’ll be in town and was wondering if it be worth moving in an apartment. If I do, updating the IFF will be one of the first things I’ll do. Hopefully one day someone will make a Mod where we can really get to use this panel. Your Cockpit is really turning out awesome. Cheers.


Edited by GSS Rain
Link to comment
Share on other sites

  • 4 months later...

CDU Sketch error

 

CptSasquatch notified me that he got an error when compiling my CDU sketch.

 

Initially I thought the error may be caused by translation from Danish keyboard to an English one, since my character shows as ½ whereas his show up as ½.

 

I tried to see if I my mapping was wrong but electrically mine is alright. Turns out that ½ cannot be used. So in order to get my CDU sketch working the '½' needs to be replaced with a 'd' if all three places where ½ had been used. Then it should work.

 

In the code below I included the right and left arrow as +/- rocker;

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

/*
 The Arduino pin that is connected to the
 /RE and DE pins on the RS-485 transceiver.
*/
#define TXENABLE_PIN 2
#include <Keypad.h>
#include "DcsBios.h"

/* paste code snippets from the reference documentation here */
const byte ROWS = 8; //four rows
const byte COLS = 9; //three columns
char keys[ROWS][COLS] = {
 {'!','"','#','c','%','F','L','R','X'},
 {'&','E','K','Q','W','Z'},
 {'|','D','J','P','V','Y','('},
 {')','C','I','O','U','=','@','£','$'},
 {'{','A','B','G','H','M','N','S','T'},
 {':','3','6','9','[','>','/',',','*'},
 {';','2','5','8','0','-','<','}','d'},
 {'+',']','_','a','b','1','4','7','.'},

};
byte rowPins[ROWS] = {13, A0, A1, 12, A2, A3, A4, A5}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {11, 9, 7, 10, 8, 6, 5, 4, 3}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );



void setup() {
 DcsBios::setup();
 keypad.addEventListener(keypadEvent);  // Add an event listener.
 keypad.setHoldTime(100);               // Default is 1000mS
 keypad.setDebounceTime(50);           // Default is 50mS
}

void loop() {
 DcsBios::loop();
  char key = keypad.getKey();
}

void keypadEvent(KeypadEvent KEY){  
 switch (keypad.getState()) { // gives PRESSED, HOLD or RELEASED
 case PRESSED: // If someone finds a better solution as switch - case: Let me know, please :)
   switch(KEY) { // following commands are fired unique if PRESSED
   //CDU
   case 'A': sendDcsBiosMessage("CDU_A", "1"); break; 
   case 'B': sendDcsBiosMessage("CDU_B", "1"); break; 
   case 'C': sendDcsBiosMessage("CDU_C", "1"); break;     
   case 'D': sendDcsBiosMessage("CDU_D", "1"); break; 
   case 'E': sendDcsBiosMessage("CDU_E", "1"); break; 
   case 'F': sendDcsBiosMessage("CDU_F", "1"); break; 
   case 'G': sendDcsBiosMessage("CDU_G", "1"); break; 
   case 'H': sendDcsBiosMessage("CDU_H", "1"); break; 
   case 'I': sendDcsBiosMessage("CDU_I", "1"); break; 
   case 'J': sendDcsBiosMessage("CDU_J", "1"); break; 
   case 'K': sendDcsBiosMessage("CDU_K", "1"); break; 
   case 'L': sendDcsBiosMessage("CDU_L", "1"); break; 
   case 'M': sendDcsBiosMessage("CDU_M", "1"); break; 
   case 'N': sendDcsBiosMessage("CDU_N", "1"); break; 
   case 'O': sendDcsBiosMessage("CDU_O", "1"); break;
   case 'P': sendDcsBiosMessage("CDU_P", "1"); break;
   case 'Q': sendDcsBiosMessage("CDU_Q", "1"); break; 
   case 'R': sendDcsBiosMessage("CDU_R", "1"); break;   
   case 'S': sendDcsBiosMessage("CDU_S", "1"); break;     
   case 'T': sendDcsBiosMessage("CDU_T", "1"); break; 
   case 'U': sendDcsBiosMessage("CDU_U", "1"); break;        
   case 'V': sendDcsBiosMessage("CDU_V", "1"); break; 
   case 'W': sendDcsBiosMessage("CDU_W", "1"); break; 
   case 'X': sendDcsBiosMessage("CDU_X", "1"); break; 
   case 'Y': sendDcsBiosMessage("CDU_Y", "1"); break; 
   case 'Z': sendDcsBiosMessage("CDU_Z", "1"); break; 


   case '0': sendDcsBiosMessage("CDU_0", "1"); break; 
   case '1': sendDcsBiosMessage("CDU_1", "1"); break; 
   case '2': sendDcsBiosMessage("CDU_2", "1"); break; 
   case '3': sendDcsBiosMessage("CDU_3", "1"); break; 
   case '4': sendDcsBiosMessage("CDU_4", "1"); break; 
   case '5': sendDcsBiosMessage("CDU_5", "1"); break; 
   case '6': sendDcsBiosMessage("CDU_6", "1"); break; 
   case '7': sendDcsBiosMessage("CDU_7", "1"); break; 
   case '8': sendDcsBiosMessage("CDU_8", "1"); break; 
   case '9': sendDcsBiosMessage("CDU_9", "1"); break;  
   case '.': sendDcsBiosMessage("CDU_POINT", "1"); break; 
   case '/': sendDcsBiosMessage("CDU_SLASH", "1"); break; 
       
   case '!': sendDcsBiosMessage("CDU_LSK_3R", "1"); break; 
   case '"': sendDcsBiosMessage("CDU_LSK_5R", "1"); break;
   case '#': sendDcsBiosMessage("CDU_LSK_7R", "1"); break;
   case 'c': sendDcsBiosMessage("CDU_LSK_9R", "1"); break;

   case '+': sendDcsBiosMessage("CDU_LSK_3L", "1"); break; 
   case ']': sendDcsBiosMessage("CDU_LSK_5L", "1"); break;
   case '_': sendDcsBiosMessage("CDU_LSK_7L", "1"); break;
   case 'a': sendDcsBiosMessage("CDU_LSK_9L", "1"); break;
   
   case '[': sendDcsBiosMessage("CDU_PG", "2"); break; 
   case 'd': sendDcsBiosMessage("CDU_PG", "0"); break; 

   case '>': sendDcsBiosMessage("CDU_DATA", "2"); break; 
   case '<': sendDcsBiosMessage("CDU_DATA", "0"); break;
   
   case 'b': sendDcsBiosMessage("CDU_SYS", "1"); break; 
   case '{': sendDcsBiosMessage("CDU_NAV", "1"); break; 
   case ')': sendDcsBiosMessage("CDU_WP", "1"); break; 
   case '|': sendDcsBiosMessage("CDU_OSET", "1"); break; 
   case '&': sendDcsBiosMessage("CDU_FPM", "1"); break; 
   case '%': sendDcsBiosMessage("CDU_PREV", "1"); break;  

   case '(': sendDcsBiosMessage("CDU_MK", "1"); break; 
   case '}': sendDcsBiosMessage("CDU_CLR", "1"); break; 
   case '=': sendDcsBiosMessage("CDU_BCK", "1"); break; 
   case '@': sendDcsBiosMessage("CDU_SPC", "1"); break; 
   case '$': sendDcsBiosMessage("CDU_FA", "1"); break; 

   
 }}

 
   switch (keypad.getState()){  // gives PRESSED, HOLD or RELEASED
 case RELEASED: 
   switch(KEY) { // Released KEYs or Neutral Rockers signal is sent
   //CDU
   case 'A': sendDcsBiosMessage("CDU_A", "0"); break; 
   case 'B': sendDcsBiosMessage("CDU_B", "0"); break; 
   case 'C': sendDcsBiosMessage("CDU_C", "0"); break;     
   case 'D': sendDcsBiosMessage("CDU_D", "0"); break; 
   case 'E': sendDcsBiosMessage("CDU_E", "0"); break; 
   case 'F': sendDcsBiosMessage("CDU_F", "0"); break; 
   case 'G': sendDcsBiosMessage("CDU_G", "0"); break; 
   case 'H': sendDcsBiosMessage("CDU_H", "0"); break; 
   case 'I': sendDcsBiosMessage("CDU_I", "0"); break; 
   case 'J': sendDcsBiosMessage("CDU_J", "0"); break; 
   case 'K': sendDcsBiosMessage("CDU_K", "0"); break; 
   case 'L': sendDcsBiosMessage("CDU_L", "0"); break; 
   case 'M': sendDcsBiosMessage("CDU_M", "0"); break; 
   case 'N': sendDcsBiosMessage("CDU_N", "0"); break; 
   case 'O': sendDcsBiosMessage("CDU_O", "0"); break;
   case 'P': sendDcsBiosMessage("CDU_P", "0"); break;
   case 'Q': sendDcsBiosMessage("CDU_Q", "0"); break; 
   case 'R': sendDcsBiosMessage("CDU_R", "0"); break;   
   case 'S': sendDcsBiosMessage("CDU_S", "0"); break;     
   case 'T': sendDcsBiosMessage("CDU_T", "0"); break; 
   case 'U': sendDcsBiosMessage("CDU_U", "0"); break;        
   case 'V': sendDcsBiosMessage("CDU_V", "0"); break; 
   case 'W': sendDcsBiosMessage("CDU_W", "0"); break; 
   case 'X': sendDcsBiosMessage("CDU_X", "0"); break; 
   case 'Y': sendDcsBiosMessage("CDU_Y", "0"); break; 
   case 'Z': sendDcsBiosMessage("CDU_Z", "0"); break; 


   case '0': sendDcsBiosMessage("CDU_0", "0"); break; 
   case '1': sendDcsBiosMessage("CDU_1", "0"); break; 
   case '2': sendDcsBiosMessage("CDU_2", "0"); break; 
   case '3': sendDcsBiosMessage("CDU_3", "0"); break; 
   case '4': sendDcsBiosMessage("CDU_4", "0"); break; 
   case '5': sendDcsBiosMessage("CDU_5", "0"); break; 
   case '6': sendDcsBiosMessage("CDU_6", "0"); break; 
   case '7': sendDcsBiosMessage("CDU_7", "0"); break; 
   case '8': sendDcsBiosMessage("CDU_8", "0"); break; 
   case '9': sendDcsBiosMessage("CDU_9", "0"); break;  
   case '.': sendDcsBiosMessage("CDU_POINT", "0"); break; 
   case '/': sendDcsBiosMessage("CDU_SLASH", "0"); break; 
       
   case '!': sendDcsBiosMessage("CDU_LSK_3R", "0"); break; 
   case '"': sendDcsBiosMessage("CDU_LSK_5R", "0"); break;
   case '#': sendDcsBiosMessage("CDU_LSK_7R", "0"); break;
   case 'c': sendDcsBiosMessage("CDU_LSK_9R", "0"); break;

   case '+': sendDcsBiosMessage("CDU_LSK_3L", "0"); break; 
   case ']': sendDcsBiosMessage("CDU_LSK_5L", "0"); break;
   case '_': sendDcsBiosMessage("CDU_LSK_7L", "0"); break;
   case 'a': sendDcsBiosMessage("CDU_LSK_9L", "0"); break;
   
   case '[': sendDcsBiosMessage("CDU_PG", "1"); break; 
   case 'd': sendDcsBiosMessage("CDU_PG", "1"); break; 

   case '>': sendDcsBiosMessage("CDU_DATA", "1"); break; 
   case '<': sendDcsBiosMessage("CDU_DATA", "1"); break; 
   
   case 'b': sendDcsBiosMessage("CDU_SYS", "0"); break; 
   case '{': sendDcsBiosMessage("CDU_NAV", "0"); break; 
   case ')': sendDcsBiosMessage("CDU_WP", "0"); break; 
   case '|': sendDcsBiosMessage("CDU_OSET", "0"); break; 
   case '&': sendDcsBiosMessage("CDU_FPM", "0"); break; 
   case '%': sendDcsBiosMessage("CDU_PREV", "0"); break;  

   case '(': sendDcsBiosMessage("CDU_MK", "0"); break; 
   case '}': sendDcsBiosMessage("CDU_CLR", "0"); break; 
   case '=': sendDcsBiosMessage("CDU_BCK", "0"); break; 
   case '@': sendDcsBiosMessage("CDU_SPC", "0"); break; 
   case '$': sendDcsBiosMessage("CDU_FA", "0"); break; 

 }}
}
   

 

Good catch CptSasquatch :thumbup:

 

Have a great Easter

 

Cheers

Hans

Link to comment
Share on other sites

  • 3 weeks later...
First of all many thanks for the kind words Warhog. Coming from you means a lot to me.

 

Secondly, my good friend Mac asked me a few questions and I though I might as well answer them here;

 

Q: Are you using the same RS485 expansion board on every panel now?

 

A: No I am not using the same board everytime. I kinda wing it everytime. The basic setup is the same. A MAX487 chip on a prototype board. 6 core cable comes in with communication, ground, 5VDC, 12VDC, and an unused wire.

 

12VDC is applied directly to the Arduino, The Arduino supplies regulated 5VDC to the MAX487 chip. But the rest of the setup depends on what I need the panel for.

 

Here is a closup of the standard starting point for the prototype board:

 

g9osyOWl.jpg

 

The prototype board hold the MAX487, Brown is GND, Pink is 12VDC, White is 5VDC, Grey is unused at this point, Yellow/Green is communication.

 

This is one of the simplest panels, the AAP which uses 12 inputs;

 

UHnGOUWl.jpg

 

The prototype board is also used for the common ground for all the switches. I have ordered some terminals to do this. It does make the setup a little more expensive but it’s just so much easier to get it to look nice when the wires ends in screw terminals.

 

Top view of same panel;

 

Mr2ymmsl.jpg

 

The ILS is done in a very similar way but since the panel is very narrow I had to split the setup

 

XWMv8wyl.jpg

 

Other panels are more demanding e.g. the SAS panel;

 

CwI21xAl.jpg

 

This is an older version and I think I changed this one into a two layer setup as the initial layout was too big. This board has the MOSFET’s to drive the mag switches and Trim LED.

 

Here is the Emergency flight plan which apart for MOSFET’s to drive the LED’s also have a NAND circuit to return the trim switch to neutral.

 

beAgIbsl.jpg

 

Q: Would you mind sharing your schematics and hook-up guide for the RS485 system you’re using with me

 

A: Here is the setup I am using;

 

cnJVSvK.jpg

 

DCS communicates with one Arduino Mega via USB. The Mega communicates with the remaining boards over RS485. The junction box holds DB9 female connectors and all the panels then have DB9 male connector.

 

 

Hope this is of a little assistance

 

Cheers

Hans

 

 

 

 

Hi Hans,

 

 

This has been like a bible to me to get started on the Mega > Nano Master/Slave.

 

 

Can I ask, you have the 12v power, is that to power your magnetic switches, the only thing I want to power are about 3 LEDs so I shouldnt need the 12V line??

 

 

How do you power the Nano's, does the 5v out from the VIN pin on the Mega work?

 

 

Also, do you have a picture of your junction box? I assume it will be as tidy as the rest of the nice work!

Link to comment
Share on other sites

Hi Mr. Burns,

 

The 12VDC is mostly needed for the magnetic held toggle switches, but also because way back I did experience issues with running a 1602 LCD off an external 5VDC power supply. There wasn’t enough power to handle the contrast but after supplying the Arduinos with 12VDC it worked everytime. Granted I could have been something else that caused it as this was back in 2013 (https://forums.eagle.ru/showpost.php?p=1669869&postcount=25) and it ran an ethernet shield as well.

 

Therefore based upon above I set to use 12VDC on all the boards, so the Mega Master and all the slaves which a re mix of Nano’s and Mega’s all have 12VDC on the VIN pin.

Could I have used 9VDC? Possibly but I am running off an old ATX PC power supply which has both 5VDC and 12VDC available.

 

Now to your question. Do you need 12VDC? Possibly not but I think you would need an external power source nonetheless, as you would otherwise have to run USB power for all of them. If you power the Nano’s on the VIN pin then you need 7-12VDC because it has an internal voltage regulator which a little higher voltage then output to operate. I.e. applying 5VDC on the VIN will not get you 5VDC for the internal circuits.

 

You can apply 5VDC to the +5V pin on the Nano’s. However this will bypass the voltage regulator (!!) and if you get a voltage spike on your 5VDC then it may fry your Nano’s. If you go down this path do like Blue73 did (https://forums.eagle.ru/showpost.php?p=3789267&postcount=207) where he had a common 5VDC regulator to protect all your Arduino’s. Possibly this could be 5VDC from an old PC ATX power supply.

 

The VIN on your Mega Master shouldn’t be able to give you 5VDC out. In the VIN circuit there is an operational amplifier and a MOSFET and I don’t think you can send voltage in the reverse direction.

 

Last but not least the junction boxes, not as tidy as you would think;

Input from Mega Master

FL7dpvv.png

 

1jNxcbA.png

 

Output to left side console junction box

BBbHeCD.png

 

82gPiZe.png

 

However they get the job done. The PCB is just stripboards similar to this https://www.ebay.com/itm/Strip-Board-Printed-Circuit-PCB-Vero-Prototyping-Track-Packs-of-5/261199157440?hash=item3cd0aed8c0:m:mDZYtyKIelPhIfrJ34_SRVg

The advantage is that I can unplug any panel and keep running on the remaining. The input to the junction box is via a male DB9 and all connections to panel as well as to the next junction box is via female DB9’s. One mistake done on these are that the bulk of the DB9 are situated a little too close so currently I can’t have the plastic housing on them. Oh well you build you learn :-D

 

Hope this helped you a little bit otherwise please ask again.

 

Cheers

Hans

  • Thanks 1
Link to comment
Share on other sites

That is great thanks, really informative, I got all my components finally less now a 5v regulators, some connectors and a junction box.

 

 

I have an old laptop charger I think is at 12v so a 1A 5V Regulator should be OK with this?

Link to comment
Share on other sites

  • 3 months later...

Hi Joe,

 

Things are good despite the fact I haven't done very much lately. Well at least just some testing. Buoght a number of Aircore motors a few years back and managed to get those running using a L293D chip after watching GeneB's setup ;

 

 

Of cause there isn't that much power in the aircore motors but for oxygen, flaps, hydraulics, probably also some of the engine gauges they would work fine. For driving real gauges with secondary needle I am going to need something so tried a to do a few test with steppers.

 

 

I actually found some NEMA8 which is just a tad smaller.

 

I have also been playing a bit with 5*7dot matrix displays. Started out with your setup 1-to-1 also using PDSP1881 8-digit displays but later decided to use just a single shift register:

 

 

Then I found some of the same displays WarHog have used HCMS-2963 at a good price in EU. They don't need a shift register so wiring a little simpler still;

 

 

 

With regard to the main instrument panel I haven't anything. It's still on the list and it going to take a while before I get to that point. I just picked up DZUS rails today, enough for both left and right side consolo so I better get cracking on making side consoles so I can move into the other pit. Hopefully during winter I get it all moved. It will fill up a little space hich I can then use for something else :-)

 

Cheers

Hans

Link to comment
Share on other sites

  • 4 months later...

Hello Mr. Solo,

Forgive me if it is otherwise answered, I have tried using search, but have not the time at present to read the entire thread to see if anyone asked yet. With the original panels you used like TACAN and KY 28 and such, did you tear out all the wiring and start from scratch using the original rotaries, toggles, pots, etc..., or did you replace them with new hardware and wire, just keeping the shells? Thanks.

 

Salute,

Punk

Punk

 

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

Hello Sir.

 

For the most part I have removed all the original wiring and 'just' used the rotaries, toggle etc. A few of them had the original amphenol connector but I removed those. First the mating connector is very pricy and difficult to find. Secondly I have all the electronics on each panel.

 

All the best

Hans

Link to comment
Share on other sites

  • 1 month later...

Hello Hansolo, I am just starting to build my first A10C panel and cockpit using arduino UNO and some wood. I would just like to say that I have thought about this project for many years but never thought I would get the time/money to pursue this. You have been a big inspiration over the past few years and I thank you for that. Any tips would be greatly appreciated in the future and I look forward to seeing you progress in your build!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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