Professional Documents
Culture Documents
LCD
LCD
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
<stdint.h>
<stdbool.h>
"inc/hw_memmap.h"
"inc/hw_types.h"
"driverlib/gpio.h"
"driverlib/pin_map.h"
"driverlib/rom.h"
"driverlib/sysctl.h"
"driverlib/uart.h"
"utils/uartstdio.h"
"inc/tm4c123gh6pm.h"
"lcd5110.h"
RS PE1
EN PE2
LCD_STROBE do{EN=BIT2;EN=!BIT2;}while(0)
databits GPIO_PORTD_DATA_R // P1.7 - D7, ....., P1.4 - D4
LINE1 cmd(0x80)
LINE2 cmd(0xc0)
SysCtlDelay(15000);
databits = (c);
LCD_STROBE;
}
void clear(void)
{
cmd(0x01);
SysCtlDelay(30000);
}
void lcd_init()
{
pseudo_8bit_cmd(0x30); //this command is like 8 bit mode command
pseudo_8bit_cmd(0x30); //lcd expect 8bit mode commands at first
pseudo_8bit_cmd(0x30); //for more details, check any 16x2 lcd spec
pseudo_8bit_cmd(0x20);
cmd(0x28); //4 bit mode command started, set two line
cmd(0x0c); // Make cursorinvisible
clear(); // Clear screen
cmd(0x6); // Set entry Mode(auto increment of cursor)
}
void string(char *p)
{
while(*p) data(*p++);
}
int main()
{
while(1) {
setup();
lcd_init();
LINE1;
string("Stellaris |====>");
LINE2;
string("|====> Launchpad");
SysCtlDelay(50000);
RS=!BIT1;
while(1);
}
}