'Nixie-Uhr für Atmega88/168/328 mit einer Ziffer Version 1.2 'Version 1.1 produced a hearable frequency from the coil of the HV-Generator. 'It depanded of it's load that depended on the duty-cycle of the tiles. 'In this version the frequency was divided by 10 $regfile = "m88def.dat" $crystal = 10000000 $hwstack = 128 $swstack = 128 $framesize = 128 $baud = 19200 'the script won't work without configured RS232 Config Com1 = Dummy, Synchrone = 0, Parity = None, Stopbits = 1, Databits = 8, Clockpol = 0 Config Dcf77 = Pind.6 , Timer = 1 , Timer1sec = 1 , Debug = 1 , Inverted = 0 , Check = 0 Enable Interrupts Config Date = Dmy , Separator = . Dim I As Integer dim j as byte dim k as byte dim valuestring as string * 10 dim js as string * 1 dim value as byte dim schleifenzaehler as byte dim an as word dim aus as word dim z as word dim pulse as word pulse = 70 Dim Sec_old As Byte , Dcfsec_old As Byte 'Nixie-Labels config portB.1 = output config portB.2 = output config portB.3 = output config portB.4 = output config portB.5 = output config portc.0 = output config portc.1 = output config portc.2 = output config portc.3 = output config portc.4 = output config portd.2 = output 'glow-lamps config portd.7 = output config portb.0 = output 'Labels to ports digit1 alias portb.5 digit2 alias portc.2 digit3 alias portc.1 digit4 alias portb.4 digit5 alias portc.0 digit6 alias portb.3 digit7 alias portd.7 digit8 alias portb.2 digit9 alias portb.1 digit0 alias portc.3 glimm1 alias portb.0 glimm2 alias portc.4 signal_LED alias portD.2 schleifenzaehler =0 'Einschaltsignal 3x blinken signal_led = 1 waitms 250 signal_led =0 waitms 250 signal_led = 1 waitms 250 signal_led =0 waitms 250 signal_led = 1 waitms 250 signal_led =0 Sec_old = 99 : Dcfsec_old = 99 'Preselection unitl DCF77-synchronsiation time$="00:00:00" glimm1=1 glimm2=0 for j = 9 to 0 step -1 js= str(j) valuestring = Mid(js,1,1) toggle glimm1 toggle glimm2 gosub dimmenausgabe next toggle glimm1 toggle glimm2 wait 1 'Hauptschleife ######################## Do 'check if dcf77 signal is renewed gosub getdcf77 schleifenzaehler = schleifenzaehler+1 'hour high: valuestring = Mid(time$,1,1) gosub dimmenausgabe toggle glimm1 toggle glimm2 'hour low: valuestring = Mid(time$,2,1) gosub dimmenausgabe toggle glimm1 toggle glimm2 'minute high: valuestring = Mid(time$,4,1) gosub dimmenausgabe toggle glimm1 toggle glimm2 'minute low: valuestring = Mid(time$,5,1) gosub dimmenausgabe toggle glimm1 toggle glimm2 'after displaying hours and minutes with active labels, 'there will follow 2 times without any nixie-labels activated. 'To get the same delay as active labels have, i used the same procedures as for active labels, '..but without driving the labels actively, so they stay passively about 2 rounds. '"10" means all labels off. 'Only the glowlamps are blinking: valuestring = "10" gosub dimmenausgabe toggle glimm1 toggle glimm2 valuestring = "10" gosub dimmenausgabe toggle glimm1 toggle glimm2 'clear dcf77-flag every round about 5 minutes if schleifenzaehler = 30 then dcf_status.7 = 0 schleifenzaehler =0 endif loop '########################## getdcf77: 'Getting Time from DCF77-Transmitter. Representing it in Time$ 'Routine needs about 1s Print "waiting for time-information..." 'LED on when time-signal ist completed = dcf_status.7 signal_LED = dcf_status.7 For I = 1 To 78 Waitms 10 If Sec_old <> _sec Then Exit For End If If Dcfsec_old <> Dcf_sec Then Exit For End If Next 'Waitms 220 Sec_old = _sec Dcfsec_old = Dcf_sec Print Time$ ; " " ; Date$ ; " " ; Time(dcf_sec) ; " " ; Date(dcf_day) ; " " ; Bin(dcf_status) ; " " ; Bin(dcf_bits) ; " " ; Bdcf_impuls ; " " ; Bdcf_pause return '+++++++++++++++++++++++ 'pwm-driven output by nixie-labels dimmenausgabe: value = Val(valuestring) ' -- 0 -- if value = 0 then for z = 0 to pulse step 1 an = z aus = pulse - z an = an*100 aus = aus*100 digit0 = 1 waitus an digit0 = 0 waitus aus next z digit0=1 waitms 500 for z = pulse to 0 step -1 an = z aus = pulse - z an = an*100 aus = aus*100 digit0 = 1 waitus an digit0 = 0 waitus aus next z endif ' -- 1 -- if value = 1 then for z = 0 to pulse step 1 an = z aus = pulse - z an = an*100 aus = aus*100 digit1 = 1 waitus an digit1 = 0 waitus aus next z digit1=1 waitms 500 for z = pulse to 0 step -1 an = z aus = pulse - z an = an*100 aus = aus*100 digit1 = 1 waitus an digit1 = 0 waitus aus next z endif ' -- 2 -- if value = 2 then for z = 0 to pulse step 1 an = z aus = pulse - z an = an*100 aus = aus*100 digit2 = 1 waitus an digit2 = 0 waitus aus next z digit2=1 waitms 500 for z = pulse to 0 step -1 an = z aus = pulse - z an = an*100 aus = aus*100 digit2 = 1 waitus an digit2 = 0 waitus aus next z endif ' -- 3 -- if value = 3 then for z = 0 to pulse step 1 an = z aus = pulse - z an = an*100 aus = aus*100 digit3 = 1 waitus an digit3 = 0 waitus aus next z digit3=1 waitms 500 for z = pulse to 0 step -1 an = z aus = pulse - z an = an*100 aus = aus*100 digit3 = 1 waitus an digit3 = 0 waitus aus next z endif ' -- 4 -- if value = 4 then for z = 0 to pulse step 1 an = z aus = pulse - z an = an*100 aus = aus*100 digit4 = 1 waitus an digit4 = 0 waitus aus next z digit4=1 waitms 500 for z = pulse to 0 step -1 an = z aus = pulse - z an = an*100 aus = aus*100 digit4 = 1 waitus an digit4 = 0 waitus aus next z endif ' -- 5 -- if value = 5 then for z = 0 to pulse step 1 an = z aus = pulse - z an = an*100 aus = aus*100 digit5 = 1 waitus an digit5 = 0 waitus aus next z digit5=1 waitms 500 for z = pulse to 0 step -1 an = z aus = pulse - z an = an*100 aus = aus*100 digit5 = 1 waitus an digit5 = 0 waitus aus next z endif ' -- 6 -- if value = 6 then for z = 0 to pulse step 1 an = z aus = pulse - z an = an*100 aus = aus*100 digit6 = 1 waitus an digit6 = 0 waitus aus next z digit6=1 waitms 500 for z = pulse to 0 step -1 an = z aus = pulse - z an = an*100 aus = aus*100 digit6 = 1 waitus an digit6 = 0 waitus aus next z endif ' -- 7 -- if value = 7 then for z = 0 to pulse step 1 an = z aus = pulse - z an = an*100 aus = aus*100 digit7 = 1 waitus an digit7 = 0 waitus aus next z digit7=1 waitms 500 for z = pulse to 0 step -1 an = z aus = pulse - z an = an*100 aus = aus*100 digit7 = 1 waitus an digit7 = 0 waitus aus next z endif ' -- 8 -- if value = 8 then for z = 0 to pulse step 1 an = z aus = pulse - z an = an*100 aus = aus*100 digit8 = 1 waitus an digit8 = 0 waitus aus next z digit8=1 waitms 500 for z = pulse to 0 step -1 an = z aus = pulse - z an = an*100 aus = aus*100 digit8 = 1 waitus an digit8 = 0 waitus aus next z endif ' -- 9 -- if value = 9 then for z = 0 to pulse step 1 an = z aus = pulse - z an = an*100 aus = aus*100 digit9 = 1 waitus an digit9 = 0 waitus aus next z digit9=1 waitms 500 for z = pulse to 0 step -1 an = z aus = pulse - z an = an*100 aus = aus*100 digit9 = 1 waitus an digit9 = 0 waitus aus next z endif ' -- 10 -- all digits off. It works as a time-constant without labels on if value = 10 then for z = 0 to pulse step 1 an = z aus = pulse - z an = an*100 aus = aus*100 waitus an waitus aus next z waitms 500 for z = pulse to 0 step -1 an = z aus = pulse - z an = an*100 aus = aus*100 waitus an waitus aus next z endif return '-------------------------------- End