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

    Actually, it doesn't seem possible no matter what value I choose. Using HSPLL and also somehow getting the program to run 4 times slower is tougher than I thought. Now I will probably start experimenting with changing my ADC_SAMPLEUS value as well as all my PAUSE and PAUSEUS statements...

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


    Did you find this post helpful? Yes | No

    Default

    Why do you want PAUSE 1 to pause for 4mS? Can't you just use PAUSE 4?

    Note you do not have to use HSPLL. With a 20MHz osc you can set the PLL divisor to
    /5, USBDIV /2, and the USB core will run at 48MHz. You can set FOSC = HS and set the
    CPU divisor to CPUDIV = OSC1_PLL2 and use DEFINE OSC 20.
    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

    The PAUSE was just an example. I need every instruction and every aspect of the program to run 4 times slower than normal.

    I already was using HS as you suggested and everything was fine, except enumeration would not carry out through a USB hub into a Mac. It worked in every other condition, PC and Mac. When I use HSPLL it enumerates every time in any situation. Unfortunately, my program works best 4 times slower than it does at normal speed, which was very possible using HS in the scenario I outlined above, but not possible so far using HSPLL.

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


    Did you find this post helpful? Yes | No

    Default

    So what did you have the CPU divisor set to when it worked with HSPLL set on the MAC?

    I know zero about the MAC, but it could be that your main-line program code is too slow
    to meet the MAC USB tming. I.E. it could be that a USB device needs to check in more
    often than on a PC platform to maintain the connection.

    More details would really help.
    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

    Here's a simplified question about something I just noticed:

    on an 18F2550 with a 20MHz xtal programmed HS with no postscaler and a DEFINE OSC 20...

    Pause 2000 pauses for exactly 2 seconds

    but with the same setup...

    For cnt=1 to 2000
    Usbservice
    Pause 1
    Next cnt

    pauses just for 258ms

    Why? First off, I thought I wasn't supposed to be able to Pause 2000 and maintain my USB connection but I am. Secondly, what's with the timing discrepancy?

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


    Did you find this post helpful? Yes | No

    Default

    How do you know it pauses just for 258ms?

    If you are not sure PAUSE 1 works, then setup a simple loop to toggle a pin, and watch
    it with a scope.
    Regards,

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

  7. #7
    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.

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