Speeding up a loop?


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1
    Join Date
    May 2013
    Location
    australia
    Posts
    2,670


    Did you find this post helpful? Yes | No

    Default Re: Speeding up a loop?

    a 16f648a@20mhz just passes 8khz with a 32 step lu in asm for a 4 bit r2r ladder on portb
    my lu values may be dodgy i just guessed them, result looks awful @ any freq


    Code:
    #CONFIG  __config  _INTOSC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_OFF & _MCLRE_ON & _BODEN_ON & _LVP_OFF & _DATA_CP_OFF & _CP_OFF
    #ENDCONFIG
        
    DEFINE OSC 20 
    
    
    inx var byte  bank0
    trisb=%11110000
    goto overasm
    asm
        
    table
        addwf   PCL, F                                          
        retlw    8
        retlw 	 9
        retlw    10
        retlw 	 11
        retlw    12
        retlw 	 13
        retlw    14
        retlw 	 14
        retlw 	 15
        retlw    14
        retlw 	 14
        retlw 	 13
        retlw    12
        retlw 	 11
        retlw    10
        retlw 	 9  
        retlw    8
        retlw    6
        retlw 	 5
        retlw 	 4  
        retlw    3
        retlw    2
        retlw 	 1   
        retlw 	 1
        retlw 	 0
        retlw 	 1   
        retlw 	 1
        retlw    2
        retlw    3
        retlw 	 4
        retlw 	 5
        retlw    6     
    _lu  
        movf _inx ,w
        call table
        MOVE?AB PORTB
        RETURN
    ENDASM         
    overasm:
    inx=0
    loopp:
    CALL lu
     inx=inx+1
     inx =inx&31 
    goto loopp
    Warning I'm not a teacher

  2. #2
    Join Date
    Feb 2013
    Posts
    1,150


    Did you find this post helpful? Yes | No

    Default Re: Speeding up a loop?

    There is another approach. Check this video.

    https://www.youtube.com/watch?v=ophqt_RmiS0

    C
    ode in description.

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,166


    Did you find this post helpful? Yes | No

    Default Re: Speeding up a loop?

    This guy has done unbelievable things with low end PIC and also a color video game with multi channel sound and VGA output on a PIC18F2550!
    http://pic24.ru/doku.php/en/osa/articles/vga_game

    Using an RTOS...

    Ioannis

  4. #4
    Join Date
    Feb 2013
    Posts
    1,150


    Did you find this post helpful? Yes | No

    Default Re: Speeding up a loop?

    Yeah, in his creations, 16F690 outperforms some guys with RPI

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,166


    Did you find this post helpful? Yes | No

    Default Re: Speeding up a loop?

    I dare to say that he is a Case Study! Wish I was proficient in C to run through his code.

    Ioannis

  6. #6
    Join Date
    May 2013
    Location
    australia
    Posts
    2,670


    Did you find this post helpful? Yes | No

    Default Re: Speeding up a loop?

    in my wildest imaginings i never expected such feats on such modest hardware from a rtos.
    humbled yet again.
    rtos something else to learn where will it end?
    Warning I'm not a teacher

  7. #7
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,166


    Did you find this post helpful? Yes | No

    Default Re: Speeding up a loop?

    Who knows really? Very exciting though!

    Ioannis

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