Hi seokgi,
Your code is missing a C Code block with an OSCCON value at the very start of your program.
The OSCCON=0xXX value sets the speed of internal oscillator.
Without the OSCCON value set, the internal oscillator will run at the default value.
Looking at the datasheet on page 86,its 500KHz:
That's why your hardware is not running correctly.
The easiest way to obtain the correct value is on your flowchart, go to tools and Add IntOsc Helper to your panel.
Right-click the INT OSC Icon on the panel and select properties.
Change the
Oscillator Speed to 32000000
The
Code will contain the word OSCCON and the value along with a semicolon.
Click on the generated value so it's all highlighted.
Right-click Copy.
Add a C code block to the very top of Main so it's always the first thing that's accessed.
Within the C Code block, right-click and select paste.
Now recompile and see if the clock is running at the correct speed.
Edit:
Whoops, Ben beat me to it, but as it took a little while for me to type, will leave the post in.