' TFT Radiotext Interrupt Push Freq Rotate Volume ' scan soubroutine replaces data watchdog 0 memclear tft.cls() Tty.cls Tty "RDS Scanner Radio"&chr(10) Delay 2000 pwmfreq 15625 pwmout 38,50 'Backlight vol 40 oc = 0 scansnr = 30 gosub scan ix = 1 tty.size 4,-1,-2,320,-1 f = st(ix) freq f interrupt 21, [push] interrupt 1,[rotate] interrupt 2,[rotate] timer 222,showtime wait [rotate] if io(laststat,1) = 1 then a = 1 else a = 0 if io(laststat,2) = 1 then b = 1 else b = 0 c = a + b rot = 0 if c = 1 and oc = 2 then if a = 1 and b = 0 then rot = 1 if a = 0 and b = 1 then rot = -1 vol rx.vol()+rot tft.text.draw(format("%02.0f",rx.vol()),320-16,170-16,1) endif oc = c wait showtime: txt = trim(rx.text()) if otxt<>txt then txt = txt & " " for i = 1 to len(txt) 'ticker tty mid(txt,i,1) delay 60 next i otxt=txt endif sta = rx.station() if ost <> sta and sta <> "" then tft.text.draw(" " & sta & " ",160,140,4) ost = sta wait [push] if io(laststat,21) = 1 then wait If N = 0 then Gosub scan Wait Endif Inc ix if ix > N then ix = 1 f = st(ix) freq f tft.text.draw(format("%5.1f",f),16,170-16,1) wait scan: Dim st(30) f = 87.5 Rx f Vol 0 Tty "Scanning..." & chr(10) i = 0 do Freq f If rx.snr() > scansnr then Inc i st(i) = f Tty f &chr(10) Endif f = f + 0.1 Loop until (i=30) or(f=108) Tty "Found " & Str(i) & chr(10) N = i Delay 2000 Return