I am trying to interface a 16 x 2 LCD to my TIVA C series launchpad TM4C123GH6PM, using the keil tool. I am building this project from the scratch and haven't included any headers or added any file to my project ( except the source code ). My code is given below
// port B is for D0-D7
// PE2 is rs
// PE1 is rw
// PE0 is en
// PB7 is busy
// have to initialise port B and port E
#define ldata (*((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_PORTE_DATA_R (*((volatile unsigned long *)0x400243FC)) // bits 7-0
#define GPIO_PORTE_DIR_R (*((volatile unsigned long *)0x40024400))
#define GPIO_PORTE_AFSEL_R (*((volatile unsigned long *)0x40024420))
#define GPIO_PORTE_DEN_R (*((volatile unsigned long *)0x4002451C))
#define GPIO_PORTE_AMSEL_R (*((volatile unsigned long *)0x40024528))
#define GPIO_PORTE_PCTL_R (*((volatile unsigned long *)0x4002452C))
#define SYSCTL_RCGC2_R (*((volatile unsigned long *)0x400FE108))
#define rs (*((volatile unsigned long *)0x40024010))
#define rw (*((volatile unsigned long *)0x40024008))
#define en (*((volatile unsigned long *)0x40024004))
#define busy (*((volatile unsigned long *)0x40005200))
unsigned char string[]={'M','A','X','E','R','I','E','N','C','E'};
void lcd_cmd(unsigned char value);
void lcd_data(unsigned char value);
void lcd_ready(void);
void sendString(void);
void delay(unsigned int itime)
{
unsigned int i,j;
for(i=0;i<itime;i++)
for(j=0;j<50;j++);
}
void sendString()
{
char i;
for(i=0;i<14;i++)
{
lcd_data(string[i]);
}
}
void lcd_cmd(unsigned char value)
{
lcd_ready();
ldata=value;
rs=0;
rw=0;
en=1;
delay(5);
en=0;
return;
}
void lcd_data(unsigned char value)
{
lcd_ready();
ldata=value;
rs=1;
rw=0;
en=1;
delay(5);
en=0;
return;
}
void lcd_ready()
{
busy=1;
rs=0;
rw=1;
while(busy==1)
{
en=0;
delay(5);
en=1;
}
return;
}
void PortB_Init(void){ volatile unsigned long delay;
SYSCTL_RCGC2_R |= 0x02; // 1) activate Port B
delay = SYSCTL_RCGC2_R; // allow time for clock to stabilize
// 2) no need to unlock PB7-0
GPIO_PORTB_AMSEL_R &= ~0xFF; // 3) disable analog functionality on PB7-0
GPIO_PORTB_PCTL_R = 0x00000000; // 4) configure PB7-0 as GPIO
GPIO_PORTB_DIR_R |= 0xFF; // 5) make PB7-0 out
GPIO_PORTB_AFSEL_R &= ~0xFF; // 6) disable alt funct on PB7-0
GPIO_PORTB_DR8R_R |= 0xFF; // enable 8 mA drive on PB7-0
GPIO_PORTB_DEN_R |= 0xFF; // 7) enable digital I/O on PB7-0
}
void PortE_Init(void){ volatile unsigned long delay;
SYSCTL_RCGC2_R |= 0x10; // 1) activate Port E
delay = SYSCTL_RCGC2_R; // allow time for clock to stabilize
GPIO_PORTE_AMSEL_R &= ~0x07; // 3) disable analog function on PE1-0
GPIO_PORTE_PCTL_R &= ~0x00000FFF;// 4) configure PE1-0 as GPIO
GPIO_PORTE_DIR_R &= 0x07; // 5) make PE1-0 in
GPIO_PORTE_AFSEL_R &= ~0x07; // 6) disable alt funct on PE1-0
GPIO_PORTE_DEN_R |= 0x07; // 7) enable digital I/O on PE1-0
}
int main()
{
//lcd_cmd(0x3C); /* 10x5 dot matrix, 2 line dislay, 8 bit data line*/
lcd_cmd(0x38); // 8 BIT DATA , 2LINE, 5X7 DOT MATRIX
lcd_cmd(0x0E); // DISPLAY ON, CURSOR ON, NO BLINK
lcd_cmd(0x01); //CLEAR DISPLAY
sendString();
}
upon compilation i am getting no errors but during the build operation i get the following error
.\lcd_interface2.axf: Error: L6218E: Undefined symbol SystemInit (referred from startup_tm4c123.o).
Not enough information to list image symbols.
Finished: 1 information, 0 warning and 1 error messages.
".\lcd_interface2.axf" - 1 Error(s), 0 Warning(s).
Target not created