18F2550 timing


Closed Thread
Results 1 to 21 of 21

Thread: 18F2550 timing

Hybrid View

  1. #1
    Join Date
    Aug 2008
    Posts
    12


    Did you find this post helpful? Yes | No

    Default

    I know those pauses are what they are because the circuit outputs a MIDI note across USB to a host computer and an app on that host measures the time between events. Both examples should theoretically pause 2000ms between each MIDI note indicator .

    I'll try the pin toggle to the scope idea. Seems like Pause 1 will take just .129ms because 2000 times through the loop is taking only 258ms for some reason.

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    I think you may be forgetting to add the time it takes for certain functions to execute.

    PAUSE 2000 pauses for 2000 * 1mS.

    For cnt=1 to 2000 ' this takes time
    Usbservice ' this takes time
    Pause 1 ' this should take about 1mS
    Next cnt ' this takes time

    Obviously, the 2nd version is NOT the same. You have to account for the time Usbservice
    takes + the time to execute the for next loop.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3
    Join Date
    Aug 2008
    Posts
    12


    Did you find this post helpful? Yes | No

    Default

    What you said could make sense if the 2nd version actually was taking longer, but it's running 8 times faster.

    remember, pause 2000 is measuring out as 2000ms but the loop example is completing in 258ms!

  4. #4
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    I'm totally guessing here, but it sounds like you might have declared your cnt variable as
    a byte VS a word.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  5. #5
    Join Date
    Aug 2008
    Posts
    12


    Did you find this post helpful? Yes | No

    Default

    You got it. Thanks very much!

    Now my question is, in the 1st example, how is my USB staying connected all the while during the 'Pause 2000' statement? I though 'Usbservice' needed to be thrown in there almost constantly?

  6. #6
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    how is my USB staying connected all the while during the 'Pause 2000'
    I think you'll find this varies from one PC to the next. Yes, I have tested it, and yes it does
    vary. Why? Your guess is as good as mine...;o}

    It may also have something to do with the host software, hub or no hub, number of active
    USB devices online, your butt angle in your seat, position of the stars, etc, etc, but I have
    seen a HUGE difference in time requirements from one app to the next.

    I have a 1-wire temp logger that waits well over 1 second that's never failed. Go figure!
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Similar Threads

  1. 12F683 serout timing
    By Hobie Cat in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 21st December 2009, 16:57
  2. 18f2550 + 24lc512
    By mpardinho in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 20th December 2007, 22:02
  3. 18f2550 oscillator problems
    By rjones2102 in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 28th September 2007, 03:57
  4. 18f2550 'access is denied' USB error?
    By Giulio in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 30th December 2006, 14:29
  5. HSEROUT buffering and timing - 16F88
    By picster in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 5th March 2006, 17: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