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.

PIC18F2550 generate 1MHz Squre wave

Status
Not open for further replies.

yzriver

Member level 2
Joined
Sep 15, 2002
Messages
51
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Activity points
372
How can I generate a MHz squre wave signal from PIC18F2550. As I understand, the time0 output frequency = 20MHz/4/256=19K. I have a 20MHz crystal on board, timer0 is set in 8 bit mode.

thanks,
 

i think its not possible for 8bit.
in 18f458 has timer0 has both 8bits and 16 bits
you can use 16 bit from timer0
 

How can I generate a MHz squre wave signal from PIC18F2550. As I understand, the time0 output frequency = 20MHz/4/256=19K. I have a 20MHz crystal on board, timer0 is set in 8 bit mode.

thanks,

Hi,

As you say, 20Mhz is /4 to give the clock speed of 5Mhz - so how could you divide that down to 1Mhz ?

What you could try, is to use the internal oscillator at 4 meg and RA6 to output FOSC/4

Datasheet Osc Section
12. INTCKO Internal Oscillator used as
microcontroller clock source, EC
Oscillator used as USB clock source,
FOSC/4 output on RA6
 

If you don't need to do other tasks you can make a 1MHz square wave output like this;
Code:
loop1MHz
  bsf LATB,0
  nop
  bcf LATB,0
  nop
  goto loop1MHz

That gives a 1MHz squarewave with 40% duty cycle.
 

You can as well hook up 4MHz crstal (or multiple of that) and spin up the PLL to 48MHz which gives Fcy of 12Mhz. Although doing anything else while generating 1meg square wave is still impossible. Really PIC18 doesn't have hardware way of doing that.

Go for cortex M0. Stuff like LPC1111 costs like 1/2 or 1/3 of what pic costs and goes up to 50MHz. Generating such stuff should not be a problem.

Otherwise you can easily get 1MHz active quartz clock generator which gives quite nice square wave.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top