Array of pins


Closed Thread
Results 1 to 7 of 7

Thread: Array of pins

  1. #1
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697

    Default Array of pins

    Hi. Ive seen this in Darrel Taylor's hello world example on his site

    Code:
    LED1   VAR  PORTB.1
    Is it possible to do the same thing with an array?
    EG
    Code:
    LED[1]   VAR  PORTB.1

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Maybe Bruce or Melanie or Sayzer can help.

    Indexing Port Pins
    http://www.picbasic.co.uk/forum/showthread.php?t=3753

    _
    DT

  3. #3
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Hmm. From reading that it doesnt look like i can do it the way i want. I could do what i want with a few if statements.

    What i wanted to do
    Code:
    for x=0 to 15
    if condition(x)=true then
    high pins(x)
    endif
    next
    What i will have to do
    Code:
    if condition(0)=true then
    high porta.1
    endif
    if condition(1)=true then
    high porta.4
    endif
    'etc

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Master, don't beat me.

    But PLEASE try to read Bruce's post.
    The answer really is there.
    <br>
    DT

  5. #5
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Oh. Ill read it through again. It looked like something similar was happening but not exactly what i was after. Ill have another read though and see if i get it

  6. #6
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Sorry. I still dont quite understand. That thread seems to be about loading all the pins into an array. I want selected pins.

    array(0) is porta.6
    array(1) is portb.2
    array(2) is porta.1

    etc

  7. #7
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Just read Bruce's second post. He links to this thread which seems to have what im looking for. Just making sense of it all now

Similar Threads

  1. Bits, Bytes Words and Arrays
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 24
    Last Post: - 14th June 2016, 07:55
  2. Simple Array Demo
    By Archangel in forum Code Examples
    Replies: 5
    Last Post: - 15th February 2010, 04:46
  3. Custom array of pins
    By bmagistro in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 28th March 2009, 23:15
  4. Change On Interrupt, PIC16F884
    By elec_mech in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 14th November 2008, 17:25
  5. RS232 receive an array (packet)
    By ELCouz in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 12th February 2008, 05:02

Members who have read this thread : 1

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