Accessing Portion of Input Port


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    Join Date
    Aug 2008
    Posts
    39


    Did you find this post helpful? Yes | No

    Default

    I know I can do it that way I was just looking to do it with out the and satements... so I can say something like:

    Code:
    IF PortA135 = $6h then
    
    endif

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Frozen001 View Post
    I know I can do it that way I was just looking to do it with out the and satements... so I can say something like:
    Code:
    IF PortA135 = $6h then
    endif
    IF ( PortA AND %00101001 ) = $29 (in this case all bits must be logic high) THEN whatever

    Or are you talking about pulling out PortA. bits 1, 3, and 5 (or whatever) and putting them in temp. bits 0,1,2 ???
    Last edited by skimask; - 24th October 2008 at 16:51.

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


    Did you find this post helpful? Yes | No

    Default

    That is also possible. You can use the bit AND operator (&).

    Code:
    if (porta & %00010101)=%00010101 then
    The purpose of (porta & %00010101) is to strip out the unwanted information. Only the bit where you see a 1 will be kept from porta. Then you compare that with the value you are looking for

    Edit: Looks like skimask got there before me!

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by The Master View Post
    Edit: Looks like skimask got there before me!
    MMMMWWWWAAAAHAAAAAA!!!!!!
    (don't know if you guys do much for Halloween over there or not...but there it is )

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    (don't know if you guys do much for Halloween over there or not...but there it is )
    Have you seen half my threads?!?! I dont think many people celebrate it here but i sure do Its my fave time of the year

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    I do a little morphing this time of year too.
    <img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=2931&stc=1&d=122486118 8">
    Attached Images Attached Images  
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    Is that going to be your new avatar for next week?

    Thinking about it, i should get an avatar for halloween!

  8. #8
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by The Master View Post
    Is that going to be your new avatar for next week?

    Thinking about it, i should get an avatar for halloween!
    I can not figure out how to up load an animated avatar. But that is what I was thinking.
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. Input and Output on same Port
    By Frozen001 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 13th November 2008, 19:46
  2. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 18:27
  3. Timing input pulses and re-outputting them
    By jamie_s in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 28th February 2007, 02:50
  4. Can defines be changed with port input?
    By Archangel in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 24th November 2006, 23:50
  5. Duplicating port input to port output
    By lwindridge in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 26th April 2004, 22:43

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