Dear e2e members,
The question is very basic but I'm getting some fluctuations in the following case.
Hardware: EK-TM4C123GXL
I have to configure bits 0,1,2 and 3 as output and 4,5 and 6 as input. (for a 4x3 matrix keypad for which I have a tested algorithm for de-bounce etc.)
I am testing the following elementary codes:
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); GPIO_PORTB_DIR_R = 0x00; //define bits 0-7 as input GPIO_PORTB_DEN_R = 0xff; // define bits 0-7 as digital pins int val; val = GPIO_PORTB_DATA_R; //read data from PORTB
Will this code work? What is the instruction to read data from specific GPIO bits if the last instruction is incorrect? Thanks