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.
Excuse me for asking - I don't normally program C51 with Keil tools - but do the compiler really allow you to create a struct containing bits mapped to a port? I would assume that such a construct is forbidden, since each sbit in this case already has a fixed physical address.
You obviously can not have two variables of such a struct and have them represent different values.
No, it doesn't!
Well, it was more of a rhetorical question :)