jrz126
Active Member
Hey gang,
I'm trying to interface a 4x4 keypad to a 16f877A and Im having some problems. I'm familar with the scanning routine and whatnot, I'm just having difficulty reading in the pins.
I have pins B4-B7 connected as my outputs, and pins B0-B3 as my inputs, which have pullup resistors as well.
I dont know how to read in just the lower half of port B, I have my code set up like this:
does that look ok?
I'm trying to interface a 4x4 keypad to a 16f877A and Im having some problems. I'm familar with the scanning routine and whatnot, I'm just having difficulty reading in the pins.
I have pins B4-B7 connected as my outputs, and pins B0-B3 as my inputs, which have pullup resistors as well.
I dont know how to read in just the lower half of port B, I have my code set up like this:
Code:
set_tris_b(0x0F); //upper half is output
output_bit( PIN_B7, 0);
output_bit( PIN_B6, 0);
output_bit( PIN_B5, 0);
output_bit( PIN_B4, 0);
while(1)
{
row=input_b();
printf("row %i\n\r",row);
delay_ms(1100);
}
does that look ok?