Maximum frequency output from a PIC


Closed Thread
Results 1 to 40 of 69

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Maximum frequency output from a PIC

    Hi Nick,
    No worries, I'm glad I could help and I'm glad you got it working.

    My scope is a RIGOL DS4014, it's a 4-channel 100MHz bandwidth scope.
    I've had it for a bit over a year now and I really do enjoy it. There's been a lot of development on the scope market in the last couple of years and there are manufacturers in the far east now churning out some pretty impressive machines (and some quite horrible ones as usual) at prices well below similar specs units from the name brands.

    /Henrik.

  2. #2
    Join Date
    Oct 2012
    Posts
    82


    Did you find this post helpful? Yes | No

    Default Re: Maximum frequency output from a PIC

    Thank you Henrik for everything.

    Regards,

    Nick

  3. #3
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: Maximum frequency output from a PIC

    Couldn't you use the external clock divided by 4 and no program at all?

    or if you need a perfect square wave, come up with a 2MHz signal and drive a Flip-Flop with it?

  4. #4
    Join Date
    Oct 2012
    Posts
    82


    Did you find this post helpful? Yes | No

    Default Re: Maximum frequency output from a PIC

    Hi Art,

    Thank you for your input.
    Please do not take my reply the wrong way and try to understand my points that follow.

    The exercise was to keep the design to a minimum component count, explore unknown features of the PIC processors (unknown to me at the time), be able to modulate a high frequency carrier with the same PIC 10F or 12F family and finally have the most flexibility over the output frequency and duty cycle output. You can not bit the accuracy of the internal clock of the newer PICs if you are trying to use any RC timing circuits and employing any kind of external crystal oscillator defeats the purpose of the exercise.

    As Henrik pointed it to me I love having the opportunity to use “the hammer” when it comes to replacing older ways of doing things. I grew up with doing things the hard way and I am convinced now that employing different caliber PICs the job is much easier.
    Just to give you a stupid example: try designing an oscillator with a flexible frequency and duty cycle in a wide range using discrete components and you will find yourself in a deep trouble especially when one of the parameters changes.

    Use the results of this thread exercise and you will find that all it takes to change one parameter is one or two lines of code. You can use the same hardware over and over for one or multiple projects and all it takes is code changes.

    I’m old. My eyes are failing me and even though I can still replace a 100 pin SMD chip with 0.5 mm pitch (that means remove the old chip and install the new one) in less than 3 minutes with 100% success (my personal record about 15 years ago was 87 seconds) I do want to keep using this skill to a minimum.

    So to answer your question:

    The external clock divided by 4 gives only 50 / 50 duty cycle and only one output frequency for any given main clock. Second part of your question goes in the territory that I’m trying to escape from and gives very little flexibility when changing any parameter because it has to be done in the hardware.

    I’m not being lazy I’m just trying to be more efficient when it comes to using my time especially when the clock is ticking for me on the down side.

    Thanks for your suggestions and keep up the good work. I’ve been following your posts in this forum and I commend you for your great contributions.

    Regards,

    Nick

  5. #5
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: Maximum frequency output from a PIC

    Hi Nick,
    Great post, and objective I've never tried to get out of using an Xtal before,
    so hadn't previously considered some of the difficulties coming up with your own timing.

    I know what you mean, playing with a phone that almost does everything doesn't motivate
    me to build my own computers,
    I do have to come back very soon for a project... kind of have to because I want the thing I'm making

    If it is just a perfectly linear program that can boss the chip out of running any other program,
    such as for a power supply or something... I think as things warm up you lose timing of the internal clock,
    same as if there was voltage fluctuation.
    but for the exercise... with the new rules as I understand them,
    I would try a program that can interrupt itself with an output pin
    connected to the portB interrupt pin. Then you could introduce a linear delay at the interrupt
    vector, and control the delay before turning the interrupt back on.
    I don't know if the jump to the interrupt vector is essentially a GOTO or not.
    It jumps to vector 4, which would not be as fast as resetting the program counter to zero vector.
    and potentially some inaccuracy caused if there's any variation in the response time to the interrupt.
    Cheers, B.

  6. #6
    Join Date
    Oct 2012
    Posts
    82


    Did you find this post helpful? Yes | No

    Default Re: Maximum frequency output from a PIC

    Hi Art,

    I agree with you on your points. One must be careful when simplifying things, like we’ve been doing in this thread, depending on the application.
    For my application 10% accuracy on frequency and duty cycle will be fine. The beauty of what we did here is that instead of doing it the old fashion way, trying to match RC values for target frequency and duty cycle, we used the built in oscillator (which in my opinion is more precise and reliable than RC setup even when using 1% components) and use the code to make any changes. In the process the component count, board space and I’m sure cost went down. I didn’t dream when I started this that (excluding PSU section) with only two PICs, a couple of resistors and capacitors and one Mosfet I can wirelessly transfer power with good efficiency and have the grounds ready for data transfer.
    As for your suggestion at the end of your post you used the magic word (again I’m talking for myself only) INTERRUPTS.
    Yes, they are next on my list and I will start researching how to use them. As soon as I have a clearer image of interrupts I will try to see if they will do any better on my Rx module. I have the feeling that they will eliminate some if not all the jitter but not the delay.

    Regards,

    Nick

  7. #7
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: Maximum frequency output from a PIC

    If you are still going on it, you probably know not to bother looking at BASIC interrupt in this case.
    Usually there is time taken saving and restoring context, but that could likely be avoided
    if the program is under 2K, and doesn't care where it was up to when the interrupt was called.

    I will be writing for a 16F877 soon, and would see how fast I could just cycle a pin,
    but don't have anything to measure it with.

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