// include the XC header file to define all register and bit names #include <xc.h> // Setting the PTG the Toggle mode PTGTOGL = 1; // Set for Toggle Mode // Setting the PTG for a Pulse width of 3 PTG clocks PTGEN = 0; // PTGCON can only be written with PTGEN = 0 PTGPWD = 2; // Set pulse width to 3 PTGTOGL = 0; // set for pusle mode