Jump to content

giebby

Members
  • Posts

    6
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hehe Whiskey is my go-to when I drink as well :) Code wise, The above might have been a step back. I get a flash of all digits and then just get a #1 displaying on digit 0. ------------------------------------------- I found something interesting with the previous code. It is working partially. I can get it to display after coaxing it to work. It is also related to the extra digit. Let me explain below by the steps I do to get it to work. -Freshly uploaded sketch to arduino -I enter a string of 125.500 in DCSBIOS debugger -Connect. Display goes all blank except digit 5 (last one) which is an "A" -Change string in debugger to 125500 (no decimal) and it displays properly with decimal -Change string in debuger to another random number and displays properly with decimal and accepts changes Now here is where it gets weird. I think "OK, the debugger doesn't like me putting in manual decimals. Let's try it without." It seems to have a harder time with it now. -Freshly uploaded sketch to arduino -Enter a string of 125500 in DCSBIOS debugger (no decimal) -Connect. Display goes all blank again except digit 5 (last one) which is an "A" again. -Change string in debuger to another random number without decimal. NO CHANGE -Change string in debuger to random number WITH decimal. Display shows all digits with extra number as before. (example: 125.6.52 when should be 125.520) -Change string to another random number in debuger WITHOUT decimal. Display is now working and accepting string changes. I am suspecting that this might have to do something with a "clear display" type of command? I tried some digitalwrite latchpin HIGH commands but it didn't want to seem to compile. I was trying to write something to tell the display to turn off or refresh itself before writing the new string... but what do I know... oh man.. Thanks again boss (my partially working code from previous post you helped with) #define DCSBIOS_IRQ_SERIAL #include <DcsBios.h> const int clockpin = 7; //SCK const int latchpin = 5; //RCK const int datapin = 6; //DIO const int num_of_digits = 6; /* Segment bit location(7=MSB, 0=LSB): * * |--0--| * 5| |1 * |--6--| * 4| |2 * |--3--| **7 */ // Array with possible values(0 = segment ON, 1 = segment off) byte value[] ={ B11000000, // 0 B11111001, // 1 B10100100, // 2 B10110000, // 3 B10011001, // 4 B10010010, // 5 B10000010, // 6 B11111000, // 7 B10000000, // 8 B10010000, // 9 B11111111,};// display nothing byte digit[] ={ B00010000, // left segment B00100000, B01000000, B00000001, B00000010, B00000100,};// right segment void showDigit(int segmentnum, int number, bool showdecimalpoint) { digitalWrite(latchpin,LOW); byte value_temp = value[number]; value_temp = showdecimalpoint ? (value_temp & B01111111) : value_temp; shiftOut(datapin,clockpin,MSBFIRST,value_temp); shiftOut(datapin,clockpin,MSBFIRST,digit[segmentnum]); digitalWrite(latchpin,HIGH); } void setup() { pinMode(clockpin, OUTPUT); pinMode(latchpin, OUTPUT); pinMode(datapin, OUTPUT); DcsBios::setup(); } void onPltVuhfRemoteDispChange(char* newValue) { //trying to pull the char* array into each digit with the bool decimal with a delay to show the number(?) if (atoi(newValue) > 0) { for (int i = 0; i < strlen(newValue); i++) { if (i = 0) showDigit(i, newValue[i] - 48, 0); // atoi function removed and char converted to int as shown in https://forum.arduino.cc/index.php?topic=443605.0 else showDigit(i, newValue[i] - 48, 0); if (i = 1) showDigit(i, newValue[i] - 48, 0); else showDigit(i, newValue[i] - 48, 0); if (i = 2) showDigit(i, newValue[i] - 48, 1); else showDigit(i, newValue[i] - 48, 0); if (i = 3) showDigit(i, newValue[i] - 48, 0); else showDigit(i, newValue[i] - 48, 0); if (i = 4) showDigit(i, newValue[i] - 48, 0); else showDigit(i, newValue[i] - 48, 0); if (i = 5) showDigit(i, newValue[i] - 48, 0); else showDigit(i, newValue[i] - 48, 0); } } } DcsBios::StringBuffer<7> pltVuhfRemoteDispBuffer(0x1484, onPltVuhfRemoteDispChange); void loop() { DcsBios::loop(); }
  2. I was able to clear up the decimals and now working on the random number on digit 3. It is always presenting the number 6 with a bool (decimal). Not 100% why but I am going to fiddle with it and see what I can come up with.
  3. Well we have some success in this code above my friend. I am getting most numbers displaying now with the example code above (and make changes in the debugger for them to display! YAY!). With some modifications of course (code below) I have an issue with the bool. Currently with my code now, the 4th digit is always displaying the number 6. I ran a few tests with some different number combinations and it appears that the code is having a hard time with the bool. The 5th digit seems to be what the 4th digit should be so that leads me to believe it is something with the bool. Also, on the bool subject, I am showing bool (decimal) on all digits except 0. What I am seeing on my display is exampled below Example on display: 13.3.6.1.0. when the call should be 133.105 I need to buy you lots of beers. I know it is almost there. Oh man... :thumbup: #define DCSBIOS_IRQ_SERIAL #include <DcsBios.h> const int clockpin = 7; //SCK const int latchpin = 5; //RCK const int datapin = 6; //DIO const int num_of_digits = 6; /* Segment bit location(7=MSB, 0=LSB): * * |--0--| * 5| |1 * |--6--| * 4| |2 * |--3--| **7 */ // Array with possible values(0 = segment ON, 1 = segment off) byte value[] ={ B11000000, // 0 B11111001, // 1 B10100100, // 2 B10110000, // 3 B10011001, // 4 B10010010, // 5 B10000010, // 6 B11111000, // 7 B10000000, // 8 B10010000, // 9 B11111111};// display nothing byte digit[] ={ B00010000, // left segment B00100000, B01000000, B00000001, B00000010, B00000100,};// right segment void showDigit(int segmentnum, int number, bool showdecimalpoint) { digitalWrite(latchpin,LOW); byte value_temp = value[number]; value_temp = showdecimalpoint ? (value_temp & B01111111) : value_temp; shiftOut(datapin,clockpin,MSBFIRST,value_temp); shiftOut(datapin,clockpin,MSBFIRST,digit[segmentnum]); digitalWrite(latchpin,HIGH); } void setup() { pinMode(clockpin, OUTPUT); pinMode(latchpin, OUTPUT); pinMode(datapin, OUTPUT); DcsBios::setup(); } void onPltVuhfRemoteDispChange(char* newValue) { //trying to pull the char* array into each digit with the bool decimal with a delay to show the number(?) if (atoi(newValue) > 0) { for (int i = 0; i < strlen(newValue); i++) { if (i = 0) showDigit(i, newValue[i] - 48, 1); // atoi function removed and char converted to int as shown in https://forum.arduino.cc/index.php?topic=443605.0 else showDigit(i, newValue[i] - 48, 0); // atoi function removed and char converted to int as shown in https://forum.arduino.cc/index.php?topic=443605.0 if (i = 1) showDigit(i, newValue[i] - 48, 1); // atoi function removed and char converted to int as shown in https://forum.arduino.cc/index.php?topic=443605.0 else showDigit(i, newValue[i] - 48, 0); // atoi function removed and char converted to int as shown in https://forum.arduino.cc/index.php?topic=443605.0 if (i = 2) showDigit(i, newValue[i] - 48, 1); // atoi function removed and char converted to int as shown in https://forum.arduino.cc/index.php?topic=443605.0 else showDigit(i, newValue[i] - 48, 0); // atoi function removed and char converted to int as shown in https://forum.arduino.cc/index.php?topic=443605.0 if (i = 3) showDigit(i, newValue[i] - 48, 1); // atoi function removed and char converted to int as shown in https://forum.arduino.cc/index.php?topic=443605.0 else showDigit(i, newValue[i] - 48, 0); // atoi function removed and char converted to int as shown in https://forum.arduino.cc/index.php?topic=443605.0 if (i = 4) showDigit(i, newValue[i] - 48, 1); // atoi function removed and char converted to int as shown in https://forum.arduino.cc/index.php?topic=443605.0 else showDigit(i, newValue[i] - 48, 0); // atoi function removed and char converted to int as shown in https://forum.arduino.cc/index.php?topic=443605.0 if (i = 5) showDigit(i, newValue[i] - 48, 1); // atoi function removed and char converted to int as shown in https://forum.arduino.cc/index.php?topic=443605.0 else showDigit(i, newValue[i] - 48, 0); // atoi function removed and char converted to int as shown in https://forum.arduino.cc/index.php?topic=443605.0 } } } DcsBios::StringBuffer<7> pltVuhfRemoteDispBuffer(0x1484, onPltVuhfRemoteDispChange); void loop() { DcsBios::loop(); }
  4. Hello! Thank you for your continued help. I almost threw in the towel and decided to wait for the TM's but guess what, they cancelled my order. LOL Now to order from another store and wait the 90 days.. I ran the code presented above. There were some compiling errors but it did write to the Arduino. During initial power on the display is blank (perfect) but when I transmit the frequency (DCS-BIOS Debugger) it only has one digit displaying. It is the 3rd digit as a 0 with the bool (decimal). Compiling error is below: C:\Users\AL\Documents\Arduino\DCS_VUHF_F14_Remote_Display\DCS_VUHF_F14_Remote_Display_v2\DCS_VUHF_F14_Remote_Display_v2.ino: In function 'void onPltVuhfRemoteDispChange(char*)': C:\Users\AL\Documents\Arduino\DCS_VUHF_F14_Remote_Display\DCS_VUHF_F14_Remote_Display_v2\DCS_VUHF_F14_Remote_Display_v2.ino:60:37: warning: invalid conversion from 'char' to 'const char*' [-fpermissive] showDigit(i, atoi(newValue[i]), 1); ~~~~~~~~~~^ In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:23:0, from sketch\DCS_VUHF_F14_Remote_Display_v2.ino.cpp:1: c:\program files (x86)\arduino\hardware\tools\avr\avr\include\stdlib.h:276:12: note: initializing argument 1 of 'int atoi(const char*)' extern int atoi(const char *__s) __ATTR_PURE__; ^~~~ C:\Users\AL\Documents\Arduino\DCS_VUHF_F14_Remote_Display\DCS_VUHF_F14_Remote_Display_v2\DCS_VUHF_F14_Remote_Display_v2.ino:62:37: warning: invalid conversion from 'char' to 'const char*' [-fpermissive] showDigit(i, atoi(newValue[i]), 0); ~~~~~~~~~~^ In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:23:0, from sketch\DCS_VUHF_F14_Remote_Display_v2.ino.cpp:1: c:\program files (x86)\arduino\hardware\tools\avr\avr\include\stdlib.h:276:12: note: initializing argument 1 of 'int atoi(const char*)' extern int atoi(const char *__s) __ATTR_PURE__; ^~~~ Sketch uses 2932 bytes (1%) of program storage space. Maximum is 253952 bytes. Global variables use 149 bytes (1%) of dynamic memory, leaving 8043 bytes for local variables. Maximum is 8192 bytes.
  5. Thank you for the past two posts. I appreciate it. I was trying to dive into it more before replying but I am stumped. I took your information above to heart and modified the code but now getting a primary expression error in the loop (first line of course). Thanks for taking the time to take a look. #define DCSBIOS_IRQ_SERIAL #include <DcsBios.h> const int clockpin = 7; //SCK const int latchpin = 5; //RCK const int datapin = 6; //DIO const int num_of_digits = 6; /* Segment bit location(7=MSB, 0=LSB): * * |--0--| * 5| |1 * |--6--| * 4| |2 * |--3--| **7 */ // Array with possible values(0 = segment ON, 1 = segment off) byte value[] ={ B11000000, // 0 B11111001, // 1 B10100100, // 2 B10110000, // 3 B10011001, // 4 B10010010, // 5 B10000010, // 6 B11111000, // 7 B10000000, // 8 B10010000, // 9 B11111111};// display nothing byte digit[] ={ B00010000, // left segment B00100000, B01000000, B00000001, B00000010, B00000100,};// right segment void showDigit(int segmentnum, int number, bool showdecimalpoint) { digitalWrite(latchpin,LOW); byte value_temp = value[number]; value_temp = showdecimalpoint ? (value_temp & B01111111) : value_temp; shiftOut(datapin,clockpin,MSBFIRST,value_temp); shiftOut(datapin,clockpin,MSBFIRST,digit[segmentnum]); digitalWrite(latchpin,HIGH); } void setup() { pinMode(clockpin, OUTPUT); pinMode(latchpin, OUTPUT); pinMode(datapin, OUTPUT); DcsBios::setup(); } void onPltVuhfRemoteDispChange(char* newValue) { //trying to pull the char* array into each digit with the bool decimal with a delay to show the number(?) showDigit(0,newValue[0],0); delay(5); showDigit(1,newValue[0],0); delay(5); showDigit(2,newValue[0],1); delay(5); showDigit(3,newValue[0],0); delay(5); showDigit(4,newValue[0],0); delay(5); showDigit(5,newValue[0],0); delay(5); } DcsBios::StringBuffer<7> pltVuhfRemoteDispBuffer(0x1484, onPltVuhfRemoteDispChange); void loop() {; for(char i = * ; i < 0 ; i) //trying to push loop to show digit by saying something like if the char # is bigger then 0, display and show digit. Totally losing my self in the logic. { showDigit(i, i, true); DcsBios::loop(); }
  6. Hello fine pilots, I have been struggling with some coding for displaying the F14B V/UHF PILOT Remote Display in Arduino. Lucky me while in the lust for learning I bought the more difficult chip to code. The module I have is a: https://robotdyn.com/6-digit-led-display-tube-7-segments-74hc595.html . I ordered other display tubes with the TM1637's but it seems to be taking its sweet time from China so I am trying to make these work. I found demo multiplexing code in where I can modify slightly to run a counter for all 6 digits. Here is the code I found below: const int clockpin = 7; //SCK const int latchpin = 5; //RCK const int datapin = 6; //DIO const int num_of_digits = 8; /* Segment bit location(7=MSB, 0=LSB): * * |--0--| * 5| |1 * |--6--| * 4| |2 * |--3--| **7 */ // Array with possible values(0 = segment ON, 1 = segment off) byte value[] ={ B11000000, // 0 B11111001, // 1 B10100100, // 2 B10110000, // 3 B10011001, // 4 B10010010, // 5 B10000010, // 6 B11111000, // 7 B10000000, // 8 B10010000, // 9 B11111111};// display nothing byte digit[] ={ B00010000, // left segment B00100000, B01000000, B10000000, B00000001, B00000010, B00000100, B00001000 }; // right segment void showDigit(int segmentnum, int number, bool showdecimalpoint) { digitalWrite(latchpin,LOW); byte value_temp = value[number]; value_temp = showdecimalpoint ? (value_temp & B01111111) : value_temp; shiftOut(datapin,clockpin,MSBFIRST,value_temp); shiftOut(datapin,clockpin,MSBFIRST,digit[segmentnum]); digitalWrite(latchpin,HIGH); } int counter = 0; void demoDelay() { // *** Delay for demo purposes only *** counter++; if(counter <= num_of_digits) { delay(200); } else { delay(1); if(counter >= (num_of_digits*200)) { counter = 0; } } // ************************************ } void setup() { pinMode(clockpin, OUTPUT); pinMode(latchpin, OUTPUT); pinMode(datapin, OUTPUT); } void loop() {; for(int i = 0; i < num_of_digits; i++) { showDigit(i, i, true); demoDelay(); } } I KNOW my issues stem from lack of coding xp. I have been fiddling with this for a few weeks now and have made very slow progress. The best I can do is modify existing code for the module to display slightly different. I am unsure how to incorporate this found multiplexing code with DCS BIOS and its example. I've looked for awhile (RTFM) and did a few stints at W3 schools to help understand more of C but I tend to get lost without the ability to throw questions out there. Here is my code below so far get this thing to work. I am losing my mind over this as I know it is probably simple but I cannot seem to figure it out. I'd love to see if anyone can lend a few minutes to look it over. :doh::helpsmilie: #define DCSBIOS_IRQ_SERIAL #include <DcsBios.h> const int clockpin = 7; //SCK const int latchpin = 5; //RCK const int datapin = 6; //DIO const int num_of_digits = 6; /* Segment bit location(7=MSB, 0=LSB): * * |--0--| * 5| |1 * |--6--| * 4| |2 * |--3--| **7 */ // Array with possible values(0 = segment ON, 1 = segment off) byte value[] ={ B11000000, // 0 B11111001, // 1 B10100100, // 2 B10110000, // 3 B10011001, // 4 B10010010, // 5 B10000010, // 6 B11111000, // 7 B10000000, // 8 B10010000, // 9 B11111111};// display nothing byte digit[] ={ B00010000, // left segment B00100000, B01000000, B00000001, B00000010, B00000100,};// right segment void showDigit(int segmentnum, int number, bool showdecimalpoint) { digitalWrite(latchpin,LOW); byte value_temp = value[number]; value_temp = showdecimalpoint ? (value_temp & B01111111) : value_temp; shiftOut(datapin,clockpin,MSBFIRST,value_temp); shiftOut(datapin,clockpin,MSBFIRST,digit[segmentnum]); digitalWrite(latchpin,HIGH); } void setup() { pinMode(clockpin, OUTPUT); pinMode(latchpin, OUTPUT); pinMode(datapin, OUTPUT); DcsBios::setup(); } void onPltVuhfRemoteDispChange(char* newValue) { //no idea what I am doing here but trying to pull the char* array into each digit showDigit(newValue[0]); showDigit(newValue[1]); showDigit(newValue[2]); showDigit(newValue[3]); showDigit(newValue[4]); showDigit(newValue[5]); showDigit(newValue[6]); showDigit(newValue[7]); } DcsBios::StringBuffer<7> pltVuhfRemoteDispBuffer(0x1484, onPltVuhfRemoteDispChange); void loop() { DcsBios::loop(); } } giebby
×
×
  • Create New...