This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

8X2 KEYPAD INTERFACE WITH TIVAWARE CONTROLLER

Other Parts Discussed in Thread: TM4C123GH6PZ

Hi..I'm interfacing the 8x2 keypad with TIVAWARE controller.i'm using the PORTF(PF0 to PF7)  for scanning column n PORTE (PE6 to PE7) for  scanning rows...

my code i below..


#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/gpio.h"
#include "driverlib/sysctl.h"
#include "driverlib/systick.h"
#include "string.h"

char READ_Keypad();

void GPIO1_Config(void);
int i=0;
char p,c;

int main(void)

{

SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |SYSCTL_XTAL_8MHZ);

SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
GPIOPinTypeGPIOOutput(GPIO_PORTE_BASE, GPIO_PIN_6 | GPIO_PIN_7);
GPIOPinTypeGPIOInput(GPIO_PORTF_BASE, GPIO_PIN_0 | GPIO_PIN_1| GPIO_PIN_2 |GPIO_PIN_3|GPIO_PIN_4 | GPIO_PIN_5| GPIO_PIN_6 | GPIO_PIN_7);

LCDCM_enWrLCDStrng("PRESSKEY",2,2);
while(1)
{
while(!(c = READ_Keypad()));
p=c;
LCDDV_enWrLCDDat(c);
LCD_Delay(200);
while(!(c = READ_Keypad()));

}

}

char READ_Keypad()
{


GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_0 | GPIO_PIN_1| GPIO_PIN_2 | GPIO_PIN_3|GPIO_PIN_4 | GPIO_PIN_5| GPIO_PIN_6 | GPIO_PIN_7,0xff);
GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_6,0X00);
GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_7,0X80);

if((GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_0 )) == 0){LCD_Delay(8);while(GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_0 )== 0); return '6';}
if((GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_1 )) == 0){LCD_Delay(8);while(GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_1 )== 0); return '7';}
if((GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_2 )) == 0){LCD_Delay(8);while(GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_2 )== 0); return '8';}
if((GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_3 )) == 0){LCD_Delay(8);while(GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_3 )== 0); return '9';}
if((GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_4 )) == 0){LCD_Delay(8);while(GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_4 )== 0); return 'O';}
if((GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_5 )) == 0){LCD_Delay(8);while(GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_5)== 0); return 'E';}
if((GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_6 )) == 0){LCD_Delay(8);while(GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_6 )== 0); return 'D';}
if((GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_7 )) == 0){LCD_Delay(8);while(GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_7 )== 0); return 'T';}

GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_6,0X40);
GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_7,0X00);

if((GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_0 )) == 0){LCD_Delay(8);while(GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_0 )== 0); return '1';}
if((GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_1 )) == 0){LCD_Delay(8);while(GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_1 )== 0); return '2';}
if((GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_2 )) == 0){LCD_Delay(8);while(GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_2 )== 0); return '3';}
if((GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_3 )) == 0){LCD_Delay(8);while(GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_3 )== 0); return '4';}
if((GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_4 )) == 0){LCD_Delay(8);while(GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_4 )== 0); return '5';}
if((GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_5 )) == 0){LCD_Delay(8);while(GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_5)== 0); return 'B';}
if((GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_6 )) == 0){LCD_Delay(8);while(GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_6 )== 0); return 'U';}
if((GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_7 )) == 0){LCD_Delay(8);while(GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_7 )== 0); return 'M';}

return 0;


}

please let me known  what i have done mistake in my codeThanks in advance.