PIC24HJ64GP502

Aus Wiki_2020

Anpassung des internen Oszillators auf exakt 8MHz (4MHz Istructioncycle) durch Register OSCTUNE

<syntaxhighlight lang="MPASM" line start="100" enclose="div">

OSCTUN = 15; //   16 = 255ns Tinstr 
             //   15 = 250ns Tinstr = 4MHz

</syntaxhighlight >

Testroutine in main()

<syntaxhighlight lang="MPASM" line start="100" enclose="div">

while(1)

   {             
     asm("bset, LATB #14");
     asm("bclr, LATB #14");
     asm("bset, LATB #14");
     asm("bclr, LATB #14");
   }

</syntaxhighlight >

ergibt in Assembler:

<syntaxhighlight lang="MPASM" line start="100"  enclose="div">
773:                 while(1)
774:                   {             
775:                     asm("bset, LATB #14");
000882  A8C2CD     BSET 0x2CD, #6
776:                     asm("bclr, LATB #14");
000884  A9C2CD     BCLR 0x2CD, #6
777:                     asm("bset, LATB #14");
000886  A8C2CD     BSET 0x2CD, #6
778:                     asm("bclr, LATB #14");
000888  A9C2CD     BCLR 0x2CD, #6
779:                   }
00088A  37FFFB     BRA 0x882
</syntaxhighlight >

bei korrekter 4MHz Instructiontakt