Output PIC module


Results 1 to 6 of 6

Threaded View

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


    Did you find this post helpful? Yes | No

    Default

    If I correctly understand your remark:
    pbpin var byte
    pulsout pbpin, w9
    I am able to run PWM, Pulsout, Serout, Serin, Output .... statements
    on pre-programmed numbers of output pins in one shot?!
    Yes and no. You're able to send pulse on a single pre determined PIN for a w9 duration in one shot. Doing some Sub with common called statement or block of statement,l help to reduce the final code size.
    Second question about "!!!! usually we use GOSUB with a RETURN.".
    I have 7 program each has two submodules rotate left/right and each has
    two procedure to calculate W9 value.
    In sum about 28 Gosub and 28 Return statements. My guess is here will be real problem with wrong switching.
    If you don't have much than 4 nested gosubs, it shouldn't cause any problems. If you have more than 4 nested gosubs, your program may branch somewhere else than you expect.

    You can have as much as you want of nested GOTO. As it don't use the STACK... no harm at all.

    There's no trick, no magic formula to avoid problems. As in all programming language, you should avoid too many jump here, there elsewhere and have a good program structure. A flowChart could help to figure out the whole thing. Few gosub line placed one after the other is not a too much bad pratice.
    Code:
    Gosub DoThis
    Gosub DoThat
    Gosub DoSomethingElse
    But the use of nested gosub should be done with care.
    Last edited by mister_e; - 11th September 2005 at 00:05.
    Steve

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

Similar Threads

  1. HSERIN & Interupts (aka controlling PIC programs from a remote PC)
    By HankMcSpank in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 17th June 2009, 14:46
  2. Pic getting part power from Analog Port
    By ShaneMichael in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 22nd April 2009, 10:34
  3. pic to pic ir link versus wired link : help please anyone
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 30th May 2008, 21:01
  4. Replies: 8
    Last Post: - 17th September 2006, 17:46
  5. Analog Output from a PIC
    By robertmark68 in forum General
    Replies: 4
    Last Post: - 2nd August 2006, 18:06

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