Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Not sure why pulse period not looks the same as code?

Status
Not open for further replies.

Prakasit Man

Newbie level 4
Joined
Jul 18, 2013
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Location
Bang Yai, Nonthaburi, Thailand, Thailand
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? :-(

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);
   }

}
 

I had a similar problem once with another controller, I dont know if thats relevent here but in my case it was very stupid. I was using a crystal which was written as 20MHz but actually it was 8MHz. May be you can check for this manufacturing defect by changing crystal
 

I had a similar problem once with another controller, I dont know if thats relevent here but in my case it was very stupid. I was using a crystal which was written as 20MHz but actually it was 8MHz. May be you can check for this manufacturing defect by changing crystal

Thank you for reply anyway,

I have come back to the datasheet again at the table 27-15.
FUSES has been changed to HS and the fast (HS) oscillator only supports 30MHz over part of it's voltage range.
Anything over 24Mhz, I really need to be using the PLL. So I have changed xtal to 16MHz. It's already work now.
 

Oh yeah rite!! dint strike me :)
Generally such small things go unnoticed. I think I should also make a note of it.
Cheers!!
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top