Hi,
here is the code you should compare with yours.
; Include derivative-specific definitions
INCLUDE 'derivative.inc'
; export symbols
XDEF Entry, _Startup, main
; we use export 'Entry' as symbol. This allows us to
; reference 'Entry' either in the linker .prm file
; or from C/C++ later on
XREF __SEG_END_SSTACK ; symbol defined by the linker for the end of the stack
; variable/data section
MY_EXTENDED_RAM: SECTION
; Insert here your data definition.
Counter ds.w 1
FiboRes ds.w 1
;/===================================================================
; code section
;/===================================================================
MyCode: SECTION
main:
_Startup:
Entry:
LDS #__SEG_END_SSTACK ; initialize the stack pointer
;--- init PLL start ---
MOVB #$1,PLLCTL ; PLLCTL = 0B00000001; // CME=0,PLLON=0,FM1=0,FM2=0,FSTWKP=0,PRE=0,PCE=0,SCME=1
MOVB #$3,CLKSEL ; CLKSEL = 0B00000011; // PLLSEL=0,PSTP=0,PLLWAI=0,RTIWAI=1,COPWAI=1
MOVB #$9,SYNR ;
MOVB #$3,REFDV ;
BSET PLLCTL,#$40 ; PLLCTL_PLLON = 1;
BRCLR CRGFLG,#$8,*+0 ; while(!CRGFLG_LOCK); // Wait till the PLL VCO is within tolerance
BSET CLKSEL,#$80 ; CLKSEL_PLLSEL = 1; // Select clock source from PLLCLK
BCLR ECLKCTL,#$80 ; ECLKCTL_NECLK=0; // Enable the BusClk output at ECLK pin to see busclk if necessary
;--- init PLL end ---
BSET DDRB,#$0F
EndlessLoop:
BSET PORTB,#$0F
BCLR PORTB,#$0F
BRA EndlessLoop ; restart.
;/===================================================================
I believe there will be some difference.
Entire project is attached.
Best regards,
Ladislav