Thread: changing pin orders in a #define varaible?

  1. #16
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by graeme View Post
    Thanks, but I'm not wanting to actually set the bits in this expression, just rearrange the ports into another order so I can use

    Code:
    MYPORT = EIGHT;
    MYPORT2 = NINE;
    MYPORT3 = SIX;
    where each MYPORTx is a combination of various ports.
    How is that consistent with your previous desire to make myport equal to 0b0001101 (or whatever it was)? That's "set[ting] the bits".
    Quote Originally Posted by graeme View Post
    I could define different EIGHT,SIX's etc for each port but thats what I'm trying to work around. Am I making any sense yet??

    Thanks for the help too though guys!
    And what do you want EIGHT, and SIX, etc to be? I thought EIGHT was a collection of pins?

  2. #17
    Registered User
    Join Date
    Oct 2008
    Location
    TX
    Posts
    2,059
    Alright first map the various ports ie PA0 PA4 PB5 etc. to the segment displays a-g and then tell us how you want 'em pulsed (high/low).

  3. #18
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262
    What I think he wants is map a variable to a set of bits. Eg. that he can write "PINX = HIGH;" to set bit X.
    Am I right?

    In that case, you should probably use a function like so:
    Code:
    setPin(PINX, HIGH);
    Or something similar. It theoretically is possible the way you want it, but it's going to be messy and probably unportable (well, if you defined the bitset yourself then you can use a union).

    So am I right with what you want? And if so, is the setPin/getPin good enough as well?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Buidl Library with ./configure script
    By Jardon in forum C Programming
    Replies: 6
    Last Post: 07-24-2009, 09:36 AM
  2. Pointer within a Struct
    By Bladactania in forum C Programming
    Replies: 11
    Last Post: 04-03-2009, 10:20 PM
  3. Why?!?
    By p3rry in forum C Programming
    Replies: 3
    Last Post: 01-08-2009, 12:52 PM
  4. size of an integer pointer
    By onebrother in forum C Programming
    Replies: 5
    Last Post: 07-09-2008, 11:49 AM
  5. My graphics library
    By stupid_mutt in forum C Programming
    Replies: 3
    Last Post: 11-26-2001, 06:05 PM