This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

rearranging the bits of a sfr byte

I have a board that I think is incorectly wired to a keypad and I want to change the way I send data to that port. I am trying to do somthing like this:

struct keypad_pins1 {
   sbit row1 = P2^7;
   sbit row2 = P2^3;
   sbit row3 = P2^2;
   sbit row4 = P2^1;

   sbit col1 = P2^4;
   sbit col2 = P2^0;
   sbit col3 = P2^5;
   sbit col4 = p2^6;
} KEYPAD;

void main (void) {

   KEYPAD = 0xFF;
   KEYPAD &= 0xF0;
   //etc.
}

I have been searching through the c51 documentation and forums here but can't seem to find the solution to my problem. I feel like it is right under my nose but can't recognize it. If this is posted somewhere already and I missed please let me know.

0