BULLITT83 Posted October 4, 2019 Posted October 4, 2019 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 Posted October 7, 2019 Author Posted October 7, 2019 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 ?
Hansolo Posted October 7, 2019 Posted October 7, 2019 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 132nd Virtual Wing homepage & 132nd Virtual Wing YouTube channel My DCS-BIOS sketches & Cockpit Album
BULLITT83 Posted October 8, 2019 Author Posted October 8, 2019 (edited) 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 October 8, 2019 by BULLITT83
Hansolo Posted October 9, 2019 Posted October 9, 2019 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 132nd Virtual Wing homepage & 132nd Virtual Wing YouTube channel My DCS-BIOS sketches & Cockpit Album
BULLITT83 Posted October 9, 2019 Author Posted October 9, 2019 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 Posted October 9, 2019 Author Posted October 9, 2019 does it comes from my library ? or DCS BIOS f14 ?
crash test pilot Posted October 9, 2019 Posted October 9, 2019 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.
BULLITT83 Posted October 10, 2019 Author Posted October 10, 2019 Hi crash test pilot . y ou change thé library code or the arduino sketch ?
Hansolo Posted October 10, 2019 Posted October 10, 2019 @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 132nd Virtual Wing homepage & 132nd Virtual Wing YouTube channel My DCS-BIOS sketches & Cockpit Album
BULLITT83 Posted October 10, 2019 Author Posted October 10, 2019 hello HAN, i've plug it at the INPUT , not the output and here is a link to the one i bought https://www.amazon.fr/dp/B0797NRMQH/ref=pe_3044141_189395771_TE_dp_1
BULLITT83 Posted October 10, 2019 Author Posted October 10, 2019 if i plug it on the output side nothing happen , only 88888888
crash test pilot Posted October 10, 2019 Posted October 10, 2019 (edited) I just changed the numbering in the sketch... good luck and have fun! edit: had a look, I think I bought the same... for the rest of my displays the digits are numbered 7;6;5;4;3;2;1;0 and this one is numbered 0;1;2;3;4;5;6;7 Edited October 10, 2019 by crash test pilot
BULLITT83 Posted October 12, 2019 Author Posted October 12, 2019 hi guys ! some news : it works perfectly , i swap to another MAX7219 module and it's perfect , i just have to swap the numbering as CRASH TEST PILOT says. Thanks to you HAN SOLO and CRASH TEST PILOT !!
Hansolo Posted October 13, 2019 Posted October 13, 2019 Outstanding. Good job sir Cheers Hans 132nd Virtual Wing homepage & 132nd Virtual Wing YouTube channel My DCS-BIOS sketches & Cockpit Album
Silver101 Posted February 23, 2022 Posted February 23, 2022 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
Vinc_Vega Posted February 25, 2022 Posted February 25, 2022 (edited) 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 February 25, 2022 by Vinc_Vega Regards, Vinc real life: Royal Bavarian Airforce online: VJS-GermanKnights.de [sIGPIC][/sIGPIC]
Recommended Posts