diff options
| author | Christoph Berg <myon@debian.org> | 2026-04-07 19:02:45 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2026-04-07 19:02:45 +0200 |
| commit | f647d78463c1250ce9c99af664615fafccf5e959 (patch) | |
| tree | 5b00428cef68aef1c9d407e2d4535687422419b6 /map65/libm65/fil6521.f90 | |
| parent | 0a13f1fdb9928b6d012569dd65f7f6ef18fac2f8 (diff) | |
New upstream version 3.0.0upstream/3.0.0
Diffstat (limited to 'map65/libm65/fil6521.f90')
| -rw-r--r--[-rwxr-xr-x] | map65/libm65/fil6521.f90 | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/map65/libm65/fil6521.f90 b/map65/libm65/fil6521.f90 index 3b1899c2..f588d0c1 100755..100644 --- a/map65/libm65/fil6521.f90 +++ b/map65/libm65/fil6521.f90 @@ -1,44 +1,44 @@ -subroutine fil6521(c1,n1,c2,n2)
-
-! FIR lowpass filter designed using ScopeFIR
-
-! Pass #1 Pass #2
-!-----------------------------------------------
-! fsample (Hz) 1378.125 Input sample rate
-! Ntaps 21 Number of filter taps
-! fc (Hz) 40 Cutoff frequency
-! fstop (Hz) 172.266 Lower limit of stopband
-! Ripple (dB) 0.1 Ripple in passband
-! Stop Atten (dB) 38 Stopband attenuation
-! fout (Hz) 344.531 Output sample rate
-
- parameter (NTAPS=21)
- parameter (NH=(NTAPS-1)/2)
- parameter (NDOWN=4) !Downsample ratio = 1/4
- complex c1(n1)
- complex c2(n1/NDOWN)
-
-! Filter coefficients:
- real a(-NH:NH)
- data a/ &
- -0.011958606980,-0.013888627387,-0.015601306443,-0.010602249570, &
- 0.003804023436, 0.028320058273, 0.060903935217, 0.096841904411, &
- 0.129639871228, 0.152644580853, 0.160917511283, 0.152644580853, &
- 0.129639871228, 0.096841904411, 0.060903935217, 0.028320058273, &
- 0.003804023436,-0.010602249570,-0.015601306443,-0.013888627387, &
- -0.011958606980/
-
- n2=(n1-NTAPS+NDOWN)/NDOWN
- k0=NH-NDOWN+1
-
-! Loop over all output samples
- do i=1,n2
- c2(i)=0.
- k=k0 + NDOWN*i
- do j=-NH,NH
- c2(i)=c2(i) + c1(j+k)*a(j)
- enddo
- enddo
-
- return
-end subroutine fil6521
+subroutine fil6521(c1,n1,c2,n2) + +! FIR lowpass filter designed using ScopeFIR + +! Pass #1 Pass #2 +!----------------------------------------------- +! fsample (Hz) 1378.125 Input sample rate +! Ntaps 21 Number of filter taps +! fc (Hz) 40 Cutoff frequency +! fstop (Hz) 172.266 Lower limit of stopband +! Ripple (dB) 0.1 Ripple in passband +! Stop Atten (dB) 38 Stopband attenuation +! fout (Hz) 344.531 Output sample rate + + parameter (NTAPS=21) + parameter (NH=(NTAPS-1)/2) + parameter (NDOWN=4) !Downsample ratio = 1/4 + complex c1(n1) + complex c2(n1/NDOWN) + +! Filter coefficients: + real a(-NH:NH) + data a/ & + -0.011958606980,-0.013888627387,-0.015601306443,-0.010602249570, & + 0.003804023436, 0.028320058273, 0.060903935217, 0.096841904411, & + 0.129639871228, 0.152644580853, 0.160917511283, 0.152644580853, & + 0.129639871228, 0.096841904411, 0.060903935217, 0.028320058273, & + 0.003804023436,-0.010602249570,-0.015601306443,-0.013888627387, & + -0.011958606980/ + + n2=(n1-NTAPS+NDOWN)/NDOWN + k0=NH-NDOWN+1 + +! Loop over all output samples + do i=1,n2 + c2(i)=0. + k=k0 + NDOWN*i + do j=-NH,NH + c2(i)=c2(i) + c1(j+k)*a(j) + enddo + enddo + + return +end subroutine fil6521 |
