How to generate 10KHz to 200KHz with 18F87J50 ?

Coding and general discussion relating to user created compiler modules

Moderators: David Barker, Jerry Messina

Post Reply
TonyR
Posts: 75
Joined: Fri Jan 14, 2011 11:49 pm
Location: Sydney
Contact:

How to generate 10KHz to 200KHz with 18F87J50 ?

Post by TonyR » Tue Mar 15, 2011 5:53 am

Hi All,

Can anyone suggest an "easy" way to generate 10KHz to 200KHz in 1KHz steps from 12MHz clocked 18F87J50?

I tried the code sample "Using PWM with Swordfish" and found I could nicely get anything up to 65KHz.

Do I have to resort to look up tables?

Thanks for any suggestions.

TonyR
Posts: 75
Joined: Fri Jan 14, 2011 11:49 pm
Location: Sydney
Contact:

Solved

Post by TonyR » Mon Mar 28, 2011 4:57 pm

Solved by clocking PIC at 48MHz and using timer3 and interrupt

Jerry Messina
Swordfish Developer
Posts: 1473
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Post by Jerry Messina » Mon Mar 28, 2011 7:54 pm

I'm curious... how did you end up getting 1KHz steps?

TonyR
Posts: 75
Joined: Fri Jan 14, 2011 11:49 pm
Location: Sydney
Contact:

1KHz Steps

Post by TonyR » Tue Mar 29, 2011 1:17 am

As I think you are guessing they weren't exactly 1KHz steps, just 12MHz divided by the values in 16bit counter.

With external 48MHz clock instead of original 12MHz crystal the steps at the 200KHz end were tolerable for my app.

Post Reply