Help: how to assign assorted pins to one byte variable


Closed Thread
Results 1 to 9 of 9

Hybrid View

  1. #1
    Join Date
    Aug 2005
    Posts
    42


    Did you find this post helpful? Yes | No

    Default Re: Help: how to assign assorted pins to one byte variable

    What about this?

    Code:
    YourByte var byte
    YourByte=Value you set
    
    portA.1 = YourByte.Bit0
    portA.2 = YourByte.Bit1
    PortC.0 = YourByte.Bit2
    PortC.1 = YourByte.Bit3
    PortC.2 = YourByte.Bit4
    PortB.4 = YourByte.Bit5
    PortB.5 = YourByte.Bit6
    PortB.6 = YourByte.Bit7
    Cheers

    Sean.
    *********************
    http://www.cncdudez.co.uk
    *********************

  2. #2
    Join Date
    Feb 2011
    Posts
    26


    Did you find this post helpful? Yes | No

    Default Re: Help: how to assign assorted pins to one byte variable

    Quote Originally Posted by sean-h View Post
    What about this?

    Code:
    YourByte var byte
    YourByte=Value you set
    
    portA.1 = YourByte.Bit0
    portA.2 = YourByte.Bit1
    PortC.0 = YourByte.Bit2
    PortC.1 = YourByte.Bit3
    PortC.2 = YourByte.Bit4
    PortB.4 = YourByte.Bit5
    PortB.5 = YourByte.Bit6
    PortB.6 = YourByte.Bit7
    Cheers

    Sean.

    Now that was to easy! Dooh!

    I was wondering this morning how to do the .bit thing

  3. #3
    Join Date
    Oct 2009
    Location
    Utah, USA
    Posts
    427


    Did you find this post helpful? Yes | No

    Default Re: Help: how to assign assorted pins to one byte variable

    I guess the real answer is... NO. There is no way in PBP to define a Variable Aliase that represents the mixed pins of different ports, and then be able to write one word to that aliase and have it go out to the pins. Similar to what you can do with a statement like...

    Code:
    PortC = % 10101010
    Comments to each of the posters in order of reply...

    @ ofuzzy1: Thanks for your persistance... I figured it may come down to brute force programming and shifting / and-ing of bits to get them all set.

    @ sean-h: That looks clean... I wonder if it is any slower or faster than fuzzy's method?

    @ rsocor01: Initially I was planning on using "stripboard or veroboard" so I wanted to minimize the wiring and cutting of traces. I may actually end up making a PCB board and if that is the case I'll surely just use Port C that has all 8 bits.

    thanks everyone...

    This is why I REALLY, REALLY wish that the PBP manual had more "real world" examples. Many of the code syntax definitions are so bare that it is hard to understand the use of them.

    I guess if the manual was TOO GOOD there would be no need for a GREAT forum like this one.

    The Scout Camp is this July... I will be putting together the project in the next few months and when I get it done I'll come back here and post code and pictures.

    Here are a couple of excellent examples I have found:

    http://www.instructables.com/id/Mini...-with-built-i/

    Watch the youtube video!

    http://tinkerlog.com/howto/64pixels/


    Others... please post more ideas if you have them
    Dwight
    These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.

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