picbaisc pro compiler routines "question!"


Closed Thread
Results 1 to 2 of 2
  1. #1
    moud_man's Avatar
    moud_man Guest

    Default picbaisc pro compiler routines "question!"

    hi all

    my question is:

    picbasic pro has too many routines and built in functions so

    if i use for ex. the routine "pause 20" in a line it will be placed in a program location ,if i reused a "pause 20" again will the compiler place another code in the program memory for that or use the previosly one used?

    if i declared a sub-routine that i will use many times as:

    delay:
    pause 20
    return

    is that a solution and better than writting "pause 20" every time i need ?will it affect the program ?

    thnx
    bye

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Code:
    pause 5
    pause 10
    pause 20
    pause 50
    pause 100
    pause 500
    60 words



    Code:
    a var word
    
    a=5:gosub DelayMs
    a=10:gosub DelayMs
    a=20:gosub DelayMs
    a=50:gosub DelayMs
    a=100:gosub DelayMs
    a=500:gosub DelayMs
    
    
    DelayMs:
    pause a
    return
    83 words



    Code:
    a var word
    asm
    DelayMs macro Delay
            MOVE?CW Delay,_a
            L?CALL _DoDelay
            endm
    endasm
    
    
    @ DelayMs 5
    @ DelayMs 10
    @ DelayMs 20
    @ DelayMs 50
    @ DelayMs 100
    @ DelayMs 500
    
    DoDelay:
            pause a
            return
    83 words



    Code:
    @ Ifndef PAUSE?C
      pause 0
    @  endif 
    
    asm
    DelayMs macro Delay
            PAUSE?C Delay
            endm
    endasm
    
    
    @ DelayMs 5
    @ DelayMs 10
    @ DelayMs 20
    @ DelayMs 50
    @ DelayMs 100
    @ DelayMs 500
    60 words
    Last edited by mister_e; - 22nd September 2005 at 14:35.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Replies: 7
    Last Post: - 17th May 2016, 19:03
  2. Replies: 3
    Last Post: - 1st July 2008, 21:07
  3. Pro Compiler Problem - Cancelled
    By Homerclese in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 18th March 2007, 05:48
  4. Replies: 5
    Last Post: - 17th January 2006, 19:26
  5. PIC Basic Pro Compiler
    By iclok in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 25th November 2005, 03:22

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