[SOLVED !] FFT Code 18F4550


Closed Thread
Results 1 to 2 of 2

Thread: FFT Code 18F45501019 days old

  1. #1
    BLUER
    Guest BLUER's Avatar

    0 Not allowed!

    Default FFT Code 18F4550

    Hi!

    BASCOM could be solved with this code to the transcript of the PROTON compiler?

    18F4550 chip or 18F46KXX

    Code:
    ' _____________________________________________________________________________
    '|Program "analizator widma akustycznego 24*2 - V2" kompilator bascom 1.11.9.0 |
    '|Autor: HUNTERHOUSE(Adam Kędzierski) i częściowo MANEKINEN(Paweł Kisielewski) |
    '|   data: 21.12.2009                                                          |
    '|                                                                             |
    '| info: http://www.elektroda.pl/rtvforum/topic776332-0.html                   |
    '|  www: http://diy.elektroda.eu/analizator-widma-v2                           |
    '|   wszelkie modyfikacje dozwolone, publikując należy zachować ten nagłówek   |
    '|     WYŁĄCZNIE DO UŻYTKU NIEKOMERCYJNEGO   -    NON-COMMERCIAL USE ONLY      |
    ' -----------------------------------------------------------------------------
    
    $regfile = "m8def.dat"
    $crystal = 16000000
    
    Const Falloff = 1                                           'ilość cykli po jakim słupki opadną, wolne opadanie
    
    
    Const Timer1_h = _xtal / 44000
    Const Timer1_l = _xtal / 2000
    Reset Watchdog
    Config Watchdog = 256
    Stop Watchdog
    
    
    Dim Div As Iram Integer At 16
    Dim K As Byte
    Dim I As Byte
    Dim Tmp_s As Integer
    Dim Tmp_c As Integer
    Dim Beta As Iram Byte
    Dim Suma As Word
    Dim Sam As Byte
    Dim Sampling As Bit
    Dim Rex_t As Integer , Imx_t As Integer
    Dim Dane(32) As Integer
    Dim Sample_h(32) As Integer
    Dim Sample_l(32) As Integer
    Dim Okno(32) As Byte
    Dim Rex(16) As Integer
    Dim Sinus(40) As Integer
    Dim Wynik(24) As Byte , Wynik_o(24) As Byte                 'x
    Dim Sing As Single
    Dim Poziom As Integer
    Dim Line1d(24) As Byte                                      'x
    Dim Line2d(24) As Byte                                      'x
    Dim Falloff_count(24) As Byte                               'x
    
    $lib "lcd4busy.lib"
    Const _lcdport = Portd
    Const _lcdddr = Ddrd
    Const _lcdin = Pind
    Const _lcd_e = 3
    Const _lcd_rw = 2
    Const _lcd_rs = 1
    Config Lcd = 24 * 2                                         'x
    
    
    '****** dodano w wesji 2 ***********
    Dim Jasnosc_e As Eram Byte At 1
    Dim Czulosc_e As Eram Byte At 2
    Dim Efekt_e As Eram Byte At 3
    
    Dim Jasnosc As Byte
    Dim Jasnosc_vfd As Byte
    Dim Czulosc As Byte
    Dim Poziom_a As Byte
    Dim Efekt As Byte
    Dim Lazienka_jest_zamknieta As Byte                         'hahaha a czemu nie!
    Dim Uklad As Byte
    Dim Jasnosc_flaga As Bit
    Dim Czulosc_flaga As Bit
    
    Config Portb = &B00001000
    Portb = &B11111111
    Config Portc = Input
    Portc.5 = 1
    Portc.4 = 1
    Jasn_up Alias Pinb.5
    Jasn_dn Alias Pinb.4
    Czul_up Alias Pinb.2
    Czul_dn Alias Pinb.1
    Tryb Alias Pinb.0
    Presc Alias Pinc.5
    Vfd Alias Pinc.4
    'Dim Presc As Bit
    'Dim Vfd As Bit
    'Presc = 0
    'Vfd = 0
    
    Efekt = Efekt_e
    
    GoSub Lcdchr
    
    Czulosc = Czulosc_e
    'Czulosc = 15                                                '**************************
    Poziom_a = Czulosc * 0.4
    Poziom_a = 8 - Poziom_a
    
    Jasnosc = Jasnosc_e
    'Jasnosc = 50                                                '**************************
    Config Timer2 = PWM , Prescale = 1 , Compare PWM = Clear Up
    If Vfd = 0 Then
       Jasnosc_vfd = Jasnosc / 10
       If Jasnosc_vfd > 3 Then Jasnosc_vfd = 3
       Lcdcontrast Jasnosc_vfd
    Else
       Ocr2 = Jasnosc * 5
    End If
    
    '***** koniec **********************
    
    Config Adc = Single , Prescaler = 4 , Reference = Avcc
    Start Adc
    
    Config Timer1 = Timer , Prescale = 1
    On Compare1a Sampleh
    On Compare1b Samplel
    Compare1a = Timer1_h
    Compare1b = Timer1_l
    Enable Timer1
    Start Timer1
    
    Enable Interrupts
    Disable Int0
    Disable Int1
    
    For K = 0 To 31
    Sinus(K + 1) = LookUp(K , Tab_sin)
       'Okno(k + 1) = 255
       'Okno(k + 1) = Lookup(k , Okno_blackman)
       'Okno(k + 1) = Lookup(k , Okno_hamming)
       Okno(K + 1) = LookUp(K , Okno_hanning)
    Next K
    
    Sinus(33) = LookUp(0 , Tab_sin)
    Sinus(34) = LookUp(1 , Tab_sin)
    Sinus(35) = LookUp(2 , Tab_sin)
    Sinus(36) = LookUp(3 , Tab_sin)
    Sinus(37) = LookUp(4 , Tab_sin)
    Sinus(38) = LookUp(5 , Tab_sin)
    Sinus(39) = LookUp(6 , Tab_sin)
    Sinus(40) = LookUp(7 , Tab_sin)
    
    
    Start Watchdog
    
    
    
    
    Main:
    Do
    Reset Watchdog
    GoSub Buttons
    GoSub Sample_h
    Main_1:
    If Sampling = 1 Then GoTo Main_1
    
    GoSub Sample_l
    GoSub Copy_low
    GoSub Dft
    GoSub Przelicz_low
    GoSub Copy_high
    GoSub Dft
    GoSub Przelicz_high
    
    Main_3:
    If Sampling = 1 Then GoTo Main_3
    GoSub Save
    Loop
    
    
    Copy_high:
       Poziom = 0
    
       For K = 1 To 32
          Div = Sample_h(K)
          Asr r17:Ror r16:Asr r17:Ror r16
          Sample_h(K) = Div
          Poziom = Poziom + Sample_h(K)
       Next K
    
       Div = Poziom
       Asr r17:Ror r16:Asr r17:Ror r16:Asr r17:Ror r16:Asr r17:Ror r16
       Asr r17:Ror r16
       Poziom = Div
    
       For K = 1 To 32
          Dane(K) = Sample_h(K) - Poziom
          Dane(K) = Dane(K) * Okno(K)
          Div = Dane(K)
          Asr r17:Ror r16:Asr r17:Ror r16:Asr r17:Ror r16:Asr r17:Ror r16
          Asr r17:Ror r16:Asr r17:Ror r16:Asr r17:Ror r16:Asr r17:Ror r16
          Dane(K) = Div
          If Dane(K) > 127 Then Dane(K) = 127
          If Dane(K) < -127 Then Dane(K) = -127
       Next K
    Return
    
    
    
    Copy_low:
       Poziom = 0
    
       For K = 1 To 32
          Div = Sample_l(K)
          Asr r17:Ror r16:Asr r17:Ror r16
          Sample_l(K) = Div
          Poziom = Poziom + Sample_l(K)
       Next K
    
       Div = Poziom
       Asr r17:Ror r16:Asr r17:Ror r16:Asr r17:Ror r16:Asr r17:Ror r16
       Asr r17:Ror r16
       Poziom = Div
    
       For K = 1 To 32
          Dane(K) = Sample_l(K) - Poziom
          Dane(K) = Dane(K) * Okno(K)
          Div = Dane(K)
          Asr r17:Ror r16:Asr r17:Ror r16:Asr r17:Ror r16:Asr r17:Ror r16
          Asr r17:Ror r16:Asr r17:Ror r16:Asr r17:Ror r16:Asr r17:Ror r16
          Dane(K) = Div
          If Dane(K) > 127 Then Dane(K) = 127
          If Dane(K) < -127 Then Dane(K) = -127
       Next K
    Return
    
    
    
    
    Dft:
    For K = 1 To 15
     Rex_t = 0
     Imx_t = 0
    
       For I = 0 To 31
          Beta = I * K
          Beta = Beta And 31
          Tmp_s = Sinus(beta + 1) * Dane(I + 1)
          Tmp_c = Sinus(beta + 8) * Dane(I + 1)
    
          Div = Tmp_s
          Asr r17:Ror r16:Asr r17:Ror r16:Asr r17:Ror r16:Asr r17:Ror r16
          Asr r17:Ror r16:Asr r17:Ror r16:Asr r17:Ror r16:Asr r17:Ror r16
          Tmp_s = Div
    
          Div = Tmp_c
          Asr r17:Ror r16:Asr r17:Ror r16:Asr r17:Ror r16:Asr r17:Ror r16
          Asr r17:Ror r16:Asr r17:Ror r16:Asr r17:Ror r16:Asr r17:Ror r16
          Tmp_c = Div
    
    
         Rex_t = Rex_t + Tmp_c
         Imx_t = Imx_t - Tmp_s
    
       Next I
    
       Div = Rex_t
       Asr r17:Ror r16:Asr r17:Ror r16:Asr r17:Ror r16
       Rex_t = Div
    
       Div = Imx_t
       Asr r17:Ror r16:Asr r17:Ror r16:Asr r17:Ror r16
       Imx_t = Div
    
       Tmp_c = Rex_t * Rex_t
       Tmp_s = Imx_t * Imx_t
    
    
       Tmp_c = Tmp_c + Tmp_s
       Rex(K + 1) = Sqr(tmp_c)
    Next K
    Return
    
    
    
    Sample_l:
    'pobiera 32 próbki z częstotliwością 2kHz
    Config Adc = Single , Prescaler = Auto , Reference = Avcc
    Start Adc
    
    Timer1 = 0
    Enable Compare1b
    Sam = 0
    Sampling = 1
    Return
    
    
    Samplel:
    Timer1 = 0
    Incr Sam
    Sample_l(Sam) = Getadc(1)                                   'NIŻSZE PASMO
    If Sam = 32 Then
       Disable Compare1b
       Sampling = 0
    End If
    Return
    
    
    
    
    Sample_h:
    'pobiera 32 próbki z częstotliwością 44kHz
    If Presc = 0 Then
       Config Adc = Single , Prescaler = 4 , Reference = Avcc
    Else
       Config Adc = Single , Prescaler = 2 , Reference = Avcc
    End If
    'ADC działa już dość niestabilnie na preskalerze 2 ale na 4 już sie nie wyrobi i prubkuje z f=37kHz
    ' przez duże f pojawiaja sie szumy jak podajemy sygnał z generatora
    Start Adc
    
    Timer1 = 0
    Enable Compare1a
    Sam = 0
    Sampling = 1
    Return
    
    Sampleh:
    Timer1 = 0
    Incr Sam
    Sample_h(Sam) = Getadc(0)                                   'WYŻSZE PASMO
    If Sam = 32 Then
       Disable Compare1a
       Sampling = 0
    End If
    Return
    
    
    
    Przelicz_high:                                              'x
    Suma = Rex(3)
    Wynik(13) = Suma
    
    Suma = Rex(4)
    Wynik(14) = Suma
    
    Suma = Rex(5)
    Wynik(15) = Suma
    
    Suma = Rex(6)
    Wynik(16) = Suma
    
    Suma = Rex(7)
    Wynik(17) = Suma
    
    Suma = Rex(8)
    Wynik(18) = Suma
    
    Suma = Rex(9)
    Wynik(19) = Suma
    
    Suma = Rex(10)
    Wynik(20) = Suma
    
    Suma = Rex(11)
    Wynik(21) = Suma
    
    Suma = Rex(12)
    Wynik(22) = Suma
    
    Suma = Rex(13)
    If Rex(14) > Suma Then Suma = Rex(14)
    Wynik(23) = Suma
    
    Suma = Rex(15)
    If Rex(16) > Suma Then Suma = Rex(16)
    Wynik(24) = Suma
    Return
    
    Return
    
    
    
    Przelicz_low:                                               'x
    Suma = Rex(2)
    Wynik(1) = Suma
    
    Suma = Rex(3)
    Wynik(2) = Suma
    
    Suma = Rex(4)
    Wynik(3) = Suma
    
    Suma = Rex(5)
    Wynik(4) = Suma
    
    Suma = Rex(6)
    Wynik(5) = Suma
    
    Suma = Rex(7)
    Wynik(6) = Suma
    
    Suma = Rex(8)
    Wynik(7) = Suma
    
    Suma = Rex(9)
    Wynik(8) = Suma
    
    Suma = Rex(10)
    Wynik(9) = Suma
    
    Suma = Rex(11)
    If Rex(12) > Suma Then Suma = Rex(12)
    Wynik(10) = Suma
    
    Suma = Rex(13)
    If Rex(14) > Suma Then Suma = Rex(14)
    Wynik(11) = Suma
    
    Suma = Rex(15)
    If Rex(16) > Suma Then Suma = Rex(16)
    Wynik(12) = Suma
    
    Return
    
    Save:
    For K = 1 To 24                                             'x
    Sing = Wynik(K) * 0.1
    
    If K = 1 Then Sing = Sing * 0.6                             'pierwsze dwa znaki pierwszej połówki zbyt mocno się wychylają, bas
    If K = 2 Then Sing = Sing * 0.7
    If K = 12 Then Sing = Sing * 1.3                            'x 'ostatni znak pierwszej połówki jest przytłumiony przez filtr więc go wzmacniam
    
    Sing = Log10(sing)
    
    Sing = Czulosc * Sing
    Tmp_c = Sing + Poziom_a
    
    If Tmp_c < 0 Then Tmp_c = 0
    If Tmp_c > 16 Then Tmp_c = 16
    
    Wynik(K) = Tmp_c
    
    If Wynik(K) > Wynik_o(K) Then
       Wynik_o(K) = Wynik(K)
    Else
       If Falloff_count(K) = Falloff Then
          If Wynik_o(K) > 0 Then Decr Wynik_o(K)
          Falloff_count(K) = 0
       End If
       Incr Falloff_count(K)
    End If
    
    '****** dodano do wersji 2 **************
    
    
    Lazienka_jest_zamknieta = Wynik_o(K) + Uklad
    Line1d(K) = LookUp(Lazienka_jest_zamknieta , L1)
    Line2d(K) = LookUp(Lazienka_jest_zamknieta , L2)
    
    
    Locate 1 , K
    Lcd Chr(Line1d(K))
    Locate 2 , K
    Lcd Chr(Line2d(K))
    'po wyliczeniu każdego słupka jest on od razu wpisywany na wyświetlacz.
    'poniżej wcześniejsze rozwiązanie, wysyłane były wszystkie słupki naraz po zakończeniu przeliczania.
    'sam nie wiem która metoda jest szybsza, nie widać różnicy gołym okiem.
    'teoretycznie teraz powinno być wolniej bo za każdym razem program komunikuje się z lcd a poprzednio tylko raz, czyli 16 razy rzadziej.
    'ale musiałem tak zrobić ze względu na problem z opcją overlay (używanie znaku chr(0)), a zalety - ostatnie słupki chodzą płynniej :)
    '******* koniec ***********************
    
    Next K
    'Locate 1 , 1
    'Lcd Line1;
    'Locate 2 , 1
    'Lcd Line2;
    Return
    
    
    '****** dodano do wersji 2 **************
    
    Buttons:
    
    If Jasn_up = 0 Then
       Incr Jasnosc
       If Jasnosc = 51 Then Jasnosc = 50
       Jasnosc_flaga = 1
    End If
    
    If Jasn_dn = 0 Then
       Decr Jasnosc
       If Jasnosc = 255 Then Jasnosc = 0
       Jasnosc_flaga = 1
    End If
    
    If Jasnosc_flaga = 1 Then
       Jasnosc_flaga = 0
       If Vfd = 0 Then
          Jasnosc_vfd = Jasnosc / 10
          If Jasnosc_vfd > 3 Then Jasnosc_vfd = 3
          Lcdcontrast Jasnosc_vfd
       Else
          Ocr2 = Jasnosc * 5
       End If
       Locate 1 , 3
       Lcd "Jasnosc: " ; Jasnosc ; "(" ; Jasnosc_vfd ; ")"
       Waitms 10
    End If
    
    
    
    If Czul_up = 0 Then
       Incr Czulosc
       If Czulosc = 51 Then Czulosc = 50
       Czulosc_flaga = 1
    End If
    
    If Czul_dn = 0 Then
       Decr Czulosc
       If Czulosc = 255 Then Czulosc = 0
       Czulosc_flaga = 1
    End If
    
    If Czulosc_flaga = 1 Then
       Czulosc_flaga = 0
       Poziom_a = Czulosc * 0.4
       Poziom_a = 8 - Poziom_a
       Locate 1 , 5
       Lcd "Czulosc: " ; Czulosc
       Waitms 10
    End If
    
    
    
    If Tryb = 0 Then
       Stop Watchdog
       Incr Efekt
       If Efekt = 5 Then Efekt = 0
       GoSub Lcdchr
       Efekt_e = Efekt
       'ustawienia jasności i czułości są zapisywane dopiero wraz ze zmianą efektu, wydłuży to życie eepromu.
       Czulosc_e = Czulosc
       Jasnosc_e = Jasnosc
       Waitms 10
       Start Watchdog
    End If
    
    Return
    '-------
    Lcdchr:
    'Initlcd
    'Waitms 10
    'Initlcd
    'Cursor Off
    'Start Watchdog
    
    Select Case Efekt
    
       'slupki 1
       Case 0 :
          Deflcdchar 0 , 32 , 32 , 32 , 32 , 32 , 32 , 32 , 31
          Deflcdchar 1 , 32 , 32 , 32 , 32 , 32 , 32 , 31 , 31
          Deflcdchar 2 , 32 , 32 , 32 , 32 , 32 , 31 , 31 , 31
          Deflcdchar 3 , 32 , 32 , 32 , 32 , 31 , 31 , 31 , 31
          Deflcdchar 4 , 32 , 32 , 32 , 31 , 31 , 31 , 31 , 31
          Deflcdchar 5 , 32 , 32 , 31 , 31 , 31 , 31 , 31 , 31
          Deflcdchar 6 , 32 , 31 , 31 , 31 , 31 , 31 , 31 , 31
          Deflcdchar 7 , 31 , 31 , 31 , 31 , 31 , 31 , 31 , 31
          Uklad = 0
    
       'slupki 2
       Case 1 :
          Deflcdchar 0 , 32 , 32 , 32 , 32 , 32 , 32 , 32 , 27
          Deflcdchar 1 , 32 , 32 , 32 , 32 , 32 , 32 , 27 , 27
          Deflcdchar 2 , 32 , 32 , 32 , 32 , 32 , 27 , 27 , 27
          Deflcdchar 3 , 32 , 32 , 32 , 32 , 27 , 27 , 27 , 27
          Deflcdchar 4 , 32 , 32 , 32 , 27 , 27 , 27 , 27 , 27
          Deflcdchar 5 , 32 , 32 , 27 , 27 , 27 , 27 , 27 , 27
          Deflcdchar 6 , 32 , 27 , 27 , 27 , 27 , 27 , 27 , 27
          Deflcdchar 7 , 27 , 27 , 27 , 27 , 27 , 27 , 27 , 27
    
       'slupki 3
       Case 2 :
          Deflcdchar 0 , 32 , 32 , 32 , 32 , 32 , 32 , 32 , 31
          Deflcdchar 1 , 32 , 32 , 32 , 32 , 32 , 32 , 17 , 31
          Deflcdchar 2 , 32 , 32 , 32 , 32 , 32 , 31 , 17 , 31
          Deflcdchar 3 , 32 , 32 , 32 , 32 , 17 , 31 , 17 , 31
          Deflcdchar 4 , 32 , 32 , 32 , 31 , 17 , 31 , 17 , 31
          Deflcdchar 5 , 32 , 32 , 17 , 31 , 17 , 31 , 17 , 31
          Deflcdchar 6 , 32 , 31 , 17 , 31 , 17 , 31 , 17 , 31
          Deflcdchar 7 , 17 , 31 , 17 , 31 , 17 , 31 , 17 , 31
    
       'owal
       Case 3 :
          Deflcdchar 0 , 32 , 32 , 32 , 32 , 32 , 32 , 14 , 31
          Deflcdchar 1 , 32 , 32 , 32 , 32 , 32 , 14 , 31 , 14
          Deflcdchar 2 , 32 , 32 , 32 , 32 , 14 , 31 , 14 , 32
          Deflcdchar 3 , 32 , 32 , 32 , 14 , 31 , 14 , 32 , 32
          Deflcdchar 4 , 32 , 32 , 14 , 31 , 14 , 32 , 32 , 32
          Deflcdchar 5 , 32 , 14 , 31 , 14 , 32 , 32 , 32 , 32
          Deflcdchar 6 , 14 , 31 , 14 , 32 , 32 , 32 , 32 , 32
          Deflcdchar 7 , 31 , 14 , 32 , 32 , 32 , 32 , 32 , 32
          Uklad = 17
    
       Case 4:
          Deflcdchar 0 , 32 , 32 , 32 , 32 , 32 , 32 , 32 , 31
          Deflcdchar 1 , 32 , 32 , 32 , 32 , 32 , 31 , 32 , 31
          Deflcdchar 2 , 32 , 32 , 32 , 31 , 32 , 31 , 32 , 31
          Deflcdchar 3 , 32 , 31 , 32 , 31 , 32 , 31 , 32 , 31
          Uklad = 35
    
    End Select
    
    Cls
    
    'Start Timer1
    'Start Timer0
    'Enable Interrupts
    
    Return
    
    
    
    'wspólna tablica dla różnych efektów
    L1:                                                         'efekt 0 i 1     >>>>!<<<<                          efekt 2 i 3                               >>>>!<<<<                      efekt 4
    Data 32 , 32 , 32 , 32 , 32 , 32 , 32 , 32 , 32 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 32 , 32 , 32 , 32 , 32 , 32 , 32 , 32 , 32 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 32 , 32 , 32 , 32 , 32 , 32 , 32 , 32 , 32 , 0 , 0 , 1 , 1 , 2 , 2 , 3 , 3
    
    L2:                                                         'efekt 0 i 1>!<<<<                                  efekt 2 i 3                       >>>>!<<<<                              efekt 4
    Data 32 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 32 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 32 , 32 , 32 , 32 , 32 , 32 , 32 , 32 , 32 , 32 , 0 , 0 , 1 , 1 , 2 , 2 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3
    
    
    '********* koniec ************
    
    
    ' tabela 32 liczb 16 bitowych ze znakiem
    ' założony format: MSB - część całkowita, LSB - część ułamkowa
    ' kwantyzacja: 0.19635 rad
    ' tabela I ćwiartki sin(x), 8 pozycji (co 11,25 stopnia od 0 do 78.75)
    Tab_sin:
    Data 0% , 50% , 98% , 142% , 181% , 213% , 237% , 251%
    ' tabela II ćwiartki sin(x), (co 11,25 stopnia od 90 do 178.75)
    Data 255% , 251% , 237% , 213% , 181% , 142% , 98% , 50%
    ' tabela III i IV ćwiartki sin(x), (co 11,25 stopnia od 180 do 258.75 i 270 - 348.75)
    ' zanegowane 2 poprzednie tabele
    Data 0% , -50% , -98% , -142% , -181% , -213% , -237% , -251%
    Data -255% , -251% , -237% , -213% , -181% , -142% , -98% , -50%
    
    
    
    Okno_hanning:
    Data 0 , 3 , 10 , 23 , 40 , 60 , 84 , 109 , 134 , 160 , 184 , 206 , 225 , 240 , 250 , 255 , 255 , 250 , 240 , 225 , 206 , 184 , 160 , 134 , 109 , 84 , 60 , 40 , 23 , 10 , 3 , 0
    
    'Okno_hamming:
    'Data 20 , 23 , 30 , 42 , 57 , 76 , 97 , 120 , 144 , 168 , 190 , 210 , 228 , 241 , 251 , 255 , 255 , 251 , 241 , 228 , 210 , 190 , 168 , 144 , 120 , 97 , 76 , 57 , 42 , 30 , 23 , 20
    
    'Okno_blackman:
    'Data 0 , 1 , 4 , 10 , 18 , 31 , 48 , 69 , 94 , 122 , 151 , 181 , 208 , 230 , 246 , 255 , 255 , 246 , 230 , 208 , 181 , 151 , 122 , 94 , 69 , 48 , 31 , 18 , 10 , 4 , 1 , 0

Attention
×

This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

The advertisements we display are relevant to this web site and your browsing history

Please consider supporting us by disabling your ad blocker.


Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

If you can, please report issues in the forum area WebSite / Forum Issues


Thank you for your attention.

  • #2
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,426
    Thumbs Up
    Received: 296
    Given: 142
    Total Downloaded
    1.68 GB

    0 Not allowed!

    Default Re: FFT Code 18F4550

    There's no need to transcribe other code. I have created several FFT routines for 18F devices, and they are in the Samples folder of the compiler:

    C:\Users\Les\PDS\Samples\New Samples\FFT_8_Bit
    C:\Users\Les\PDS\Samples\New Samples\FFT
    and
    C:\Users\Les\PDS\Samples\New Samples\Simple DFT

    The FFT routines are the fastest possible.

    There's also code for a dsPIC device for FFT in the samples 24 folder, that uses the DSP peripheral on the device and it is incredibly fast and simple. Try that with BASCOM!!! LOL
    C:\Users\Les\PDS\Samples24\DSP

    They are also on the Wiki:
    http://www.protonbasic.co.uk/content...it-FFT-routine

    http://www.protonbasic.co.uk/content.php/3388-Proton-Fast-8-bit-FFT


    Last edited by top204; 25th February 2017 at 10:38.

  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

    Thread Information

    Users Browsing this Thread

    There are currently 1 users browsing this thread. (0 members and 1 guests)

       

    Similar Threads

    1. FFT and DFT discussion in Beta section
      By J. Mark Wolf in forum Proton Plus Compiler v3
      Replies: 2
      Last Post: 13th October 2010, 14:07
    2. Mic input for FFT
      By ohararp in forum The Lounge
      Replies: 8
      Last Post: 15th January 2008, 00:20
    3. [SOLVED !] Vusb? and Code protect ? as well on 18f4550
      By Glen Fraser in forum Proton Plus Compiler v3
      Replies: 1
      Last Post: 5th October 2006, 21:47

    Members who have read this thread since 18th November 2019, 09:16 : 0

    Actions :  (Set Date)  (Clear Date)

    You do not have permission to view the list of names.

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts