Access pin using index


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by xnihilo View Post
    That's not nice but it works
    This may not be any nicer, and I'm not even sure if it'll work...but...

    Code:
    temp var byte
    pin var byte
    
    pin = 0 : temp = porta     'initial pin to zero and save porta to temp
    loop: pin = pin + 1 : if (temp.0[pin] <> 0) AND (pin <> 4) then loop
    got_pin:    'when you get here, if pin = 5 then porta.0 thru porta.3 <> 0

  2. #2
    xnihilo's Avatar
    xnihilo Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    This may not be any nicer, and I'm not even sure if it'll work...but...

    Code:
    temp var byte
    pin var byte
    
    pin = 0 : temp = porta     'initial pin to zero and save porta to temp
    loop: pin = pin + 1 : if (temp.0[pin] <> 0) AND (pin <> 4) then loop
    got_pin:    'when you get here, if pin = 5 then porta.0 thru porta.3 <> 0
    This seems to be the way to index the pin registers.
    In fact before checking the replies on the forum (and your reply) I've tried the tutorial from BRUCE where he is using:
    SYMBOL TRIGGERED_PIN = PORTA

    Then

    IF (TRIGGERED_PIN.0[index] == 0) THEN
    ...

    and it worked fine I'm very happy.

  3. #3
    sheepdog's Avatar
    sheepdog Guest


    Did you find this post helpful? Yes | No

    Default

    You have substituted arrogance for intelligence
    Time enough
    nostromo signing off

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by sheepdog View Post
    You have substituted arrogance for intelligence
    Time enough
    nostromo signing off
    Even I disagree with that statement...(who would've thunk that eh? )

    I think he substituted something that you think MIGHT have worked for him with something that DID work for him.

Similar Threads

  1. Is this a K Type sensor?
    By jessey in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 21st November 2009, 13:55
  2. DS1820 with 16f688
    By jessey in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 23rd May 2009, 05:07
  3. Advice-scrutiny for my serial controller
    By kevlar129bp in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 13th December 2008, 17:11
  4. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  5. Another RTC, DS1287
    By DavidK in forum Code Examples
    Replies: 0
    Last Post: - 12th December 2006, 17:07

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