Hi..i'm interfacing 8x2 keypad with TM4C123GH6PZ..i done coding for 20x4 LCD.i have accessed the gpio pins like this..
#define E 1 /*PH0*/
#define RS 2 /*PH1*/
#define LCDDATA (*((volatile unsigned long *)0x400043FC)) /*PortA*/
#define LCDCMD (*((volatile unsigned long *)0x400273FC))/*portH*/
i didn't not use the GPIO function for writing the data to LCD.
now i suppose to interface with 8x2 keypad.8 port pins as input n two port pins as output...i'm getting confusion ..i have done my coding like this..Is this correct way to do???
#include "inc/lm4f232h5qc.h"
#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"
#include "lcd.h"
#define cols (*((volatile unsigned long *)0x400253FC)) /*portf*/
#define rows (*((volatile unsigned long *)0x400273FC)) /*portE*/
#define col0 cols^0
#define col1 cols^1
#define col2 cols^2
#define col3 cols^3
#define col4 cols^4
#define col5 cols^5
#define col6 cols^6
#define col7 cols^7
#define row0 rows^0
#define row1 rows^1
int main(void)
{
char c;
SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ);
GPIO_Config();
while(1){
while(!(c = READ_Keypad()));
LCDDV_enWrLCDDat(c);
LCD_Delay(200);
while(!(c = READ_Keypad()));
}
}
char READ_Keypad(void)
{
cols= 0xff;
rows = 0x02;
if((col0 ) == 0){LCD_Delay(8);while((col0 ) == 0); return '6';}
if((col1) == 0){LCD_Delay(8);while((col1) == 0); return '6';}
if((col2) == 0){LCD_Delay(8);while((col2) == 0); return '7';}
if((col3) == 0){LCD_Delay(8);while((col3) == 0); return '8';}
if((col4) == 0){LCD_Delay(8);while((col4) == 0); return '9';}
if((col5)== 0){LCD_Delay(8);while((col5)== 0); return '0';}
if((col6) == 0){LCD_Delay(8);while((col6) == 0); return 'E';}
if((col7)== 0){LCD_Delay(8);while((col7) == 0); return 'D';}
rows = 0x01;
if((col0 ) == 0){LCD_Delay(8);while((col0 ) == 0); return '1';}
if((col1) == 0){LCD_Delay(8);while((col1) == 0); return '2';}
if((col2) == 0){LCD_Delay(8);while((col2) == 0); return '3';}
if((col3) == 0){LCD_Delay(8);while((col3) == 0); return '4';}
if((col4) == 0){LCD_Delay(8);while((col4) == 0); return '5';}
if((col5)== 0){LCD_Delay(8);while((col5)== 0); return 'B';}
if((col6) == 0){LCD_Delay(8);while((col6) == 0); return 'U';}
if((col7)== 0){LCD_Delay(8);while((col7) == 0); return 'M';}
return 0;
}
Please help me..