Aliasing multiple pins


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2008
    Posts
    7

    Default Aliasing multiple pins

    I have a very simple question. Can I create an alias for two input pins say:

    Switch.0 VAR PortA.0
    Switch.1 VAR PortA.1

    And then use Switch with Select Case to perform functions based on the setting of the two switchs.

    When I try to compile the above code, I get a syntax error.

    Thanks...Chris
    Chris Shatara

  2. #2
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    654


    Did you find this post helpful? Yes | No

    Default

    Try replacing the dots by underscores in the variable names like I show you below. I used underscores all the time. I don't think you can use dots in variable names.

    Switch_0 VAR PortA.0
    Switch_1 VAR PortA.1

    Robert

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


    Did you find this post helpful? Yes | No

    Default

    Or
    SWITCH var PortA
    then
    SWITCH.0
    SWITCH.1
    SWITCH.2
    are valid names of each Bit/Port
    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.

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


    Did you find this post helpful? Yes | No

    Default

    or this way
    switch var byte
    switch.0 = portA.0
    switch.1 = portA.1
    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.

  5. #5
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe S. View Post
    or this way
    switch var byte
    switch.0 = portA.0
    switch.1 = portA.1
    OR

    Code:
    Switch VAR BYTE
    
    SW0 VAR PORTA.0
    SW1 VAR PORTB.1
    SW2 VAR PORTC.3
    SW3 VAR PORTD.7
    
    
    Switch.0 = SW0
    Switch.1 = SW1
    Switch.2 = SW2
    Switch.3 = SW3

    :>)
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  6. #6
    Join Date
    Jul 2008
    Posts
    7


    Did you find this post helpful? Yes | No

    Default All Set

    Thanks for the suggestions. What worked well is the first sugggestion,

    Switch_0 var Porta.0
    Switch_1 var PortA.1

    Now I can access the contents of the two switches through Switch.

    Thanks again...Chris
    Chris Shatara

Similar Threads

  1. Multiple Variables - Pins
    By GatorGuy in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 1st February 2010, 01:08
  2. Change On Interrupt, PIC16F884
    By elec_mech in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 14th November 2008, 17:25
  3. Aliasing a port with arbitrary I/O pins?
    By Jayhovah in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 19th May 2008, 15:09
  4. Multiple SERIN's
    By JoeR in forum mel PIC BASIC
    Replies: 4
    Last Post: - 6th October 2005, 22:22
  5. Using Multiple EEPROMs
    By Tom Gonser in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 27th March 2005, 07:37

Members who have read this thread : 0

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts