Hello, I am new to the Ti Cortex-M4. I am using the Stellaris launchpad. I am trying to connect my Stellaris Launchpad with my LCD. I want to interface with my LCD by using 8-Bit Data interfacing. I am having trouble doing that. I have chosen PORTA and PORTB to connect to the LCD data pins. I have grounded the Read/Write Pin so its always a write to the memory of the LCD. I connected PE1 to the Register Select Pin (RS) and PE2 to the Enable Pin (E). Below you will find my pin connections from the Stellaris Launchpad to the LCD.
| Stellaris Launchpad Pin | PB0 | PB1 | PA2 | PA3 | PA4 | PA5 | PA6 | PA7 |
| LCD Pins | 7 (D0) | 8 (D1) | 9 (D2) | 10 (D3) | 11 (D4) | 12 (D5) | 13 (D6) | 14 (D7) |
Now to initialize the LCD I must send these Commands 0x38, 0x0E, 0x01 and Send a HIGH to LOW to the Enable Pin and The RS Pin is 0. Below you will find my code
#include "inc/hw_types.h"
#include "inc/hw_memmap.h"
#include "driverlib/sysctl.h"
#include "driverlib/gpio.h"
#include "stdio.h"
int main(void)
{
SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|
SYSCTL_OSC_MAIN);
SysCtlPeripheralEnable(SYSCTL_PERIPH2_GPIOA);
SysCtlPeripheralEnable(SYSCTL_PERIPH2_GPIOB);
SysCtlPeripheralEnable(SYSCTL_PERIPH2_GPIOE);
GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE , GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 |
GPIO_PIN_7);
GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1);
GPIOPinTypeGPIOOutput(GPIO_PORTE_BASE, GPIO_PIN_1 | GPIO_PIN_2);
SysCtlDelay(1000000);
//--------------- First Command 2 Lines and 5x7 Matrix (D0-D7, 8bit)----------------//
// RS = 0, E = 0
GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_1 | GPIO_PIN_2, 0x00);
// PORTA = 56 (DEC), 0x38 (HEX)
GPIOPinWrite(GPIO_PORTA_BASE , GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 |
GPIO_PIN_7, 0x38);
// PORTB = 0 (DEC), 0x00 (HEX)
GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1, 0x00);
// Latch Enable HIGH-to-LOW PULSE
GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_1 | GPIO_PIN_2, 0x04);
GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_1 | GPIO_PIN_2, 0x00);
SysCtlDelay(100000);
//-------------------------------END OF First Command------------------------------//
//--------------- Second Command Display on, cursor blinking ----------------//
// RS = 0, E = 0
GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_1 | GPIO_PIN_2, 0x00);
// PORTA = 12 (DEC), 0x0C (HEX)
GPIOPinWrite(GPIO_PORTA_BASE , GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 |
GPIO_PIN_7, 0x0C);
// PORTB = 2 (DEC), 0x02 (HEX)
GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1, 0x02);
// Latch Enable HIGH-to-LOW PULSE
GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_1 | GPIO_PIN_2, 0x04);
GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_1 | GPIO_PIN_2, 0x00);
SysCtlDelay(100000);
//-------------------------------END OF Second Command------------------------------//
//--------------- Third Command Clear Screen ----------------//
// RS = 0, E = 0
GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_1 | GPIO_PIN_2, 0x00);
// PORTA = 0 (DEC), 0x00 (HEX)
GPIOPinWrite(GPIO_PORTA_BASE , GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 |
GPIO_PIN_7, 0x00);
// PORTB = 1 (DEC), 0x01 (HEX)
GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1, 0x01);
// Latch Enable HIGH-to-LOW PULSE
GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_1 | GPIO_PIN_2, 0x04);
GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_1 | GPIO_PIN_2, 0x00);
SysCtlDelay(2000000);
//-------------------------------END OF Third Command------------------------------//
while(1)
{
}
}
After I program the Stellaris Launchpad nothing happens to the LCD it doesn't get cleared. I have checked my pin connections of my Stellaris Launchpad to the LCD and they are correct. Do you have any suggestions on how to make my code work.
Thank You
