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,643


    Did you find this post helpful? Yes | No

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

    owout PortB.0[Dindex],1,[$CC,$44]
    owout PortB.0[Dindex],1,[$CC,$BE]
    owin PortB.0[Dindex],0,[STR Dta\9]
    won't fly




    OWOUT Pin, Mode,[Item...]{,Label}


    Pin may be a constant, 0 - 15, or a variable that contains a number 0 15 (e.g. B0) or a pin name (e.g. PORTA.0).



    pin mapping is a bit vague in tne book



    pin 0 is maybe porta.0 pin 15 might be portb.7 I think it can vary from chip to chip too
    there is reference to it somewhere in the basic_stamp compatability notes , but I can no longer find it
    so
    mypin=13

    owin mypin,[STR Dta\9] is a legal construct















    from the book

    7.6.5 Applying Offsets to Bits within a Variable or Register

    The array mechanism in PBP offers a solution. An offset enclosed in brackets may

    be written after the bit number:

    PORTB.0[x] = 1 ' Set RBx high
    The actual effect of this is to add the value of x to the numeric bit number.

    x = 2
    PORTB.4[x] = 1 ' Set bit(4+x) high. In this case, bit-6 is set.



    NOTE THAT

    PBP COMMANDS WON'T ACCEPT THIS SYNTAX for command parameters. This method can only be used in expressions and with direct register

    access. You CANNOT write:

    HIGH PORTB.0[x] ' COMPILE ERROR

    COUNT PORTB.0[x], 100, y ' COMPILE ERROR
    Warning I'm not a teacher

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,643


    Did you find this post helpful? Yes | No

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

    found the pin map in my old pbp2.60c notes'

    Code:
    8       pin  chips   0-7 gpio   8-15  gpio
    14/20   pin  chips   0-7 porta  8-15 portc
    18      pin  chips   0-7 portb  8-15 porta
    28      pin  chips   0-7 portb  8-15 portc
    40      pin  chips   0-7 portb  8-15 portc
    Warning I'm not a teacher

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