chipKIT® Development Platform

Inspired by Arduino™

What is the 2.5usec overhead delay in loop?

Created Fri, 08 May 2015 17:53:10 +0000 by PSalzmann


Fri, 08 May 2015 17:53:10 +0000

In "Programming Hints" in the chipKIT website there is a description of a fast pin toggle shown below. (By the way this needs - #include <plib.h> - to work) and on the UNO32 this toggles at about 20MHz.

Fastest way to toggle bits on a PIC32 The fastest way to toggle a pin on PIC32 is going to be something like

      LATGINV = B01000000;

But every 1 ms there is a 2.5usec stop in the toggling. What is that? I'm guessing it's some core overhead or USB polling?? Thank You - curious!


Fri, 08 May 2015 18:19:28 +0000

That delay is caused by a interrupt that services the millisecond counter. If you are curious I believe the function that runs is defined on line 661 of mpide-0023-windows-20140821\hardware\pic32\cores\pic32\wiring.c


Gary Freegard

Thu, 14 May 2015 16:04:52 +0000


See my reply here [url][/url]

Hope this helps