Jump to content

F14 radio frequency DCS BIOS to MAX7219


BULLITT83

Recommended Posts

hi guys , i would like to go through a new step on my F14 simpit

 

Displaying radio frequency on a MAX7219 7 segment display

 

But now i've a lack of knowledge .

 

i found in the DCS BISO control reference this line :

 

 

PILOT ARC-159 Frequency (string)

void onPltUhfStringFreqChange(char* newValue) {

/* your code here */

}

DcsBios::StringBuffer<7> pltUhfStringFreqBuffer(0x1248, onPltUhfStringFreqChange);

 

but also

 

PILOT Dial 3 ARC-159 Frequency

and

PILOT Dial 4 ARC-159 Frequency

 

 

i don't understand which one is the frequency display ? and to write a sketch to send the frequency value to the MAX 7219 ???

 

Please help me GOOSE !!

 

 

regards

 

Guillaume

Link to comment
Share on other sites

So with the help of BLACKLIBRARY i found that the frequency line is the "string" one.

 

PILOT ARC-159 Frequency (string)

void onPltUhfStringFreqChange(char* newValue) {

/* your code here */

}

DcsBios::StringBuffer<7> pltUhfStringFreqBuffer(0x1248, onPltUhfStringFreqChange);

 

 

now i'll try to write my sketch to display it.

 

From what i read it start like that :

 

void onPltUhfStringFreqChange(char* newValue) {

/* pin 7 is connected to the DataIn

pin 6 is connected to the CLK

pin 5 is connected to LOAD

We have only a single MAX72XX.

*/

LedControl lc=LedControl(7,6,5,1);

 

void setup() {

 

*/ lc.shutdown(0,false);

/* Set the brightness to a medium values */

lc.setIntensity(0,8);

/* and clear the display */

lc.clearDisplay(0);

}

 

*/

DcsBios::StringBuffer<7> pltUhfStringFreqBuffer(0x1248, onPltUhfStringFreqChange);

 

 

 

... someone can apply some correction ?

Link to comment
Share on other sites

No that not entirely correct I think. How many digits have you setup and are you able to light them up with one of the Ledcontrol examples supplied when you have included the Ledcontrol library?

 

If no then try that at first to make sure your wiring and setup works before starting with DCS-BIOS. It will be easier for you later on to fault trace if it doesn't work.

 

If yes then proceed with your basic DCS-BIOS sketch from the example list;

/*
 /*
 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).
*/
#define DCSBIOS_IRQ_SERIAL

#include "DcsBios.h"

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

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

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

 

 

Then you start by including the Ledcontrol library and defining it in the setup;

 

/*
 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).
*/
#define DCSBIOS_IRQ_SERIAL

#include "DcsBios.h"
#include <LedControl.h> 
/* pin 7 is connected to the DataIn
pin 6 is connected to the CLK
pin 5 is connected to LOAD
We have only a single MAX72XX.
*/
LedControl lc=LedControl(7,6,5,1);

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

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 

}

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

 

This should compile.

 

Then you can include a small test of the display when you power up your Arduino;

 

/*
 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).
*/
#define DCSBIOS_IRQ_SERIAL

#include "DcsBios.h"
#include <LedControl.h> 
/* pin 7 is connected to the DataIn
pin 6 is connected to the CLK
pin 5 is connected to LOAD
We have only a single MAX72XX.
*/
LedControl lc=LedControl(7,6,5,1);

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

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);
}

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

 

Above assumes you have 6 digits, if not then please adjust.

 

 

Then you include you code for the ARC-159;

 

/*
 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).
*/
#define DCSBIOS_IRQ_SERIAL

#include "DcsBios.h"
#include <LedControl.h> 
/* pin 7 is connected to the DataIn
pin 6 is connected to the CLK
pin 5 is connected to LOAD
We have only a single MAX72XX.
*/
LedControl lc=LedControl(7,6,5,1);

/* paste code snippets from the reference documentation here */
//PILOT ARC-159 Frequency
void onPltUhfStringFreqChange(char* newValue) {
  lc.setChar(0,0,newValue[0],false);
  lc.setChar(0,1,newValue[1],false);
  lc.setChar(0,2,newValue[2],true);  //true=this is the full stop after digit no 3
  lc.setChar(0,3,newValue[4],false);
  lc.setChar(0,4,newValue[5],false);
  lc.setChar(0,5,newValue[6],false);
}
DcsBios::StringBuffer<7> pltUhfStringFreqBuffer(0x1248, onPltUhfStringFreqChange);


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);
}

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

 

 

But as stated on top start with getting the digits to light up without DCS-BIOS.

 

Please also note that above has been done from my AN/ARC-164 sketch for the A-10C so there may be variations since the it's not the same module as the one you are using.

 

Cheers

Hans

Link to comment
Share on other sites

Hi HANSOLO !!

 

 

Thanks a lot for your full answer , i will test that as soon as possible and come back to give you the result.

 

For the moment i don't even try to plug th eMAX7219 , i'll start wiring it this evening.

 

I have an 8 digit display , not able to find a 6 digit , i plan to put a physical mask on the module to hide the 2 unused digit

 

just one question do i have to change something in my DCS BIOS setting ? do i have to add a new library ? i don't think so ?

 

 

 

Guillaume


Edited by BULLITT83
Link to comment
Share on other sites

just one question do i have to change something in my DCS BIOS setting ? do i have to add a new library ? i don't think so ?

 

Depends on whether you already have the Ledcontrol library installed. Easiest way to check that is just to include;

#include <LedControl.h> 

 

If the compiling will let you know if the library is missing.

 

I used these for my AN/ARC-164 but they do require a made PCB for them; https://www.ebay.com/itm/1-Lot-of-25-Pieces-Avago-HDSP-U503-LED/291589746309?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2060353.m1438.l2649

 

Cheers

Hans

Link to comment
Share on other sites

@BULLIT83, what happens if you plug in the connector (in right sequence) but at the other end of the board? My guess is that one end is input to the display and the other is output to another display.

 

 

PS. Which one have you bought?

 

Cheers

Hans

Link to comment
Share on other sites

  • 2 years later...
On 10/7/2019 at 2:24 PM, Hansolo said:

No that not entirely correct I think. How many digits have you setup and are you able to light them up with one of the Ledcontrol examples supplied when you have included the Ledcontrol library?

 

If no then try that at first to make sure your wiring and setup works before starting with DCS-BIOS. It will be easier for you later on to fault trace if it doesn't work.

 

If yes then proceed with your basic DCS-BIOS sketch from the example list;

 

/*
 /*
 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).
*/
#define DCSBIOS_IRQ_SERIAL

#include "DcsBios.h"

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

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

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

 

 

 

 

Then you start by including the Ledcontrol library and defining it in the setup;

 

 

/*
 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).
*/
#define DCSBIOS_IRQ_SERIAL

#include "DcsBios.h"
#include <LedControl.h> 
/* pin 7 is connected to the DataIn
pin 6 is connected to the CLK
pin 5 is connected to LOAD
We have only a single MAX72XX.
*/
LedControl lc=LedControl(7,6,5,1);

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

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 

}

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

 

 

This should compile.

 

Then you can include a small test of the display when you power up your Arduino;

 

 

/*
 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).
*/
#define DCSBIOS_IRQ_SERIAL

#include "DcsBios.h"
#include <LedControl.h> 
/* pin 7 is connected to the DataIn
pin 6 is connected to the CLK
pin 5 is connected to LOAD
We have only a single MAX72XX.
*/
LedControl lc=LedControl(7,6,5,1);

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

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);
}

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

 

 

Above assumes you have 6 digits, if not then please adjust.

 

 

Then you include you code for the ARC-159;

 

 

 

/*
 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).
*/
#define DCSBIOS_IRQ_SERIAL

#include "DcsBios.h"
#include <LedControl.h> 
/* pin 7 is connected to the DataIn
pin 6 is connected to the CLK
pin 5 is connected to LOAD
We have only a single MAX72XX.
*/
LedControl lc=LedControl(7,6,5,1);

/* paste code snippets from the reference documentation here */
//PILOT ARC-159 Frequency
void onPltUhfStringFreqChange(char* newValue) {
  lc.setChar(0,0,newValue[0],false);
  lc.setChar(0,1,newValue[1],false);
  lc.setChar(0,2,newValue[2],true);  //true=this is the full stop after digit no 3
  lc.setChar(0,3,newValue[4],false);
  lc.setChar(0,4,newValue[5],false);
  lc.setChar(0,5,newValue[6],false);
}
DcsBios::StringBuffer<7> pltUhfStringFreqBuffer(0x1248, onPltUhfStringFreqChange);


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);
}

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

 

 

 

But as stated on top start with getting the digits to light up without DCS-BIOS.

 

Please also note that above has been done from my AN/ARC-164 sketch for the A-10C so there may be variations since the it's not the same module as the one you are using.

 

Cheers

Hans

Quick Question Hansolo,  if i am cascading max 7219 segment displays, do i need to change the sketch completely? Or do i just change the first digit in the lc.setChar(0,0,newValue[0],false); to a 1 for a new string command?  Ie. lc.setChar(1,0,newValue[0],false).

 

Thanks

Link to comment
Share on other sites

I think the first argument in brackets is the number of the chip (0 means the first max7219). Second argument is for the display (0 means the first digit).

Regards, Vinc

Spoiler
/* Display a character on a 7-Segment display.
 * Params:
 *   addr  address of the display
 *   digit the position of the character on the display (0..7)
 *   value the character to be displayed.
 *   dp    sets the decimal point.  
*/ 
void setChar(int addr, int digit, char value, boolean dp);

 

 


Edited by Vinc_Vega

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

  • Recently Browsing   0 members

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