Speeding up a loop?


Results 1 to 14 of 14

Threaded View

  1. #5
    Join Date
    Aug 2011
    Posts
    457


    Did you find this post helpful? Yes | No

    Default Re: Speeding up a loop?

    audio tones up to 10kHz on a 16Fxx architecture with a 20Mhz OSC
    16Fxx isn't the best choice

    For comparison:
    16Fxx @ 20MHz executes instructions at 5 MIPS,
    16F1xxxx @ 32MHz -> 8 MIPS,
    18F @ 64MHz -> 16 MIPS

    Looking back at your original pseudo code with lookup table SINB array in ram:
    Code:
    loop1:
    lookbyte=timebyte and 31
    ampvar=SINB(lookbyte)
    PORTB=ampvar
    timebyte=timebyte+1
    goto loop1
    On a PIC18F @ 64MHz this executes in 1us/loop (1MHz update rate)
    If you put the SINB table in ROM (which is more likely) it slows down to 1.25us/loop (800KHz update rate)

    I didn't do those evaluations using PBP, so I don't know if it's much slower than that.
    Last edited by tumbleweed; - 24th April 2020 at 11:18.

Similar Threads

  1. Do Loop
    By skybox in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 27th December 2012, 00:45
  2. Speeding up the PIC SPI
    By shawn in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 20th April 2011, 16:27
  3. Speeding up HID
    By waynepauly in forum USB
    Replies: 0
    Last Post: - 17th April 2008, 23:14
  4. Needing help with speeding up paralel port
    By Kristjan in forum mel PIC BASIC
    Replies: 2
    Last Post: - 7th November 2007, 13:47
  5. While LOOP
    By actionplus in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 5th March 2004, 14:59

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