You are currently viewing How to Interface GLCD with ARM9 Stick Board

How to Interface GLCD with ARM9 Stick Board

Spread the love

ARM9-LPC2929 STICK BOARD

The is specifically designed to help students to master the required skills in the area of embedded systems. The board is designed in such way that all the possible features of the microcontroller will be easily used by the students. The board supports Keil µVision 4 compilers with Keil ULink2.

NXP Microcontroller,ARM9-LPC2929 stick boardis proposed to smooth the progress of developing and debugging of various designs encompassing of speed 32-bit Microcontrollers. It integrates CAN, LIN, UART, ADC, PWM, I2C, SPI, Timer, Interrupt etc., to create a stand-alone versatile test platform.

ARM9 Stick Board having more no of I/O line for user access able. Its consists of 64 GPIO pins, CAN0/1, LIN1, I2C0/1, UART0/1, SPI0/1, USB, ADC0/1/2, PWM, Timer and more features. Users can easily access the controller and develop more application by using

ARM9 Stick Board.

In GLCD interface 14 lines needed to create 8-bit interface; 8 data lines (D0 – D7); Four control lines, address bit (RS), read/write bit (RW), control signal (EN) and GLCD reset (RST); Two chip select lines (CS0 and CS1).

Circuit and Pin Diagram for Interface GLCD with ARM9 Stick

circuit-and-pin-diagram-for-interface-glcd-with-arm9-stick

Example for Interface GLCD with ARM9 Stick

interface-glcd-with-arm9-stick

C Program to display an image in GLCD using ARM9 Stick Board

Title: Program to GLCD display
#include //Register Description Header for LPC2929

#define CS0 0x0004 // Chip select line0

#define CS1 0x0008 // Chip select line1

#define RS 0x0010 // Register Select

#define RW 0x0020 // Read Write Enable

#define EN 0x0040 // Enable

#define RST 0x8000 // GLCD Reset

#define D7 0x4000 // Data Line 7

#define D6 0x2000 // Data Line 6

#define D5 0x1000 // Data Line 5

#define D4 0x0800 // Data Line 4

#define D3 0x0400 // Data Line 3

#define D2 0x0200 // Data Line 2

#define D1 0x0100 // Data Line 1

#define D0 0x0080 // Data Line 0

void GLCD_Init (void);

void GLCD_Page (char);

void GLCD_Cmd (char);

void GLCD_Data (char);

void GLCD_Draw (char *Base);

void Delay(unsigned int);

char i;

char CMD[] = {0x3E,0xC0,0xB8,0x40,0x3F}; // GLCD Commands

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xFFFF; // P3.0 to P3.15 select as Input Direction

GLCD_Init ();

while(1)

{

Delay(5);

GLCD_Draw(PAN_LOGO);

}

}

void GLCD_Init(void) // GLCD Initialize function

{

GPIO3_OR |= RST; // Set High as Reset

Delay(5);

GPIO3_OR &= ~RST; // Set Low as Reset Delay(5);

GPIO3_OR |= RST; // Set High as Reset

GLCD_Page(1);

for(i=0;i<5;i++)

{

GLCD_Cmd(CMD[i]);

}

GLCD_Page(0);

for(i=0;i<5;i++)

{

GLCD_Cmd(CMD[i]);

}

}

 

void GLCD_Page(char Page)

{

if (Page)

{

GPIO3_OR &= ~CS0; GPIO3_OR |= CS1; // Set High as CS1 and Low as CS0

}

else

{

GPIO3_OR &= ~CS1; GPIO3_OR |= CS0; // Set High as CS0 and Low as CS1

}

}

void GLCD_Cmd (char c)

{

if(c & 0x80) GPIO3_OR |= D7; else GPIO3_OR &= ~D7; // Set data for Data Line 7

if(c & 0x40) GPIO3_OR |= D6; else GPIO3_OR &= ~D6; // Set data for Data Line 6

if(c & 0x20) GPIO3_OR |= D5; else GPIO3_OR &= ~D5; // Set data for Data Line 5

if(c & 0x10) GPIO3_OR |= D4; else GPIO3_OR &= ~D4; // Set data for Data Line 4

if(c & 0x08) GPIO3_OR |= D3; else GPIO3_OR &= ~D3; // Set data for Data Line 3

if(c & 0x04) GPIO3_OR |= D2; else GPIO3_OR &= ~D2; // Set data for Data Line 2

if(c & 0x02) GPIO3_OR |= D1; else GPIO3_OR &= ~D1; // Set data for Data Line 1

if(c & 0x01) GPIO3_OR |= D0; else GPIO3_OR &= ~D0; // Set data for Data Line 0

GPIO3_OR &= ~RS; GPIO3_OR &= ~RW; // Set Low as RS and RW

GPIO3_OR |= EN; // Set High as Enable

Delay(5);

GPIO3_OR &= ~EN; // Set Low as Enable

}

void GLCD_Data (char c)

{

if(c & 0x80) GPIO3_OR |= D7; else GPIO3_OR &= ~D7; // Set data for Data Line 7

if(c & 0x40) GPIO3_OR |= D6; else GPIO3_OR &= ~D6; // Set data for Data Line 6

if(c & 0x20) GPIO3_OR |= D5; else GPIO3_OR &= ~D5; // Set data for Data Line 5

if(c & 0x10) GPIO3_OR |= D4; else GPIO3_OR &= ~D4; // Set data for Data Line 4

if(c & 0x08) GPIO3_OR |= D3; else GPIO3_OR &= ~D3; // Set data for Data Line 3

 

if(c & 0x04) GPIO3_OR |= D2; else GPIO3_OR &= ~D2; // Set data for Data Line 2

if(c & 0x02) GPIO3_OR |= D1; else GPIO3_OR &= ~D1; // Set data for Data Line 1

if(c & 0x01) GPIO3_OR |= D0; else GPIO3_OR &= ~D0; // Set data for Data Line 0

 

GPIO3_OR |= RS; GPIO3_OR &= ~RW; // Set Low as RS and RW

GPIO3_OR |= EN; // Set High as Enable

Delay(5);

GPIO3_OR &= ~EN; // Set Low as Enable

}

void GLCD_Draw (char *Base)

{

int Page, Column;

for (Page = 0; Page < 8 ; Page++)

{

GLCD_Page(1);

GLCD_Cmd ((0xB8 | Page));

GLCD_Cmd (0x40);

for (Column = 0; Column < 128; Column++)

{

if (Column == 64)

{

GLCD_Page (0);

GLCD_Cmd ((0xB8 | Page));

GLCD_Cmd (0x40);

}

 

GLCD_Data (*Base++);

Delay(5);

}

}

}

void Delay(unsigned int n) // Delay function

{

unsigned int i,j;

for(i=0;i

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.