Assign 2 variables for 1 port..


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    oldtoddler, You should mask variable A for $1111 as adding it to B would be incorrect as far as binary. You should use something like A=A & %00001111 or A=A MIN 15. These statements will limit variable A to a maximum value of 15 or binary %00001111. You could just add the mask as such:
    BUSD = (B << 4) + (A & 15)

    Dave Purola,
    N8NTA

  2. #2
    oldtoddler's Avatar
    oldtoddler Guest


    Did you find this post helpful? Yes | No

    Thumbs up

    Quote Originally Posted by Dave
    You could just add the mask as such:

    BUSD = (B << 4) + (A & 15)

    N8NTA
    Neat! Getting better all the time..
    Thnx Dave, I'm getting the idea..

    --
    a = (b>c) ? (d=e,d+f) : (g=h,g+i);

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