Prakasit Man
Newbie level 4
- Joined
- Jul 18, 2013
- Messages
- 6
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 40
Dear All experts
Now I am using PIC24FJ16GA002 with CCS C compiler (PCWHD). I have written a simple program Blink LED at port B1.
ON/OFF period is 1 ms. But the output that I got on oscilloscope is "3 ms" not as planned at 1 ms both of on and off.
I have connected 30MHz crystal at pin 9(OSCI) and pin 10(OSCO). Both of this pin have a 22 pF ceramic capacitor connected to the ground.
Below is my code. Could you please advise what I am wrong and which statement I should edit? Is it suspecting on FUSES configuration? :-(
Now I am using PIC24FJ16GA002 with CCS C compiler (PCWHD). I have written a simple program Blink LED at port B1.
ON/OFF period is 1 ms. But the output that I got on oscilloscope is "3 ms" not as planned at 1 ms both of on and off.
I have connected 30MHz crystal at pin 9(OSCI) and pin 10(OSCO). Both of this pin have a 22 pF ceramic capacitor connected to the ground.
Below is my code. Could you please advise what I am wrong and which statement I should edit? Is it suspecting on FUSES configuration? :-(
Code:
#include <24FJ16GA002.h>
#FUSES NOWDT //No Watch Dog Timer
#FUSES NOJTAG //JTAG disabled
#FUSES NOCKSFSM //Clock Switching is disabled, fail Safe clock monitor is enabled
#FUSES XT
#device ICSP=1
#use delay(crystal=30MHz)
#define LED PIN_B1
#define DELAY 1
void main()
{
//Example blinking LED program
while(true)
{
output_low(LED);
delay_ms(DELAY);
output_high(LED);
delay_ms(DELAY);
}
}