We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Dear all, I have a small keyboard in my application and I poll all the keys periodically. I can read all the key values with 2 bytes. Next, I check the bits of these bytes for specific keys. In my program, I have function (check_button()) which gets the byte value and the bit index of the required key. It extracts the bit using '>>' and '<<', and interprets the value.
for (button_index=0; button_index<8; button_index++) check_button(button_port_1, button_index); : : : void check_button(unsigned char buttons, unsigned char button_index) { get the bit using << and >> process it }
for (button_index=0; button_index<8; button_index++) { button_port_1 >>= 1; (I need to get the carry bit) check_button(carry_bit_taken_above, button_index); }
Jon, Thanks for the reply. I'll use this approach for bit access.