Hai,
I wrote a code to interface LCD with Tiva launchpad, but there is nothing displayed on the LCD and i cant find whats wrong in my code ,please help me to correct my code..
#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/sysctl.h"
#include "driverlib/gpio.h"
void Lcd_Dislay(unsigned char data,unsigned int com)
{
GPIOPinWrite(GPIO_PORTB_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, data);//LCD data
GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_0,com);//LCD mode
GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_1,1);//enabling lcd by high to low pulse
SysCtlDelay(4);
GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_1,0);
}
void Lcd_Init()
{
Lcd_Dislay(0x38,0);
SysCtlDelay(4167);
Lcd_Dislay(0x0c,0);
SysCtlDelay(4167);
Lcd_Dislay(0x01,0);
SysCtlDelay(4167);
}
void Lcd_String_Display(unsigned char *str)
{
while(*str)
{
Lcd_Dislay(*str,1);
str++;
}
}
int main(void)
{
SysCtlClockSet(SYSCTL_SYSDIV_16|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
GPIOPinTypeGPIOOutput(GPIO_PORTB_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);
GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_0|GPIO_PIN_1);
GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_0|GPIO_PIN_1,0x00);
Lcd_Init();
Lcd_String_Display("hai how are you....");
}