Matt Steadman

Using bits of different ports as if they were the same byte

Discussion created by Matt Steadman on Apr 21, 2011
Latest reply on Apr 21, 2011 by kef



I am a Computer Engineering Student and I am working with an MC9S12C32.  I have made a keypad interface using 7 bits of port T.  But now I am making a more complicated project that requires use of the keypad but I will need to move it off of port T, so that I can use the input capture pins for other things.  Due to the limited number of pins that I have access to I am going to need to split this up amongst several different pins of different ports.  I am wondering if there is anyway that I could make a header file similar to the mc9s12c32.h file that is included with code Warrior to define a new byte of memory that is not actually the same byte in the hardware.  That way I can reuse code that has been tested and proven and simply change the calls to Port T to something else.  Is this possible?