#include "device.h"
#include "driverlib.h"
// Function Prototypes
//
void setup1GPIO(void);
void InitializeLCD(void);
void WriteCommandLCD(unsigned char);
void DisplayLCD(char,char*);
void SendByte(unsigned char );
void LCDDelay();
void WriteDataLCD(unsigned char);
//
// Main
//
void main(void)
{
//
// Initializes system control, device clock, and peripherals
//
Device_init();
//
// Initializes PIE and clear PIE registers. Disables CPU interrupts.
// and clear all CPU interrupt flags.
//
Interrupt_initModule();
//
// Initialize the PIE vector table with pointers to the shell interrupt
// Service Routines (ISR).
//
Interrupt_initVectorTable();
//
// This example is a basic pinout
//
setup1GPIO();
InitializeLCD();
DisplayLCD(1,ragavendra);
}
//
// setup1GPIO - Is an example that demonstrates the basic pinout
//
void setup1GPIO(void)
{
EALLOW;
GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 0; // RS
GpioCtrlRegs.GPADIR.bit.GPIO0 = 1; // GPIO0 = output RS
GpioCtrlRegs.GPAMUX1.bit.GPIO1 = 0; // RW
GpioCtrlRegs.GPADIR.bit.GPIO1= 1; // GPIO1 = output RW
GpioCtrlRegs.GPAMUX1.bit.GPIO2 = 0; // EN
GpioCtrlRegs.GPADIR.bit.GPIO2 = 1; // GPIO2= output
// Initialize GPIO for data bus pins (D0-D7)
GpioCtrlRegs.GPAMUX1.bit.GPIO3 = 0; // D0
GpioCtrlRegs.GPADIR.bit.GPIO3 = 1; // GPIO3= output
GpioCtrlRegs.GPAMUX1.bit.GPIO4 = 0; // D1
GpioCtrlRegs.GPADIR.bit.GPIO4 = 1; // GPIO4 = output
GpioCtrlRegs.GPAMUX1.bit.GPIO5 = 0; // D2
GpioCtrlRegs.GPADIR.bit.GPIO5 = 1; // GPIO5 output
GpioCtrlRegs.GPAMUX1.bit.GPIO6 = 0; // D3
GpioCtrlRegs.GPADIR.bit.GPIO6 = 1; // GPIO6 = output
GpioCtrlRegs.GPAMUX1.bit.GPIO7 = 0; // D4
GpioCtrlRegs.GPADIR.bit.GPIO7 = 1; // GPIO6 = output
GpioCtrlRegs.GPAMUX1.bit.GPI08 = 0; // D5
GpioCtrlRegs.GPADIR.bit.GPIO8 = 1; // GPIO6 = output
GpioCtrlRegs.GPAMUX1.bit.GPIO10 = 0; // D6
GpioCtrlRegs.GPADIR.bit.GPIO10 = 1; // GPIO6 = output
GpioCtrlRegs.GPAMUX1.bit.GPIO11 = 0; // D7
GpioCtrlRegs.GPADIR.bit.GPIO11 = 1; // GPIO6 = output
EDIS;
}
void InitializeLCD(void)
{
GpioDataRegs.GPASET.bit.GPIO2 = 1;
//GPIO_setHigh(myGpio, E);
LCDDelay();
LCDDelay();
LCDDelay();
LCDDelay();
WriteCommandLCD(0x38); //Command to select 8 bit interface
LCDDelay();
WriteCommandLCD(0x38); //Command to select 8 bit interface
LCDDelay(); //Small delay
WriteCommandLCD(0x38); //Command to select 8 bit interface
LCDDelay();
WriteCommandLCD(0x08); //Command to off cursor,display off
WriteCommandLCD(0x01); //Command to Clear LCD
LCDDelay();
WriteCommandLCD(0x06); //Command for setting entry mode
WriteCommandLCD(0x0f); //Command to on cursor,blink cursor
WriteCommandLCD(0x02); //Command return the cursor to home
LCDDelay();
}
void WriteCommandLCD(unsigned char CommandByte)
{
//GpioDataRegs.GPACLEAR.bit.GPIO26 = 1;
GpioDataRegs.GPACLEAR.bit.GPIO0=1;
//GPIO_setLow(myGpio, RS); //Clear RS pin to write command
SendByte(CommandByte);
LCDDelay(); //Small delay
}
void WriteDataLCD(unsigned char CommandByte)
{
GpioDataRegs.GPACLEAR.bit.GPIO0=1;
//GPIO_setLow(myGpio, RS); //Clear RS pin to write command
SendByte(CommandByte);
LCDDelay(); //Small delay
}
void DisplayLCD(char LineNumber,char *Message)
{
int a;
if(LineNumber ==1)
{ //First Line
WriteCommandLCD(0x80); //Select the first line
}
else
{ //Second line
WriteCommandLCD(0xc0); //Select the second line
}
for(a=0;a<16;a++)
{
WriteDataLCD(*Message); //Display a character
Message++; //Increment pointer
}
return;
}
i have written that code for JHD 162A lcd display ...but in that code i have wirtten register instructions like GpioCtrlRegs.GPAMUX1.bit.GPIO6 = 0;,
GpioCtrlRegs.GPADIR.bit.GPIO6 = 1; for pins intiaization But when im compiling this code it shows errors like
Description Resource Path Location Type
#20 identifier "GpioCtrlRegs" is undefined
#20 identifier "GpioDataRegs" is undefined
#20 identifier "GpioDataRegs" is undefined
#20 identifier "GpioDataRegs" is undefined
#20 identifier "GpioDataRegs" is undefined
#20 identifier "ragavendra" is undefined
gmake: *** [lcd displayyy.obj] Error 1
gmake: Target 'all' not remade because of errors. led displayy C/C++ Problem
what is the reason behind that...it needs any header file for that?please correctt that code