Protonda artık 16bit işlemcilerde var.

Başlatan Maxim, 09 Mayıs 2014, 21:03:35

Maxim

Bir süredir denemesi yapılıyordu, bu hafta içi full sürüm Proton24 versiyonu yayınlandı.

Desteklenen işlemci listesi:
dsPIC33E
dsPIC33EP128GP502, dsPIC33EP128GP504, dsPIC33EP128GP506, dsPIC33EP128MC202, dsPIC33EP128MC204, dsPIC33EP128MC206,
dsPIC33EP128MC502,dsPIC33EP128MC504, dsPIC33EP128MC506, dsPIC33EP256GP502, dsPIC33EP256GP504, dsPIC33EP256GP506,
dsPIC33EP256MC202, dsPIC33EP256MC204,dsPIC33EP256MC206, dsPIC33EP256MC502, dsPIC33EP256MC504, dsPIC33EP256MC506,
dsPIC33EP256MU806, dsPIC33EP256MU810, dsPIC33EP256MU814,dsPIC33EP32GP502, dsPIC33EP32GP503, dsPIC33EP32GP504,
dsPIC33EP32MC202, dsPIC33EP32MC203, dsPIC33EP32MC204, dsPIC33EP32MC502, dsPIC33EP32MC503,dsPIC33EP32MC504,
dsPIC33EP512GP806, dsPIC33EP512MC806, dsPIC33EP512MU810, dsPIC33EP512MU814, dsPIC33EP64GP502, dsPIC33EP64GP503,
dsPIC33EP64GP504,dsPIC33EP64GP506, dsPIC33EP64MC202, dsPIC33EP64MC203, dsPIC33EP64MC204, dsPIC33EP64MC206,
dsPIC33EP64MC502, dsPIC33EP64MC503, dsPIC33EP64MC504,dsPIC33EP64MC506

dsPIC33F
dsPIC33FJ06GS001, dsPIC33FJ06GS101, dsPIC33FJ06GS101A, dsPIC33FJ06GS102, dsPIC33FJ06GS102A, dsPIC33FJ06GS202,
dsPIC33FJ06GS202A,dsPIC33FJ09GS302, dsPIC33FJ128GP202, dsPIC33FJ128GP204, dsPIC33FJ128GP206, dsPIC33FJ128GP206A,
dsPIC33FJ128GP306, dsPIC33FJ128GP306A, dsPIC33FJ128GP310,dsPIC33FJ128GP310A, dsPIC33FJ128GP706, dsPIC33FJ128GP706A,
dsPIC33FJ128GP708, dsPIC33FJ128GP708A, dsPIC33FJ128GP710, dsPIC33FJ128GP710A, dsPIC33FJ128GP802,dsPIC33FJ128GP804,
dsPIC33FJ128MC202, dsPIC33FJ128MC204, dsPIC33FJ128MC506, dsPIC33FJ128MC506A, dsPIC33FJ128MC510, dsPIC33FJ128MC510A,
dsPIC33FJ128MC706,dsPIC33FJ128MC706A, dsPIC33FJ128MC708, dsPIC33FJ128MC708A, dsPIC33FJ128MC710, dsPIC33FJ128MC710A,
dsPIC33FJ128MC802, dsPIC33FJ128MC804, dsPIC33FJ12GP201,dsPIC33FJ12GP202, dsPIC33FJ12MC201, dsPIC33FJ12MC202,
dsPIC33FJ16GP101, dsPIC33FJ16GP102, dsPIC33FJ16GP304, dsPIC33FJ16GS402, dsPIC33FJ16GS404, dsPIC33FJ16GS502,
dsPIC33FJ16GS504, dsPIC33FJ16MC101, dsPIC33FJ16MC102, dsPIC33FJ16MC304, dsPIC33FJ256GP506, dsPIC33FJ256GP506A,
dsPIC33FJ256GP510, dsPIC33FJ256GP510A,dsPIC33FJ256GP710, dsPIC33FJ256GP710A, dsPIC33FJ256MC510, dsPIC33FJ256MC510A,
dsPIC33FJ256MC710, dsPIC33FJ256MC710A, dsPIC33FJ32GP202, dsPIC33FJ32GP204,dsPIC33FJ32GP302, dsPIC33FJ32GP304,
dsPIC33FJ32GS406, dsPIC33FJ32GS606, dsPIC33FJ32GS608, dsPIC33FJ32GS610, dsPIC33FJ32MC202, dsPIC33FJ32MC204, dsPIC33FJ32MC302,
dsPIC33FJ32MC304, dsPIC33FJ64GP202, dsPIC33FJ64GP204, dsPIC33FJ64GP206, dsPIC33FJ64GP206A, dsPIC33FJ64GP306, dsPIC33FJ64GP306A, dsPIC33FJ64GP310, dsPIC33FJ64GP310A,dsPIC33FJ64GP706, dsPIC33FJ64GP706A, dsPIC33FJ64GP708, dsPIC33FJ64GP708A, dsPIC33FJ64GP710, dsPIC33FJ64GP710A, dsPIC33FJ64GP802, dsPIC33FJ64GP804, dsPIC33FJ64GS406,dsPIC33FJ64GS606, dsPIC33FJ64GS608, dsPIC33FJ64GS610,
dsPIC33FJ64MC202, dsPIC33FJ64MC204, dsPIC33FJ64MC506, dsPIC33FJ64MC506A, dsPIC33FJ64MC508, dsPIC33FJ64MC508A,
dsPIC33FJ64MC510, dsPIC33FJ64MC510A, dsPIC33FJ64MC706, dsPIC33FJ64MC706A, dsPIC33FJ64MC710, dsPIC33FJ64MC710A, dsPIC33FJ64MC802, dsPIC33FJ64MC804


PIC24E
PIC24EP128GP202, PIC24EP128GP204, PIC24EP128GP206, PIC24EP128MC202, PIC24EP128MC204, PIC24EP128MC206, PIC24EP256GP202,
PIC24EP256GP204, PIC24EP256GP206, PIC24EP256GU810,PIC24EP256GU814, PIC24EP256MC202, PIC24EP256MC204, PIC24EP256MC206,
PIC24EP32GP202, PIC24EP32GP203, PIC24EP32GP204, PIC24EP32MC202, PIC24EP32MC203, PIC24EP32MC204,PIC24EP512GP806,
PIC24EP512GU810, PIC24EP512GU814, PIC24EP64GP202, PIC24EP64GP203, PIC24EP64GP204, PIC24EP64GP206, PIC24EP64MC202, PIC24EP64MC203, PIC24EP64MC204,PIC24EP64MC206

PIC24F
PIC24F04KA200, PIC24F04KA201, PIC24F04KL100, PIC24F04KL101, PIC24F08KA101, PIC24F08KA102, PIC24F08KL200, PIC24F08KL201,
PIC24F08KL301, PIC24F08KL302,PIC24F08KL401, PIC24F08KL402, PIC24F16KA101, PIC24F16KA102, PIC24F16KA301, PIC24F16KA302,
PIC24F16KA304, PIC24F16KL401, PIC24F16KL402, PIC24F32KA301,PIC24F32KA302, PIC24F32KA304, PIC24FJ128DA106, PIC24FJ128DA110,
PIC24FJ128DA206, PIC24FJ128DA210, PIC24FJ128GA006, PIC24FJ128GA008, PIC24FJ128GA010,PIC24FJ128GA106, PIC24FJ128GA108,
PIC24FJ128GA110, PIC24FJ128GA306, PIC24FJ128GA308, PIC24FJ128GA310, PIC24FJ128GB106, PIC24FJ128GB108, PIC24FJ128GB110,
PIC24FJ128GB206, PIC24FJ128GB210, PIC24FJ16GA002, PIC24FJ16GA004, PIC24FJ16MC101, PIC24FJ16MC102, PIC24FJ192GA108, PIC24FJ192GA110,
PIC24FJ192GB106, PIC24FJ192GB108, PIC24FJ192GB110, PIC24FJ256DA106, PIC24FJ256DA110, PIC24FJ256DA206, PIC24FJ256DA210, PIC24FJ256GA106, PIC24FJ256GA108,PIC24FJ256GA110, PIC24FJ256GB106, PIC24FJ256GB108, PIC24FJ256GB110, PIC24FJ256GB206, PIC24FJ256GB210, PIC24FJ32GA002, PIC24FJ32GA004, PIC24FJ32GA102,PIC24FJ32GA104, PIC24FJ32GB002, PIC24FJ32GB004, PIC24FJ48GA002, PIC24FJ48GA004, PIC24FJ64GA002,
PIC24FJ64GA004, PIC24FJ64GA006, PIC24FJ64GA008,PIC24FJ64GA010, PIC24FJ64GA102, PIC24FJ64GA104, PIC24FJ64GA106, PIC24FJ64GA108,
PIC24FJ64GA110, PIC24FJ64GA306, PIC24FJ64GA308, PIC24FJ64GA310,PIC24FJ64GB002, PIC24FJ64GB004, PIC24FJ64GB106, PIC24FJ64GB108,
PIC24FJ64GB110, PIC24FJ96GA006, PIC24FJ96GA008, PIC24FJ96GA010, PIC24FV16KA301,PIC24FV16KA302, PIC24FV16KA304, PIC24FV32KA301,
PIC24FV32KA302, PIC24FV32KA304

PIC24H
PIC24HJ128GP202, PIC24HJ128GP204, PIC24HJ128GP206A, PIC24HJ128GP210A, PIC24HJ128GP306A, PIC24HJ128GP310A, PIC24HJ128GP502,
PIC24HJ128GP504,PIC24HJ128GP506A, PIC24HJ128GP510A, PIC24HJ12GP201, PIC24HJ12GP202, PIC24HJ16GP304, PIC24HJ256GP206A,
PIC24HJ256GP210A, PIC24HJ256GP610A,PIC24HJ32GP202, PIC24HJ32GP204, PIC24HJ32GP302, PIC24HJ32GP304, PIC24HJ64GP202,
PIC24HJ64GP204, PIC24HJ64GP206A, PIC24HJ64GP210A, PIC24HJ64GP502,PIC24HJ64GP504, PIC24HJ64GP506A, PIC24HJ64GP510A





Elektroemre

Adam çalışıyor.

Oldu olacak Cortex-M0'a da el atsın John amca.

Mucit23

Bence proton için büyük bir gelişme. Sevindim açıkçası.

t2

#3
Protonu yapan adam tam sopalık adam. bunu ıslatıp ıslatıp dövmek zifte batırıp tüye bulayıp dolaştırmak lazım.

Sebep ne ? diyeceksiniz. adam dspic bilmemne eklemiş. usb desteklenmiyor. usb için hala 18f2550filan kullanmalısınız. tüküreyim bu protona.

16 bit piclerle led yakıp söndürme için proton çok uygundur.

mustafa_cmbz

Alıntı yapılan: t2 - 10 Mayıs 2014, 00:33:58
Protonu yapan adam tam sopalık adam. bunu ıslatıp ıslatıp dövmek zifte batırıp tüye bulayıp dolaştırmak lazım.

Sebep ne ? diyeceksiniz. adam dspic bilmemne eklemiş. usb desteklenmiyor. usb için hala 18f2550filan kullanmalısınız. tüküreyim bu protona.

olcak hocam olcak oda olcak :D

t2

adam usbyi kabullenmemiş. bedava örnek verdik daha ne istiyorsunuz modunda.

Maxim

t2 hocam hic usb ile isim olmadi
ama usb desteklenmiyormu anlamadim
bir suru ornek var, kullanan yapan eden var?

t2

USB örnekler pic18f2550 gibi picler için çalışıyor.
Kodlar yeni eklenen usb özellikli işlemciler için geçerli değil.
Kendim yapayım desen  o da olmaz. microchip C kodlarından yapman lazım ki o kodları kullanıyorsan protona ihtiyacın yoktur.

Hattusa

slm arkadaşlar derleyicisi vs yayınlandımı bu 16 bitlik işlemciler için
vardım ilim meclisine eyledim talep, meğer ilim en gerideymiş illa EDEP, illa EDEP <muhyiddin Arabi K.S.>

Maxim

evet geçen hafta yayınlandı
Full install of version 3.5.6.7 of Proton and version 1.0.2.3 of Proton24
http://www.protonbasic.co.uk/content.php/1450-Proton-Compiler-Updates

Hattusa

hmm acaba bu yeni versiyonu yükleyip deneme yapan arkadaşlar varmıdır?
vardım ilim meclisine eyledim talep, meğer ilim en gerideymiş illa EDEP, illa EDEP <muhyiddin Arabi K.S.>

Maxim

#11
bende 3.5.6.1 var
bugün son versiyonu kurucam, fakat benim 16bit işlemcilerle hiç işim olmadı.
bakalım fark varmı

mesaj birleştirme:: 12 Mayıs 2014, 12:03:55

fark varmı derken yeni versiyonun farkı varmı demek istedim 8bit tarafında

16bit farkına bakalım isterseniz?
dsPIC33FJ128GP802

işlemcide bir ben yokum heralde
Operating Range:

    Up to 40 MIPS operation (at 3.0-3.6V):
        Industrial temperature range (-40°C to +85°C)
        Extended temperature range (-40°C to +125°C)

High-Performance DSC CPU:

    Modified Harvard architecture
    C compiler optimized instruction set
    16-bit wide data path
    24-bit wide instructions
    Linear program memory addressing up to 4M instruction words
    Linear data memory addressing up to 64 Kbytes
    83 base instructions: mostly 1 word/1 cycle
    Two 40-bit accumulators with rounding and saturation options
    Flexible and powerful addressing modes:
        Indirect
        Modulo
        Bit-Reversed
    Software stack
    16 x 16 fractional/integer multiply operations
    32/16 and 16/16 divide operations
    Single-cycle multiply and accumulate:
        Accumulator write back for DSP operations
        Dual data fetch
    Up to ±16-bit shifts for up to 40-bit data

On-Chip Flash and SRAM:

    Flash program memory
    Data SRAM
    Boot, Secure, and General Security for program Flash

Direct Memory Access (DMA):

    8-channel hardware DMA
    Up to 2 Kbytes dual ported DMA buffer area (DMA RAM) to store data transferred via DMA:
        Allows data transfer between RAM and a peripheral while CPU is executing code (no cycle stealing)
    Most peripherals support DMA

Timers/Capture/Compare/PWM:

    Timer/Counters, up to five 16-bit timers:
        Can pair up to make two 32-bit timers
        One timer runs as a Real-Time Clock with an external 32.768 kHz oscillator
        Programmable prescaler
    Input Capture (up to four channels):
        Capture on up, down or both edges
        16-bit capture input functions
        4-deep FIFO on each capture
    Output Compare (up to four channels):
        Single or Dual 16-bit Compare mode
        16-bit Glitchless PWM mode
    Hardware Real-Time Clock/Calendar (RTCC):
        Provides clock, calendar, and alarm functions

Interrupt Controller:

    5-cycle latency
    118 interrupt vectors
    Up to 49 available interrupt sources
    Up to three external interrupts
    Seven programmable priority levels
    Five processor exceptions

Digital I/O:

    Peripheral pin Select functionality
    Up to 35 programmable digital I/O pins
    Wake-up/Interrupt-on-Change for up to 21 pins
    Output pins can drive from 3.0V to 3.6V
    Up to 5V output with open drain configuration
    All digital input pins are 5V tolerant
    4 mA sink on all I/O pins

System Management:

    Flexible clock options:
        External, crystal, resonator, internal RC
        Fully integrated Phase-Locked Loop (PLL)
        Extremely low jitter PLL
    Power-up Timer
    Oscillator Start-up Timer/Stabilizer
    Watchdog Timer with its own RC oscillator
    Fail-Safe Clock Monitor
    Reset by multiple sources

Power Management:

    On-chip 2.5V voltage regulator
    Switch between clock sources in real time
    Idle, Sleep, and Doze modes with fast wake-up

Analog-to-Digital Converters (ADCs):

    10-bit, 1.1 Msps or 12-bit, 500 Ksps conversion:
        Two and four simultaneous samples (10-bit ADC)
        Up to 13 input channels with auto-scanning
        Conversion start can be manual or synchronized with one of four trigger sources
        Conversion possible in Sleep mode
        ±2 LSb max integral nonlinearity
        ±1 LSb max differential nonlinearity

Audio Digital-to-Analog Converter (DAC):

    16-bit Dual Channel DAC module
    100 Ksps maximum sampling rate
    Second-Order Digital Delta-Sigma Modulator

Data Converter Interface (DCI) module:

    Codec interface
    Supports I2S and AC.97 protocols
    Up to 16-bit data words, up to 16 words per frame
    4-word deep TX and RX buffers

Comparator Module:

    Two analog comparators with programmable input/output configuration

CMOS Flash Technology:

    Low-power, high-speed Flash technology
    Fully static design
    3.3V (±10%) operating voltage
    Industrial and Extended temperature
    Low power consumption

Communication Modules:

    4-wire SPI (up to two modules):
        Framing supports I/O interface to simple codecs
        Supports 8-bit and 16-bit data
        Supports all serial clock formats and sampling modes
    I2C™:
        Full Multi-Master Slave mode support
        7-bit and 10-bit addressing
        Bus collision detection and arbitration
        Integrated signal conditioning
        Slave address masking
    UART (up to two modules):
        Interrupt on address bit detect
        Interrupt on UART error
        Wake-up on Start bit from Sleep mode
        4-character TX and RX FIFO buffers
        LIN bus support
        IrDA® encoding and decoding in hardware
        High-Speed Baud mode
        Hardware Flow Control with CTS and RTS
    Enhanced CAN (ECAN. module) 2.0B active:

Hattusa

ustam sizdeki proton orjinal mi? yani küreklisi çıktı mı?
deneme fırsatı olanlar fikirlerini paylaşabilirler mi?
vardım ilim meclisine eyledim talep, meğer ilim en gerideymiş illa EDEP, illa EDEP <muhyiddin Arabi K.S.>

Maxim

ben kayıtlı kullanıcıyım yani orjinal

Bugüne kadar 8bit te sıkışıp kalmışız meğer.
16bit tarafı gerçekten fenaymış
sadece hız değil, özelliklerde bitmiyor

basit bir ADC hız kıyaslaması
18F2520 -adc 100K samples per second
dsPIC33FJ128GP802 -adc 1.1 Msps
dsPIC33FJ16GS502 -adc 4 Msps

bu da dspic ile yapılan proton+ DTMF Decoder kodu
örnek olması açısından
'
' DTMF decoder using a 600Hz to 2KHz FIR bandpass Filter and an FFT.
' For use with Proton24 version 1.0.2.3 onwards
' Written by Les Johnson 11-05-14
'
' For accurate operation, the signal on AN0 should be no more than 1.0 Volt and have a DC offset of 1.7 Volts.
'
' DTMF keypad and frequencies(in Hz)
'
'  --------------------------------
' |    | 1209 | 1336 | 1477 | 1633 |
' |----|---------------------------|
' |697 |   1  |   2  |   3  |   A  |
' |----|---------------------------|
' |770 |   4  |   5  |   6  |   B  |
' |----|---------------------------|
' |852 |   7  |   8  |   9  |   C  |
' |----|---------------------------|
' |941 |   *  |   0  |   #  |   D  |
'  --------------------------------
'
    Device = 33FJ128GP802
    Declare Xtal = 79.23

    Declare Hserial_Baud = 115200               ' UART1 baud rate
    Declare Hrsout1_Pin = PORTB.3               ' Select which pin is to be used for TX with USART1

    Include "FIR.inc"                           ' Load the FIR procedures into the program
    Include "FFT.inc"                           ' Load the FFT procedures into the program

$ifndef False
    $define False 0
$endif
$ifndef True
    $define True 1
$endif
'
' Timer1 interrupt (ADC sample) rate calculator
'
    $define cMicroSeconds $eval (1000000 / 8000)                            ' Interrupt rate (in us). Sample rate is (1000000 / Frequency (in Hz))
    $define cTweak_Value 36                                                 ' Added tweak value for rounding errors
    $define cPR1_Value $eval (cMicroSeconds * (_xtal / 2)) + cTweak_Value   ' Calculate the actual value to place into the PR1 SFR

    $define cFFT_BufferSize 256                                             ' 256 pairs of complex (Re, Im) values, resulting in 128 FFT bins
    $define cFFT_BinSize $eval (cFFT_BufferSize / 2)                        ' The amount fo resulting FFT bins

    $define cFIR_BufferSize 128                                             ' The size of the FIR filter's YRAM buffer
    $define cFIR_Taps 128                                                   ' The amount of filter taps (the coefficient table)
'
' Coefficient table addressable in PSV space
' The values below are for a 600Hz to 2KHz band pass filter using a Hamming window
'
    Dim cCOEFF As PSV = As Word $0019, $0000, $0016, $002A, $0000, $FFD0,_
                                $FFE3, $0000, $FFD7, $FFB0, $FFF0, $0042,_
                                $0025, $FFF8, $004D, $00A0, $0037, $FFA9,_
                                $FFDD, $0024, $FF80, $FEDB, $FF7E, $005F,_
                                $0000, $FF90, $00B5, $01E0, $00F8, $FFAE,_
                                $005E, $0114, $FF31, $FD34, $FE69, $0030,_
                                $FEEC, $FDBA, $00A7, $03DE, $0250, $FFF8,_
                                $0245, $0462, $0000, $FAED, $FCF4, $000D,_
                                $FBCF, $F7D5, $FE64, $0698, $03AF, $FF3F,_
                                $07B5, $105E, $05C7, $F672, $FBE3, $04B5,_
                                $ECCC, $CA47, $DF1C, $2C78, $599A, $2C78,_
                                $DF1C, $CA47, $ECCC, $04B5, $FBE3, $F672,_
                                $05C7, $105E, $07B5, $FF3F, $03AF, $0698,_
                                $FE64, $F7D5, $FBCF, $000D, $FCF4, $FAED,_
                                $0000, $0462, $0245, $FFF8, $0250, $03DE,_
                                $00A7, $FDBA, $FEEC, $0030, $FE69, $FD34,_
                                $FF31, $0114, $005E, $FFAE, $00F8, $01E0,_
                                $00B5, $FF90, $0000, $005F, $FF7E, $FEDB,_
                                $FF80, $0024, $FFDD, $FFA9, $0037, $00A0,_
                                $004D, $FFF8, $0025, $0042, $FFF0, $FFB0,_
                                $FFD7, $0000, $FFE3, $FFD0, $0000, $002A,_
                                $0016, $0000, $0019
'
' Variables used for the FIR filter
'
    Dim FIR_wIndex As Word                                  ' FIR filter's input buffer index
    Dim FIR_wSamples[cFIR_BufferSize] As Word YRAM          ' FIR filter's input buffer, must be in Y RAM
'
' Variables used by FFT
'
    Dim FFT_wIndex As Word                                  ' FFT's buffer index
    Dim FFT_wSamples[cFFT_BufferSize * 2] As Word YRAM      ' Y RAM space is required by FFT routine
    Dim FFT_tBufferReady As Bit                             ' True if the FFT buffer is full (no more allowed until cleared)
'
' Variables used for the DTMF decode
'
    Dim DTMF_bKeyValue As Byte                              ' Holds the key value from the DTMF decoder
    Dim DTMF_wZeroCounter As Word                           ' Inter-character counter

'----------------------------------------------------------------------------------------------------
' Setup the ADC and initialise an ADC interrupt
' Input     : None
' Output    : None
' Notes     : The procedure also encompasses the interrupt handler
'
Proc ADC_Start()
    Input PORTA.0                           ' Make AN0 an input
    AD1CON2 = 0                             ' AVdd, AVss, MUXA only
    AD1PCFGLbits_PCFG0 = 0                  ' Analogue input on AN0
    AD1CHS0 = 0                             ' Configure AN0 as the ADC input
    AD1CON2 = $0000
    AD1CON3 = $021A                         ' Sampling time = 3 * Tad, minimum Tad selected
    AD1CON1 = %1000001111100010
'              ||||||||||||||||______________ Bit-0 : No ADC conversion yet
'              |||||||||||||||_______________ Bit-1 : ADC Sample and Hold amplifiers are holding
'              ||||||||||||||________________ Bit-2 : Sampling begins immediately after last conversion. SAMP bit is auto-set.
'              |||||||||||||_________________ Bit-3 : Samples multiple channels individually in sequence
'              ||||||||||||__________________ Bit-4 : Sample Clock Source Group Bit
'              |||||||||||___________________ Bit-5 :\
'              ||||||||||____________________ Bit-6 :| Internal Counter ends sampling and starts conversion (auto-convert)
'              |||||||||_____________________ Bit-7 :/
'              ||||||||______________________ Bit-8 :\ ADC is using signed fractional (DOUT = sddddddddddd)
'              |||||||_______________________ Bit-9 :/
'              ||||||________________________ Bit-10: 12-Bit, 1-channel ADC operation
'              |||||_________________________ Bit-11: Unimplemented
'              ||||__________________________ Bit-12: DMA buffers are written in Scatter/Gather mode
'              |||___________________________ Bit-13: Continue module operation in Idle mode
'              ||____________________________ Bit-14: Unimplemented
'              |_____________________________ Bit-15: Enable the ADC

    IEC0bits_AD1IE = 1                      ' ADC interrupt enabled
    AD1CON1bits_ADON = 1                    ' Enable the ADC
    AD1CON1bits_SAMP = 1                    ' Start a sample
'
'-------------------------------------------
' ADC interrupt handler
' Input     : None
' Output    : FFT_wSamples holds the FFT bins
' Notes     : Filters the ADC result and places it in the real and imaginary parts of the FFT buffer
'
Isr ADC1Interrupt
    If FFT_tBufferReady = False Then                        ' Is the FFT samples filter full?
        FIR_wSamples[FIR_wIndex] = ADCBUF0                  ' No. So get an ADC sample into the filter's buffer
        FFT_wSamples[FFT_wIndex] = FIR_Filter(FIRStruct, FIR_wIndex) ' Place the filtered value into the FFT array
        '
        ' Manage the FIR filter's buffer
        '
        Inc FIR_wIndex                                      ' Increment the samples buffer index
        If FIR_wIndex >= cFIR_BufferSize Then               ' Have we reached the end of the buffer?
            FIR_wIndex = 0                                  ' Yes. So reset it
        EndIf
        '
        ' Manage the FFT buffer
        '
        Inc FFT_wIndex                                      ' Increment the samples buffer index
        If FFT_wIndex >= cFFT_BufferSize Then               ' Have we reached the end of the FFT buffer?
            FFT_wIndex = 0                                  ' Yes. So reset it
            FFT_tBufferReady = True                         ' Signal to the main program that we have values in the buffer
        EndIf
    EndIf
    IFS0bits_AD1IF = 0                                      ' Clear the ADC interrupt flag
EndIsr
EndProc

'----------------------------------------------------------------------------------------------------
' Initialise a Timer1 interrupt
' Input     : None
' Output    : None
' Notes     : The procedure also encompasses the Interrupt handler
'
Proc Timer1_Start()
    T1CON = 0                                   ' Reset the T1CON SFR
    T1CONbits_TCKPS0 = 0                        ' \
    T1CONbits_TCKPS1 = 0                        ' / Timer1 Prescaler 1:1
    PR1 = cPR1_Value                            ' ADC Sampling rate
                                                ' Set the match cPR1_Value (will cause an interrupt when this value is reached)
    TMR1 = 0                                    ' Reset Timer1 value
    IFS0bits_T1IF = 0                           ' Clear the Timer1 interrupt flag
    IPC0bits_T1IP0 = 1                          ' \
    IPC0bits_T1IP1 = 1                          ' | High Priority Timer1 interrupt
    IPC0bits_T1IP2 = 1                          ' /
    T1CONbits_TON = 1                           ' Turn on Timer1
    IEC0bits_T1IE = 1                           ' Enable the Timer1 interrupt
'
'-----------------------------------------------
' Timer1 Interrupt handler
' Input     : None
' Output    : None
' Notes     : Triggers an ADC interrupt
'
Isr T1Interrupt
    If AD1CON1bits_DONE = 1 Then                ' Is the ADC busy?
        AD1CON1bits_SAMP = 1                    ' No. So start a new ADC sample
    EndIf
    IFS0bits_T1IF = 0                           ' Clear the Timer1 interrupt flag
EndIsr
EndProc

'-------------------------------------------------------------------------
' Find the highest row peak within the FFT array
' Input     : FFT_wSamples
' Output    : Returns the bin that contains the largest value
' Notes     : Only scans the first half of the array because this is where the row frequencies are
'
Proc DTMF_FindRowBin(), Byte
    Dim wTemp As Word
    Dim wIndex As Word
    Dim wLargest As Word = 2

    wIndex = 10                             ' Start at bin 10 (in case there is noise)
    Result = 0                              ' Default return if no bin found
    Repeat                                  ' Create loop to scan the bins
        wTemp = FFT_wSamples[wIndex]        ' Get a bin's value
        If wTemp > wLargest Then            ' Is this value greater than the largest found so far?
            wLargest = wTemp                ' Yes. So make this value the largest so far
            Result = wIndex                 ' Make this value the result
        EndIf
        Inc wIndex                          ' Move up the bins
    Until wIndex >= (cFFT_BinSize / 2)      ' Until half the bins are reached
EndProc

'-------------------------------------------------------------------------
' Find the highest column peak within the FFT array
' Input     : FFT_wSamples
' Output    : Returns the bin that contains the largest value
' Notes     : Only scans the second half of the array because this is where the column frequencies are
'
Proc DTMF_FindColBin(), Byte
    Dim wIndex As Word
    Dim wTemp As Word
    Dim wLargest As Word = 2

    wIndex = (cFFT_BinSize / 2)             ' Start half way up the bins
    Result = 0                              ' Default return if no bin found
    Repeat                                  ' Create loop to scan the bins
        wTemp = FFT_wSamples[wIndex]        ' Get a bin's value
        If wTemp > wLargest Then            ' Is this value greater than the largest found so far?
            wLargest = wTemp                ' Yes. So make this value the largest so far
            Result = wIndex                 ' Make this value the result
        EndIf
        Inc wIndex                          ' Move up the bins
    Until wIndex >= cFFT_BinSize            ' Until half the bins are reached
EndProc

'-------------------------------------------------------------------------
' Decode the FFT bin values into key values
' Input     : None
' Output    : Result holds the key value (in ASCII)
'           : Result is 0 if no valid tones found
' Notes     : None
'
Proc DTMF_GetKey(), Byte
    Dim bColBin As Byte = DTMF_FindColBin()             ' Find the FFT bin containing the column frequency
    Dim bRowBin As Byte = DTMF_FindRowBin()             ' Find the FFT bin containing the row frequency

    Result = 0                                          ' Default to an unknown key value
    Select bRowBin
        Case 44 To 46                                   ' Is the row frequency 697Hz?
            Select bColBin
                Case 76 To 78                           ' Is the column frequency 1209Hz?
                    Result = "1"
                Case 84 To 86                           ' Is the column frequency 1336Hz?
                    Result = "2"
                Case 92 To 94                           ' Is the column frequency 1477Hz?
                    Result = "3"
                Case 102 To 104                         ' Is the column frequency 1633Hz?
                    Result = "A"
            EndSelect
        Case 48 To 51                                   ' Is the row frequency 770Hz?
            Select bColBin
                Case 76 To 78                           ' Is the column frequency 1209Hz?
                    Result = "4"
                Case 84 To 86                           ' Is the column frequency 1336Hz?
                    Result = "5"
                Case 92 To 94                           ' Is the column frequency 1477Hz?
                    Result = "6"
                Case 102 To 104                         ' Is the column frequency 1633Hz?
                    Result = "B"
            EndSelect
        Case 52 To 55                                   ' Is the row frequency 853Hz?
            Select bColBin
                Case 76 To 78                           ' Is the column frequency 1209Hz?
                    Result = "7"
                Case 84 To 86                           ' Is the column frequency 1336Hz?
                    Result = "8"
                Case 92 To 94                           ' Is the column frequency 1477Hz?
                    Result = "9"
                Case 102 To 104                         ' Is the column frequency 1633Hz?
                    Result = "C"
            EndSelect
        Case 57 To 61                                   ' Is the row frequency 941Hz?
            Select bColBin
                Case 76 To 78                           ' Is the column frequency 1209Hz?
                    Result = "*"
                Case 84 To 86                           ' Is the column frequency 1336Hz?
                    Result = "0"
                Case 92 To 94                           ' Is the column frequency 1477Hz?
                    Result = "#"
                Case 102 To 104                         ' Is the column frequency 1633Hz?
                    Result = "D"
            EndSelect
    EndSelect
EndProc

'--------------------------------------------------------------------------------
' Receive and decode DTMF signals received on AN0
' Input     : None
' Output    : Returns the ASCII key value. 0 if no key recognised
' Notes     : None
'
Proc DTMF_Decode(), Byte
    While                                                       ' Create a loop to wait for a DTMF buffer fill
        If FFT_tBufferReady = True Then                         ' Is the FFT buffer ready?
            FFT_ComplexIP(FFT_wSamples, TwiddleCoeff_256, 8)    ' Yes. So perform an FFT of the captured data
            FFT_BitReverseComplex(FFT_wSamples, 8)              ' Bit reverse the complex FFT data
            FFT_SquareMagnitudeCplx(FFT_wSamples, FFT_wSamples, cFFT_BinSize) ' Calculate the amplitude of the bins
            Result = DTMF_GetKey()                              ' Place the decoded key value as the return
            FFT_tBufferReady = False                            ' Indicate to the interrupt that we're finished with the current buffer
            Return                                              ' Exit the procedure
        EndIf
    Wend                                                        ' Do it forever (probably requires a timeout in a real application)
EndProc

'--------------------------------------------------------------------------------
' The main program starts here
'
Main:
    PLL_Setup(43, 2, 2, $0300)                      ' Configure the Oscillator to operate the device at 79.23MHz
    PPS_Output(cOut_Pin_RP3, cOut_Fn_U1TX)          ' Make Pin RB3 U1TX

    FIR_wIndex = 0                                  ' Reset the FIR buffer index
    Clear FIR_wSamples                              ' Clear the FIR_wSamples array

    FFT_tBufferReady = False                        ' Reset the buffer ready flag
    FFT_wIndex = 0                                  ' Reset the FFT buffer index
'
' Initialise the FIR Filter parameters with the buffer and coefficient details
'
    FIR_StructInit(FIRStruct, cCOEFF, cFIR_Taps, FIR_wSamples, cFIR_BufferSize)
    ADC_Start()                                     ' Initialise and start the ADC interrupt
    Timer1_Start()                                  ' Initialise and start the Timer1 interrupt
'
' Decode and transmit serially the received DTMF signals
'
    While                                           ' Create an infinite loop
        '
        ' Wait for a valid key
        '
        DTMF_wZeroCounter = 0                       ' Reset the zero counter
        While                                       ' Create an infinite loop
            DTMF_bKeyValue = DTMF_Decode()          ' Decode a DTMF signal
            Inc DTMF_wZeroCounter                   ' Increment the zero counter
            If DTMF_bKeyValue <> 0 Then Break       ' Exit the loop when a valid key press is found
        Wend                                        ' Wait forever (probably requires a timeout in a real program)
        '
        ' Transmit the ASCII key value. Character "*" will cause a <CR> to be transmitted
        '
        If DTMF_wZeroCounter > 1 Then               ' Was the zero counter greater than 1?
            DTMF_bKeyValue = DTMF_Decode()          ' Yes. So decode the DTMF signal
            If DTMF_bKeyValue = "*" Then            ' Is the key a "*" character?
                HRSOut 13                           ' Yes. So transmit a carriage return
            Else                                    ' Otherwise...
                HRSOut DTMF_bKeyValue               ' Transmit the ASCII key value
            EndIf
        EndIf
    Wend                                            ' Do it forever

'---------------------------------------------------------------------------------------
' Configure for internal 7.37MHz oscillator with PLL
' OSC pins are general purpose I/O
'
    Config FBS = BWRP_WRPROTECT_OFF
    Config FGS = GWRP_OFF
    Config FOSCSEL = FNOSC_FRCPLL, IESO_OFF
    Config FOSC = POSCMD_NONE, OSCIOFNC_ON, IOL1WAY_OFF, FCKSM_CSECME
    Config FWDT = WDTPOST_PS256, WINDIS_OFF, FWDTEN_OFF
    Config FPOR = FPWRT_PWR1, ALTI2C_OFF
    Config FICD = ICS_PGD1, JTAGEN_OFF

kantirici

@maxim hocam dsPIC33E serisi 70 MIPS ve yeni seri.  Mesela dsPIC33EP512MU810, DIP kılıf olarak da mesela dsPIC33EP64MC502 var yurt içinden de temin edilebiliyor.