Fast Loop in PICBASIC Pro


Results 1 to 12 of 12

Threaded View

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


    Did you find this post helpful? Yes | No

    Default

    Code:
    I VAR BYTE SYSTEM
    
    LOOP1: ; 150 cycles. Not very fast
        For I=10 TO 1 STEP -1
        NEXT I
        
    LOOP2: ; 90 cycles. A lot better
        I = 10
        REPEAT
         I=I-1
        UNTIL I=0
    
    ASM   ; 31 cycles. Pretty fast
    LOOP3
         MOVLW 0xA
         MOVWF I      ; I=10
    INNER
         DECFSZ I,F   ; I=I-1. IF I=0 skip next instruction
         GOTO INNER  ; Loop until I=0
    ENDASM
    
    FINISH:
        GOTO FINISH
    Last edited by Bruce; - 16th December 2006 at 16:20.
    Regards,

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

Similar Threads

  1. Controlsystem for compact sporting (clay shooting)
    By Fredrick in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 30th July 2009, 17:48
  2. Serial Relays
    By tazntex in forum General
    Replies: 3
    Last Post: - 17th May 2007, 18:42
  3. How to configure SPI in PICBASIC PRO?
    By moogle in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 15th April 2007, 19:31
  4. Question for all that use MELABS PICBASIC PRO
    By oskuro in forum Off Topic
    Replies: 2
    Last Post: - 24th March 2005, 18:15
  5. PicBasic Pro & PicBasic syntax different
    By Billyc in forum General
    Replies: 5
    Last Post: - 16th April 2004, 22:19

Members who have read this thread : 1

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