F14 radio frequency DCS BIOS to MAX7219 - ED Forums
 


Notices

Reply
 
Thread Tools Display Modes
Old 10-04-2019, 06:23 PM   #1
BULLITT83
Junior Member
 
Join Date: May 2018
Location: SOUTH OF FRANCE
Posts: 59
Default F14 radio frequency DCS BIOS to MAX7219

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
BULLITT83 is offline   Reply With Quote
Old 10-07-2019, 06:47 PM   #2
BULLITT83
Junior Member
 
Join Date: May 2018
Location: SOUTH OF FRANCE
Posts: 59
Default

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,;
/* and clear the display */
lc.clearDisplay(0);
}

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



... someone can apply some correction ?
BULLITT83 is offline   Reply With Quote
Old 10-07-2019, 07:24 PM   #3
Hansolo
Senior Member
 
Hansolo's Avatar
 
Join Date: Aug 2012
Location: Denmark
Posts: 1,680
Default

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;
Code:
/*
  /*
  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;

Code:
/*
  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;

Code:
/*
  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;


Code:
/*
  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
__________________
Hansolo is offline   Reply With Quote
Old 10-08-2019, 06:37 AM   #4
BULLITT83
Junior Member
 
Join Date: May 2018
Location: SOUTH OF FRANCE
Posts: 59
Default

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

Last edited by BULLITT83; 10-08-2019 at 06:40 AM.
BULLITT83 is offline   Reply With Quote
Old 10-09-2019, 05:54 AM   #5
Hansolo
Senior Member
 
Hansolo's Avatar
 
Join Date: Aug 2012
Location: Denmark
Posts: 1,680
Default

Quote:
Originally Posted by BULLITT83 View Post
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;
Code:
#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...53.m1438.l2649

Cheers
Hans
__________________
Hansolo is offline   Reply With Quote
Old 10-09-2019, 04:36 PM   #6
BULLITT83
Junior Member
 
Join Date: May 2018
Location: SOUTH OF FRANCE
Posts: 59
Default

HAN SOLO !! it works !! i follow your explanation and it almost works ,

please can you help me to tune it ? i have a small display problem , numbers are flip-flopped !

look at pictures the frequency is 316.000

BULLITT83 is offline   Reply With Quote
Old 10-09-2019, 04:38 PM   #7
BULLITT83
Junior Member
 
Join Date: May 2018
Location: SOUTH OF FRANCE
Posts: 59
Default

does it comes from my library ? or DCS BIOS f14 ?
BULLITT83 is offline   Reply With Quote
Old 10-09-2019, 08:55 PM   #8
crash test pilot
Junior Member
 
Join Date: Mar 2019
Posts: 11
Default

I have max7219 displays from different vendors. One counts the digits backwards, so i had to adapt the code to that one display. Running fine.
crash test pilot is offline   Reply With Quote
Old 10-10-2019, 07:27 AM   #9
BULLITT83
Junior Member
 
Join Date: May 2018
Location: SOUTH OF FRANCE
Posts: 59
Default

Hi crash test pilot . y ou change thé library code or the arduino sketch ?
BULLITT83 is offline   Reply With Quote
Old 10-10-2019, 02:45 PM   #10
Hansolo
Senior Member
 
Hansolo's Avatar
 
Join Date: Aug 2012
Location: Denmark
Posts: 1,680
Default

@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
__________________
Hansolo is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 03:35 PM. vBulletin Skin by ForumMonkeys. Powered by vBulletin®.
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.