using same pin for multiple purposes


Closed Thread
Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    190


    Did you find this post helpful? Yes | No

    Default Re: using same pin for multiple purposes

    From the manual.

    INPUT Make pin an input.
    OUTPUT Make pin an output

    Also PBP convention:-

    MCB VAR PORTA.2

    Symbol is Stamp compatibility, not that it really matters if you so wish.

    You also have missing parameters in first lines for ADCON, TRIS etc either % or 0 or 1's
    Last edited by tasmod; - 10th April 2014 at 15:42. Reason: Speeling
    Rob.

    The moment after you press "Post" is the moment you actually see the typso

  2. #2
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: using same pin for multiple purposes

    FOR MCB= 1 TO 0 STEP -1
    PORTB=1
    PORTC=1
    MCB=MCB+1
    NEXT
    At first glance, this will run forever.

    But, MCB is a bit; it can be 0 or 1. What happens first time through the loop when 1 is added to MCB when it is 1?

    Robert

  3. #3
    Join Date
    Apr 2011
    Location
    Welches, Oregon
    Posts
    198


    Did you find this post helpful? Yes | No

    Default Re: using same pin for multiple purposes

    In a loop (for/ next in this case) MCB will increment/ decrement by the step value automatically - no need to add or subtract the value. As:

    For LP = 0 to -1 step -1
    NOP
    Next LP

    LP will be set to 0 the first time through, "loop" and set the value of LP to -1, repeat the enclosed code, and then exit because the "to" condition (LP= -1) is met. Manipulating LP manually is not necessary and only bungs up the sequence. In the case where you subtract 1 from MCB: The initial loop starts with LP=0, in the code you reduce MCB to -1 (by subtracting 1), so the exit condition is met and the "loop" fails to repeat. NONE of the looping code is ever executed with LP equal to -1.

Similar Threads

  1. Programming multiple pics with multiple programs
    By Luckyborg in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 3rd April 2013, 17:47
  2. question about the pin to pin connections on a SPI interface
    By wdmagic in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 4th January 2013, 13:03
  3. Multiple IF-THEN statements
    By DavidK in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 20th June 2007, 18:28
  4. Multiple Data on to USART RX pin
    By Squibcakes in forum Serial
    Replies: 2
    Last Post: - 20th July 2006, 00:37
  5. Multiple HW Interrupts
    By Radiance in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 13th August 2003, 22:35

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