Is it allowed to change pin reference within a subroutine?


Closed Thread
Results 1 to 19 of 19

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: Is it allowed to change pin reference within a subroutine?

    bit indexing

    inx var byte [in pbp a bit index cannot exceed 255]


    PORTB.0[inx]

    if inx = 5 then it references portb.5
    if inx = 7 then it references portb.7
    Warning I'm not a teacher

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Is it allowed to change pin reference within a subroutine?

    Code:
    If index = 1 then use_pin = portB.5
    Won't do what you want. use_pin will be be assigned the value of PortB.5 (1 or 0), you can't change aliases at runtime.

    Do it the way Richard shows.

    /Henrik.

Similar Threads

  1. Replies: 8
    Last Post: - 21st March 2015, 17:21
  2. 10F222 Wake on pin change
    By AvionicsMaster1 in forum PBP3
    Replies: 11
    Last Post: - 9th January 2014, 19:14
  3. Reference a port pin from a variable
    By JimAvanti in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 15th February 2012, 20:18
  4. Interrupt-on-Change-pin!
    By PICante in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 11th February 2009, 20:22
  5. HELP !!! How change the voltage of a pin ????
    By stormdacta in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 21st August 2007, 20:55

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