#include <TM4C123gh6pm.h>
#define GPIO_PORTB_DATA_R (*((volatile unsigned long *)0x400053FC)) // bits 7-0 of port B
#define GPIO_PORTB_DIR_R (*((volatile unsigned long *)0x40005400))
#define GPIO_PORTB_AFSEL_R (*((volatile unsigned long *)0x40005420))
#define GPIO_PORTB_DEN_R (*((volatile unsigned long *)0x4000551C))
#define GPIO_PORTB_AMSEL_R (*((volatile unsigned long *)0x40005528))
#define GPIO_PORTB_DR8R_R (*((volatile unsigned long *)0x40005508))
#define GPIO_PORTB_PCTL_R (*((volatile unsigned long *)0x4000552C))
#define GPIO_PORTD_DATA_R (*((volatile unsigned long *)0x400073FC)) // bits 7-0
#define GPIO_PORTD_DIR_R (*((volatile unsigned long *)0x40007400))
#define GPIO_PORTD_AFSEL_R (*((volatile unsigned long *)0x40007420))
#define GPIO_PORTD_DEN_R (*((volatile unsigned long *)0x4000751C))
#define GPIO_PORTD_AMSEL_R (*((volatile unsigned long *)0x40007528))
#define GPIO_PORTD_PCTL_R (*((volatile unsigned long *)0x4000752C))
#define SYSCTL_RCGC2_R (*((volatile unsigned long *)0x400FE108))
#define RS(X) GPIO_PORTD_DATA_R = ((GPIO_PORTD_DATA_R & ~(1<<1))|(X<<1))
#define EN(X) GPIO_PORTD_DATA_R = ((GPIO_PORTD_DATA_R & ~(1<<3))|(X<<3))
#define databits GPIO_PORTB_DATA_R
#define LCD_STROBE do{EN(1);EN(0);} while(0)
#define lcd_display_data_1 "Stellaris |=====>"
#define lcd_display_data_2 "|=====> Launchpad"
#define LINE1 lcd_cmd(0x80)
#define LINE2 lcd_cmd(0xc0)
volatile unsigned long uloop;
//unsigned char string[16];
void setup()
{
SYSCTL_RCGC2_R |= 0x0A;
uloop = SYSCTL_RCGC2_R;
GPIO_PORTB_AMSEL_R &= ~0xFF;
GPIO_PORTB_PCTL_R = 0x00000000;
GPIO_PORTB_DIR_R |= 0xFF;
GPIO_PORTB_AFSEL_R &= ~0xFF;
GPIO_PORTB_DR8R_R |= 0xFF;
GPIO_PORTB_DEN_R |= 0xFF;
GPIO_PORTD_AMSEL_R &= ~0x0A;
GPIO_PORTD_PCTL_R &= 0x00000000;
GPIO_PORTD_DIR_R |= 0x0A;
GPIO_PORTD_AFSEL_R &= ~0x0A;
GPIO_PORTD_DEN_R |= 0x0A;
}
void lcd_cmd(unsigned char c);
void lcd_data(unsigned char c);
void lcd_ready(void);
void sendString(char string[], unsigned int length);
void delay(unsigned int z)
{
unsigned int i;
for(i=0;i<z;i++);
}
void sendString(char string[], unsigned int length)
{
unsigned int i;
for(i=0;i<length;i++)
{
lcd_data(string[i]);
}
}
void lcd_cmd(unsigned char c)
{
lcd_ready();
RS(0);
databits=c;
EN(1);
delay(10);
EN(0);
}
void lcd_data(unsigned char c)
{
lcd_ready();
RS(1);
databits=c;
EN(1);
delay(10);
EN(0);
}
void lcd_ready()
{
LCD_STROBE;
}
void lcd_init()
{
lcd_cmd(0x38);
lcd_cmd(0x06);
lcd_cmd(0x0C);
lcd_ready();
}
int main()
{
while(1)
{
setup();
lcd_init ();
LINE1;
sendString(lcd_display_data_1, 16);
LINE2;
sendString(lcd_display_data_2, 16);
RS(0);
}
}
this my code and its not working kindly help me