I want to place a frequency display on an old radio. I saw a beautiful design with nixie tubes on YouTube. I had to retype the software from the video. I can't get in touch with the designer. The oscillator signal is presented on A5 of the Arduino. (after dividing by 8 with a CD4040) The pulses come in nicely. But the counter keeps running, which is not the intention. Counting must take place within a certain time window. The operation of counting is made clear by the LED of pin 13. This LED does not light up. I just can't find the error. Please some help. Marc ON4DM
Also here the schematic as seen on youtube. I connected A5 of the UNO to pin 6 of the CD4040 (16 divider). I also designed the input of the CD4040 (pin10) differently. I connected a frequency generator of 1 kHz to the CD4040. I have not connected any Nixie tubes yet. Is not important for testing the software. Marc
typ of plak hier code
// NIXIE DISPLAY RADIO
// put a nixie tube display to show the frequency of the old 1940's
// radio.
// DESIGN: GLASSLINGER (YOUTUBE)
// 06/03/2019
// ( https://www.youtube.com/watch?v=mvCwzLowmOo&t=2365s )
// COPIED BY ON4DM
// 29/03/2024
//*******************************************************************
//*******************************************************************
int led = 13;
int count;//input pulses on A5 in 100ms
int freq;//received frequency
int locosc;//local oscillator
int ones, tens, hunds, ovfl = 0;
int n;//junk variable
void process(int);//take countand output
void setup()
{ Serial.begin(9600);
pinMode(0, OUTPUT);
pinMode(1, OUTPUT);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(led, OUTPUT);
pinMode(A5, INPUT);//input pulse
//******* initialize timer 1 *********
noInterrupts();//ints off during setup
TCCR1A = 0;
TCCR1B = 0;
TCNT1 = 0;
OCR1A = 8020;//dick with this number to adjust freq
TCCR1B |= (1 << WGM12);//CTC MODE
TIMSK1 |= (1 << OCIE1A);//ENABLE TIMER ON
interrupts();//all ints on
}
//******* interrupt handling *******
ISR(TIMER1_COMPA_vect)
{
digitalWrite(led, digitalRead(led) ^ 1);
locosc = count;//save current count
count = 0;//start new count
process(locosc);
}
//******* code to increment the frequency count *******
void loop()
{ //Serial.println("hello");
n = digitalRead(A5);//read the state of the input pin A5
if (n == 1)
count ++;//count the pulses
while (n == 1)//wait for input pin to go low
n = digitalRead(A5);
//Serial.println(count);
}
//******* code to change the binary count to BCD *******
void process(int)
{
freq = locosc - 455;//loc osc - IF
hunds = 0;
tens = 0;
ones = 0;
ovfl = 0;
//do the overflow 1
if (freq > 1000)
ovfl = 1;//set top digit, freq over 1
hunds = freq % 1000;//get rid of counts
tens = hunds % 100;//get rid of counts
ones = tens % 10;//this directly the hunds
hunds = hunds - tens;//this strips the thens
hunds = hunds / 100;//convert to digit
tens = tens - ones;//this strips the ones
tens = tens / 10;//convert to digit
// output the digit nibbles to the port pins
// reads the bit from the digit
// countand output the bit
// to the UNO pin
digitalWrite(0, bitRead(ones, 0));
digitalWrite(1, bitRead(ones, 1));
digitalWrite(2, bitRead(ones, 2));
digitalWrite(3, bitRead(ones, 3));
digitalWrite(4, bitRead(tens, 0));
digitalWrite(5, bitRead(tens, 1));
digitalWrite(6, bitRead(tens, 2));
digitalWrite(7, bitRead(tens, 3));
digitalWrite(8, bitRead(hunds, 0));
digitalWrite(9, bitRead(hunds, 1));
digitalWrite(10, bitRead(hunds, 2));
digitalWrite(11, bitRead(hunds, 3));
digitalWrite(12, bitRead(ovfl, 0));
}```