Generating square-wave of 200kHz


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2007
    Location
    Brazil
    Posts
    108

    Default Generating square-wave of 200kHz

    I've to build a square-wave generator and it should range from 1Hz to 220kHz.

    The difficult is on the 220kHz.
    If I use a @48MHz on these 18F family, I would have 12MHz (FOSC/4) of clock instruction and the fastest interrupt I can achieve is around 1.5MHz.

    Using this config, It is impossible to vary the wanted square-wave, for example, from 220kHz to 219kHz cause my resolution does not allow this. The best I can do is 222kHz or 218kHz.

    Is there a solution to solve this? As I read the datasheet, @48MHz is the maximum clocking for these 18F.

    What do you think about using a dsPIC30F2010? Is it easy programming like the 18F? It works @120MHz.... would solve my problem..

    Thanks in advance.
    Sylvio,

  2. #2
    Join Date
    Oct 2005
    Location
    Loveland CO USA
    Posts
    83


    Did you find this post helpful? Yes | No

    Default Re: Generating square-wave of 200kHz

    Why interrupts?
    Why not use PWM?
    Why not use CCP1, CCP2?
    One of the PWM examples shows changing the dutycycle by 25nS. This gives me the idea you could change the frequency in 25nS steps.

  3. #3
    Join Date
    Jan 2007
    Location
    Brazil
    Posts
    108


    Did you find this post helpful? Yes | No

    Default Re: Generating square-wave of 200kHz

    Why interrupts? -> Can't get 1kHz steps on "high" frequencies: Ex. 201kHz then 202kHz..
    Why not use PWM? -> Same as above...and also can't get low frequencies like 1Hz, 2Hz
    Why not use CCP1, CCP2?
    One of the PWM examples shows changing the dutycycle by 25nS. This gives me the idea you could change the frequency in 25nS steps.

    Where is this example?

    Thanks again.
    Sylvio,

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts