Finally adding the OSC configuration bits and disabeling the watchdog timer so the board stops resetting every 2 minutes.