;****************************************************************************** ; Beispielprogramm für dsPIC33FJ128GP706 .equ __p33FJ128GP706, 1 .include "p33FJ128GP706.inc" config __FOSCSEL, FNOSC_PRIPLL & IESO_ON config __FOSC, POSCMD_HS & OSCIOFNC_OFF config __FICD, ICS_PGD1 & JTAGEN_OFF .global __reset .section .text __reset: ; PLL für 40MHz mit 20MHz Quarz mov #0b0000000000000010,W0 mov W0,CLKDIV mov #0x001E,W0 mov W0,PLLFBD pllunlock: btss OSCCON,#LOCK bra pllunlock ; Stack Pointer initialisieren mov #__SP_init,W15 mov #__SPLIM_init,W0 mov W0,SPLIM nop mov #0b1111111111111110,W0 ; Port G0 als Ausgang mov W0,TRISG ; Hauptprogramm mov #10000,W0 m: bset LATG,#0 call delay_ms bclr LATG,#0 call delay_ms bra m ;****************************************************************************** ; delay_ms Pause W0 * 1ms bei 25ns/Zyklus (W0 * 40000 Zyklen) delay_ms: ; 2 push W0 ; 1 repeat #15000-1 ; 1 nop ; 1 repeat #15000-1 ; 1 nop ; 1 repeat #10000-1-10 ; 1 nop ; 1 sub #1,W0 ; 1 bra Z,dms3 ; 2 (1) ; fehlen noch 5 dms1: repeat #15000-1 ; 1 nop ; 1 repeat #15000-1 ; 1 nop ; 1 repeat #10000-1-4 ; 1 nop ; 1 nop ; 1 sub #1,W0 ; 1 bra NZ,dms1 ; 2 (1) ; fehlen noch 5 nop ; 1 dms3: pop W0 ; 1 return ; 3 (2)