understanding the pulse.


Closed Thread
Results 1 to 37 of 37

Hybrid View

  1. #1
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by geckogrotto View Post
    I do have another question tho

    On a 4mhz chip how long would this take to add 1 and get back to while?

    while GPIO.4=0
    Nosig = Nosig + 1
    wend
    So, in my world:
    one channel, idles low, 1-2 ms high going pulse, repeats every 20ms, no matter the high going pulse width

    In your world:
    one channel, idles high, 5-20ms low going pulse, repeats every 15-30ms depending on the low going pulse, minimum of 10ms idling high...

    Is that good? Sure, you can get a freq off that.
    And what I meant by the end result was...what is this whole thing running off of, what's it supposed to do in the end? Is this a new egg frying machine

    As far as measuring the time in the above example, one way I do it is to write a program that is only the above example. I label every line. When done, I go back into the generated .lst file, find those labels, and write down the hex address for each label. Most instructions take 1 cycle (ie. 1us @ 4mhz clock rate), jumps, goto's, branches, etc. take 2 cycles (ie. 2us @ 4mhz clock). So, in your example (and I'm guessing here):

    while GPIO.4=0 a 'bit test, skip if clear' instruction 1 or 2 cycles depending
    Nosig = Nosig + 1 an 'add' instruction, 1 cycle
    wend[/QUOTE] a 'jump' or 'goto', should be 2 cycles

    So, this could be anywhere from 4 to 5 cycles depending on conditions. However, there are also bank bits to set sometimes if your code goes over code boundaries (not applicable in the 18F world) which will add 1 or 2 cycles. So, now you're at anywhere from 4 to 7 cycles per loop. Best way to figure it out is how I described it earlier. Or use MPLAB's IDE simulator and use the 'stopwatch' function. Or just build a prototype that'll work off it and toggle an led and 'scope those leds for freq.

  2. #2
    Join Date
    Aug 2006
    Posts
    91


    Did you find this post helpful? Yes | No

    Default

    Ugg I typed up a reply but it didn't get posted.

    Basically I get the same results as you do on the standard servo signal and the new results on the new one.

    I'm not doing anything amazing or anything just trying to adapt a cheapo Tx Rx to a standard servo signal whoo hoo.

    Also thanks for the help on the time, I don't need it that specific so 5us is close enough. Whats a few millionths of a second between friends hehe

Similar Threads

  1. Pulse Capture and byte building
    By boroko in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 21st July 2009, 02:59
  2. Single digit 7 Seg LED clock - PIC16F88
    By thirsty in forum Code Examples
    Replies: 4
    Last Post: - 17th July 2009, 09:42
  3. Replies: 3
    Last Post: - 13th September 2008, 18:40
  4. Better understanding PULSIN
    By Wirecut in forum mel PIC BASIC
    Replies: 12
    Last Post: - 29th June 2008, 11:17
  5. Pulse Frequency Multiplication
    By jamie_s in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 21st August 2005, 11:39

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