Assign 2 variables for 1 port..


Results 1 to 5 of 5

Threaded View

  1. #1
    oldtoddler's Avatar
    oldtoddler Guest

    Smile Assign 2 variables for 1 port..

    This might be a fag or at least a newby question.. o:-)
    How do I divide one port into "2 variables" ?
    It works fine if I need all 8 bits, but I only need 3 or 4 and I'd hate to waste any port pins..

    This is what I'm after:

    BUSD VAR PORTD
    A.0 VAR BUSD.0 (A has been defined as BYTE)
    A.1 VAR BUSD.1
    A.2 VAR BUSD.2
    A.3 VAR BUSD.3
    B.0 VAR BUSD.4 (B has been defined as BYTE)
    B.1 VAR BUSD.5
    B.2 VAR BUSD.6
    B.3 VAR BUSD.7
    ...
    LET A=10 (sets PortD pins 0..3 into %1010 = "10")
    LET B=12 (sets PortD pins 4..7 into %1100 = "12")

    any ideas?
    LET BUSD = 202 (%11001010) works fine but it ain't practical way to do it..

    thnx adv..

    /MRa
    Last edited by oldtoddler; - 26th February 2006 at 08:29.

Similar Threads

  1. Variables and port pins
    By PeterReed in forum mel PIC BASIC
    Replies: 2
    Last Post: - 22nd September 2009, 14:01
  2. cant get my Lcd to work using Pic18f452
    By civicgundam in forum General
    Replies: 13
    Last Post: - 7th October 2007, 00:13
  3. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 20:36
  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. pins in arrays?
    By scorpion in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 17th September 2005, 08:18

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