Maximum frequency output from a PIC


Closed Thread
Results 1 to 40 of 69

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default Re: Maximum frequency output from a PIC

    Dave, that was a cool project. Did you use a 'depth sounder transducer' to modulate ? They are generally used at 52 and 125KHZ. How far in water do you suppose the signal can travle at that freq ?
    don

  2. #2
    Join Date
    Oct 2012
    Posts
    83


    Did you find this post helpful? Yes | No

    Default Re: Maximum frequency output from a PIC

    While waiting for my 10F PICs I had a little time today and did some experiments with a PIC12F683.
    Using the internal oscillator set for 4MHz and a close loop with Toggle GPIO.x I was getting in the neighborhood of 70 kHz output and 143 kHz for 8 MHz clock.
    Interestingly enough with simple High / Low GPIO.x loop I got about 200 kHz.

    Then I realized that one of the clock options is to use internal clock with clock/4 on clock out pin. This method got me the 1 MHz output for the 4 MHz internal clock and 2 MHz for the 8 MHz internal clock.

    The oscilloscope shows a pretty steady output and my frequency counter gives about 0.15% error.

    If this will prove to be my path I will use a one gate chip to buffer and modulate the output.

    I still wish I will be able to solve it with only one PIC10F and I will try my best to find a solution.

    Nick

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,627


    Did you find this post helpful? Yes | No

    Default Re: Maximum frequency output from a PIC

    Hi,
    The toggle command first makes the pin an output, then it reads the state of the pin, then it inverts the state, then it writes the new state to the pin - takes time.
    High/Low first makes the pin an outout then sets the pins state - takes a little less time.
    You'll get more speed of you write to the pin directly
    Code:
    TRISO.0 = 0  'Make pin an output
    DoIt:
    GPIO.0 = 1
    GPIO.0 = 0
    Goto DoIt
    If you can handle some jitter / discontinuity in the output then something likw this will give you even higher average frequency with the drawback that every 6th pulse will be "missing" due to the GOTO.
    Code:
    DoIt:
    GPIO.0 = 1
    GPIO.0 = 0
    GPIO.0 = 1
    GPIO.0 = 0
    GPIO.0 = 1
    GPIO.0 = 0
    GPIO.0 = 1
    GPIO.0 = 0
    GPIO.0 = 1
    GPIO.0 = 0
    Goto DoIt
    Another aproach would be to use the CCP module, though I'm not sure if the 10F series have that built in.

    Of course if all you need is stable 1MHz (or whatever that can be derived from the oscillator) signal then use clock-out option of the chips oscillator.

    /Henrik.

  4. #4
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: Maximum frequency output from a PIC

    Amgen, The project was a cannon ball replacement for COHO fishing. The sub would track the temperature gradients and depth then control the lure depth as it was connected to the rear of the sub. The data link was the stainless tow wire going up to the boat. The remote readout would display the depth, temperature as well as plot the depth during the tow on an VFD dot matrix display.
    Dave Purola,
    N8NTA
    EN82fn

  5. #5
    Join Date
    Oct 2012
    Posts
    83


    Did you find this post helpful? Yes | No

    Default Re: Maximum frequency output from a PIC

    Thank you Henrik for your suggestions.
    I will try the tonight and report the findings.
    If I must I will stay with 12F series which might give me the corect output.
    The goal is to get 1MHz with output with a 15 mS ON and 5 mS OFF from one single chip.

    Regards,

    Nick

  6. #6
    Join Date
    Oct 2012
    Posts
    83


    Did you find this post helpful? Yes | No

    Default Re: Maximum frequency output from a PIC

    One other choice will be to have the PIC12f output (the 1MHz) controlled ON and OFF by one of its input pins kind like Dave did in his application. This will give me more flexibility with the rest of the concept which is not completely defined yet.
    Once I have a clearer picture I will present it to the forum.

    Nick

  7. #7
    Join Date
    Oct 2012
    Posts
    83


    Did you find this post helpful? Yes | No

    Default Re: Maximum frequency output from a PIC

    If anyone is interested here are the results of the speed test using the two methods suggested by Henrik:
    • Writing directly to the output pin at 8MHz internal clock I got a little over 500 kHz but the duty cycle is 25% or 75% depending on the order you write to the pin 0 or 1.
    • Using x consecutive writes to the pin (but with a gap at the end of the sequence) increases the burst frequency to about 1 MHz with a duty cycle of 50%. BTW I used 10 cycles.

    So far I learned a lot in the process.

    Henrik, based on your prior experience with CCP module I have few questions that you might be able to answer:
    1. What will be the maximum frequency out that can be achieved from a given master clock?
    2. Can the output be turned ON and OFF at some predetermined intervals (let's say 15 mS ON, 5 mS OFF)?
    3. What other requirements are there for the PIC (other the CCP module) to be able to get that?
    4. Will PIC12F683 do the job?

    I will start searching the forum for this kind of applications and I’m sure I might be able to find something to get me started.

    Thank you to all the members of this forum that are making PIC programming accessible to more and more hobbyists.

    Who said you can’t teach old dogs new tricks?:

    Regards,

    Nick

Similar Threads

  1. internal TMR for frequency output
    By Samoele in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th January 2009, 09:38
  2. How to calculate PIC sampling frequency
    By minmin in forum General
    Replies: 1
    Last Post: - 26th September 2006, 18:02
  3. Replies: 2
    Last Post: - 20th January 2006, 21:09
  4. Maximum frequency count on 16F628/4MHz
    By solara in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 23rd May 2005, 10:38
  5. Low frequency output
    By barkerben in forum General
    Replies: 5
    Last Post: - 16th November 2004, 15:25

Members who have read this thread : 0

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