PULSIN Resolution


Closed Thread
Results 1 to 12 of 12
  1. #1
    cotang's Avatar
    cotang Guest

    Default PULSIN Resolution

    The manual states that at 4Mhz the resolution is 10us. At 20Mhz it is at 2us. How fast do I need the clock to have a resolution of 1us?

    Thanks.

  2. #2
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    40Mhz .

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Silly question but how is that calculated?

  4. #4
    cotang's Avatar
    cotang Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by CocaColaKid
    Silly question but how is that calculated?
    Actually that is NOT a silly question. I'm kinda carious myself.

  5. #5
    Join Date
    Dec 2003
    Location
    Wichita KS
    Posts
    511


    Did you find this post helpful? Yes | No

    Default

    My first thought would be in the time it takes to do the routine...

    For example...The routine takes a certain amount of "Time" in us to execute. Thus your Pulsin resolution will take a certain amount of time to run through its routine before it can receive accurately the next pulse. If the routine takes 1000 us to read a pulse, then the maximum frequency it can read would be 1 pulse every 1 MS. which is 1000 hz. If you double the clock speed, your Pulse statement can read twice as fast, thus be able to read a pulse every 500 us... giving a 2000 hz speed max.



    Dwayne
    Last edited by Dwayne; - 17th November 2005 at 19:54.
    Ability to Fly:
    Hurling yourself towards the ground, and missing.

    Engineers that Contribute to flying:
    Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute

    Pilots that are Flying:
    Those who know their limitations, and respect the green side of the grass...

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


    Did you find this post helpful? Yes | No

    Default

    cotang, What statement in the book are you speaking of? If it is something like Pulsin, Rctime the resolution is based on the oscillator frequency and not the instructions being executed.

    Dave Purola,
    N8NTA

  7. #7
    cotang's Avatar
    cotang Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Dave
    cotang, What statement in the book are you speaking of? If it is something like Pulsin, Rctime the resolution is based on the oscillator frequency and not the instructions being executed.

    Dave Purola,
    N8NTA
    Its under the Picbasic pro manual where it defines Pulsin. Its states that for 4 mhz the pulse width returned is 10us. FOr 20mhz its is 2us. I tested it out and it correct, I just wondering how fast of a clock speed I need to get 1us or 0.5us resolution.

  8. #8
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by cotang
    I just wondering how fast of a clock speed I need to get 1us or 0.5us resolution.
    I would guess 40MHz and 80MHz respectively.

    Guess based on the fact that it must take a minumum number of cycles to execute and the product of Clock in MHz and Resolution in uS seems to remain contant eg

    4 * 10 = 40
    20 * 2 = 40

    therefore

    40 / 1 = 40
    40 / 0.5 = 80

    I also think that 8Mhz would give 5uS resolution

    40 / 8 = 5
    Keith

    www.diyha.co.uk
    www.kat5.tv

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


    Did you find this post helpful? Yes | No

    Default

    keithdoxey, 40 Mhz. is correct for getting 1uS resolution. However 80Mhz. would be a stretch for a PIC micro. If you need 1uS resolution why not use the internal timers available in the PIC and use atleast a 4Mhz. crystal? That will give you 1uS. resolution..

    Dave Purola,
    N8NTA

  10. #10
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Dave
    However 80Mhz. would be a stretch for a PIC micro.
    Hi Dave,

    I realise that a PIC wont run at that speed....yet, but give them a couple of years and we will probably see devices that will run at 100MHz+.

    Look at the way Intel and AMD clock speeds have shot up over the last few years!

    Also look at how the available memory is increasing as well. PICs are getting evermore powerful

    Regards
    Keith

    www.diyha.co.uk
    www.kat5.tv

  11. #11
    Join Date
    Sep 2008
    Posts
    19


    Did you find this post helpful? Yes | No

    Default

    Is there a way to make pulsin count slower?

  12. #12
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Athough it might be nice ...

    There aren't any defines that would make PulsIn count slower.

    A slower OSC freq makes it count slower, or you could create your own define that adds some NOP's to the library routine. (not recommended)

    Might just be easier to create a simple subroutine to count the time in a loop, which is all PulsIn does anyway.
    <br>
    DT

Similar Threads

  1. Replies: 17
    Last Post: - 12th April 2014, 02:17
  2. PULSIN & RCTIME resolution calculation
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 5th January 2010, 14:34
  3. Better understanding PULSIN
    By Wirecut in forum mel PIC BASIC
    Replies: 12
    Last Post: - 29th June 2008, 10:17
  4. Funny PULSIN values: what is going on???
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 30th April 2008, 08:02
  5. Pulsin 16F819 problem
    By rekcahlaer in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 11th April 2007, 13:52

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