Custom array of pins


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Mar 2009
    Posts
    10

    Default Custom array of pins

    Hello,

    I'm hoping someone can point me in the right direction, I want to create an array of pins something like what is shown below, but I haven't found a way yet. Thanks in advance guys.

    Code:
    myvar[0] = portb.2
    myvar[1] = portc.1
    myvar[2] = portc.5

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by bmagistro View Post
    Hello,

    I'm hoping someone can point me in the right direction, I want to create an array of pins something like what is shown below, but I haven't found a way yet. Thanks in advance guys.

    Code:
    myvar[0] = portb.2
    myvar[1] = portc.1
    myvar[2] = portc.5
    Hi bgmagistro,
    I would submit, that you have !
    Code:
    MyPort var byte     'your new ports name
    myport.0 = portB.0  'seg. A
    Myport.1 = PortA.0  'seg. B
    Myport.2 = PortB.1  'seg. C
    Myport.3 = PortB.2  'seg. D
    MyPort.4 = PortA.1  'seg. E
    Myport.5 = PortA.2  'seg. F
    MyPort.6 = PortB.3  'seg. G
    MyPort.7 = PortB.4  'dec point
    num   var byte      'where your display pattern gets put
    index var byte      'where your number originates
    lookup2 index,[%11111000, %01100000,%11011010],myport    ' just 0,1,2 in this short table
    'myport = num        'display pattern loads into ports for display
                        'you may eliminate the last statement, put myport instead of num
    main: 'do something here
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  3. #3
    Join Date
    Oct 2004
    Posts
    19


    Did you find this post helpful? Yes | No

    Default

    Do you mean something like this?

    myvar1 var portb.1
    myvar2 var portc.3

    Victor

  4. #4
    Join Date
    Mar 2009
    Posts
    10


    Did you find this post helpful? Yes | No

    Default

    i'm looking for something closer to what joe s. has so that i can run some code in a loop and have it change if those pins are high or low without having to have a separate if statement for each pin.

    thanks again in advance

  5. #5
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

  6. #6
    Join Date
    Mar 2009
    Posts
    10


    Did you find this post helpful? Yes | No

    Default

    thanks for the reply that was exactly what i was looking for. I am basing my code off of this post http://www.picbasic.co.uk/forum/show...2&postcount=11. thanks again

  7. #7
    Join Date
    Mar 2009
    Posts
    10


    Did you find this post helpful? Yes | No

    Default

    Would you happen to know how the offset works as mentioned in the previous post? I ran in to some problems with that block of code and think it has to do with finding and setting the offsets of the pins. I am working with a pic18f24k20 if that makes a difference.

Similar Threads

  1. Simple Array Demo
    By Archangel in forum Code Examples
    Replies: 5
    Last Post: - 15th February 2010, 04:46
  2. Array of pins
    By The Master in forum General
    Replies: 6
    Last Post: - 2nd December 2007, 00:21
  3. LCDOUT with custom PINS
    By Josuetas in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 4th September 2007, 01:13
  4. Crystalfontz LCD
    By jman12 in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 9th February 2007, 15:04
  5. Custom array of ports using array?
    By blainecf in forum mel PIC BASIC Pro
    Replies: 22
    Last Post: - 18th June 2006, 01:43

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