GLCD (Graphical Liquid Crystal Display) interfacing with LPC2148
GLCD signals:
- It has 8 data lines.
- RS: It is register select , if RS='1' then Data register , if RS=0 then command register.
- E:Latches information presented to its.
- CS1 & CS2: Chip select signal.
- Reset: LCD reset signal.
Structure of GLCD:
LCD initialization |
- CS1=1 & CS2=1 (Activate both half display)
- RS=0 & RW=0 (Select command mode)
- E=1
- Delay
- E=0
Page Selection:
In GLCD there are total 8 pages available, which can be selected using X address. 2^3=8.
Page selection |
000 = Page 0 (Address = 0xB8)
001 = Page 1 (Address = 0xB9)
010 = Page 2 (Address = 0xBA)
011 = Page 3 (Address = 0xBB)
100 = Page 4 (Address = 0xBC)
101 = Page 5 (Address = 0xBD)
110 = Page 6 (Address = 0xBE)
111 = Page 7 (Address = 0xBF)
column selection:
Total 128 column is available in GLCD which is divided into two parts.
.
0 to 63 column is selected using Y address , i.e D0 to D5 and remaining bits remain as it is.
Column selection |
If CS1=1 & CS2=0 then 0 to 63 column is selected and CS1=0 & CS2=1 then 64 to 127 column is selected.
Y6 - Y1 : Column Selection
000000 = Column 0 (Address = 0x40)
000001 = Column 1 (Address = 0x41)
000010 = Column 2 (Address = 0x42)
...
...
111111 = Column 63 (Address = 0x7F)
Circuit diagram:
1) Line display:
GLCD INTERFACING WITH LPC2148 |
2) Image display:
GLCD INTERFACING WITH LPC2148 |
Algorithm:
- Start
- Initially define hardware of interfacing Diagram
- Initialize GLCD by selecting functions of LPC2148 pins as GPIO, Set direction of pins as an output pins, Send Commands to GLCD to Turn on both halves of GLCD
- Call function glcd_clr(). If column no. is <64 Turn on left half of display using CS1=1 , CS2=0 else turn on Right half display using CS1=0, CS2=1.Send Commands to GLCD through command function
- GLCD Command function:- Clear command value available on data pins first ,shift the command value by 16 bits to left side to get available on P0.16 to P0.23 , Make RS pin=0, RW pin=0, High to low pulse on Enable pin
- GLCD Data function :- Clear data available on data pins first ,shift the data by 16 bits to left side to get available on P0.16 to P0.23 , Make RS pin=1, RW pin=0, High to low pulse on Enable pin
- Pass the array of of hex value x[ ] to data function
- End
Code:
1)Interfacing GLCD with LPC2148 to display line on screen
/**********************************************
Platform: LPC2148 Development Board.
College: PICT
Hardware Setup:-
LCD data pin :-P0.16-P0.23
RS - P1.16
RW - P1.17
EN - P1.18
CS1 - P1.19
CS2 - P1.20
RST - P1.21
************************************************/
# include<lpc214x.h>
# define GLCD_CS1_SET IOSET1= 1<<19
# define GLCD_CS2_SET IOSET1= 1<<20
# define GLCD_RST_SET IOSET1= 1<<21
# define GLCD_CS1_CLR IOCLR1= 1<<19
# define GLCD_CS2_CLR IOCLR1= 1<<20
# define GLCD_RST_CLR IOCLR1= 1<<21
# define RS_CMD IOCLR1= 1<<16
# define RS_DATA IOSET1= 1<<16
# define write IOCLR1= 1<<17
# define en_high IOSET1= 1<<18
# define en_low IOCLR1= 1<<18
void ms_delay(unsigned char t) //delay function definition
{
int i, j;
for(i=0;i<t;i++)
{
for(j=0;j<8002;j++);
}
}
void GLCD_CMD( unsigned char cmd) // command function definition RS=0,RW=0,E= 1 to 0
{
RS_CMD;
write;
IOCLR0=0x00FF0000;
IOSET0=(cmd<<16);
en_high;
ms_delay(1);
en_low;
}
void GLCD_INIT()
{
GLCD_RST_SET; // RST is active low signal
GLCD_CS1_SET;
GLCD_CS2_SET;
GLCD_CMD(0x3F); // GLCD display on
GLCD_CMD(0xB8); // Page 0 address initialization
GLCD_CMD(0x40); // Column 0 address initialization
}
void PAGE_COL_SEL( unsigned char pag,unsigned char col)
{
if(col<64)
{
GLCD_CS1_SET; // Select First half part display
GLCD_CS2_CLR;
GLCD_CMD(0x40|col); // Generate column address
GLCD_CMD(0xB8|pag); // Generate page address
}
else
{
GLCD_CS1_CLR; // Select Second half part display
GLCD_CS2_SET;
GLCD_CMD(0x40|(col-64));
GLCD_CMD(0xB8|pag);
}
}
void GLCD_DATA( unsigned char data) // Data function definition RS=1, RW=0, E=1 to 0
{
IOCLR0=0x00ff0000;
RS_DATA;
write;
IOSET0=data<<16;
en_high;
ms_delay(1);
en_low;
}
void glcd_clr()
{ int i,j;
for (i=0;i<128;i++) // loop for column selection
{
for (j=0;j<8;j++) // loop for page selection
{
PAGE_COL_SEL(j,i); // pass page and column value
GLCD_DATA(0x00);
}
}
}
int main()
{
int i,j;
PINSEL1= 0x00000000;
PINSEL2= 0x00000000;
IODIR0= 0xFF<<16; // Set pin P0.16 to P0.23 as a output
IODIR1= 0XFF<<16; // Set pin P1.16 to P1.23 as a output
GLCD_INIT();
glcd_clr();
for (j=0;j<2;j++)
{
for(i=0;i<128;i++)
{
PAGE_COL_SEL(j,i);
{
GLCD_DATA(0x0f);
}
}
}
}
/**********************************************Platform: LPC2148 Development Board. College: PICT Hardware Setup:- LCD data pin :-P0.16-P0.23 RS - P1.16 RW - P1.17 EN - P1.18 CS1 - P1.19 CS2 - P1.20 RST - P1.21************************************************/
# include<lpc214x.h> # define GLCD_CS1_SET IOSET1= 1<<19 # define GLCD_CS2_SET IOSET1= 1<<20 # define GLCD_RST_SET IOSET1= 1<<21 # define GLCD_CS1_CLR IOCLR1= 1<<19 # define GLCD_CS2_CLR IOCLR1= 1<<20 # define GLCD_RST_CLR IOCLR1= 1<<21 # define RS_CMD IOCLR1= 1<<16 # define RS_DATA IOSET1= 1<<16 # define write IOCLR1= 1<<17 # define en_high IOSET1= 1<<18 # define en_low IOCLR1= 1<<18 void ms_delay(unsigned char t) //delay function definition { int i, j; for(i=0;i<t;i++) { for(j=0;j<8002;j++); } } void GLCD_CMD( unsigned char cmd) // command function definition RS=0,RW=0,E= 1 to 0 { RS_CMD; write; IOCLR0=0x00FF0000; IOSET0=(cmd<<16); en_high; ms_delay(1); en_low; } void GLCD_INIT() { GLCD_RST_SET; // RST is active low signal GLCD_CS1_SET; GLCD_CS2_SET; GLCD_CMD(0x3F); // GLCD display on GLCD_CMD(0xB8); // Page 0 address initialization GLCD_CMD(0x40); // Column 0 address initialization } void PAGE_COL_SEL( unsigned char pag,unsigned char col) { if(col<64) { GLCD_CS1_SET; // Select First half part display GLCD_CS2_CLR; GLCD_CMD(0x40|col); // Generate column address GLCD_CMD(0xB8|pag); // Generate page address } else { GLCD_CS1_CLR; // Select Second half part display GLCD_CS2_SET; GLCD_CMD(0x40|(col-64)); GLCD_CMD(0xB8|pag); } } void GLCD_DATA( unsigned char data) // Data function definition RS=1, RW=0, E=1 to 0 { IOCLR0=0x00ff0000; RS_DATA; write; IOSET0=data<<16; en_high; ms_delay(1); en_low; } void glcd_clr() { int i,j; for (i=0;i<128;i++) // loop for column selection { for (j=0;j<8;j++) // loop for page selection { PAGE_COL_SEL(j,i); // pass page and column value GLCD_DATA(0x00); } } } int main() { int i,j; PINSEL1= 0x00000000; PINSEL2= 0x00000000; IODIR0= 0xFF<<16; // Set pin P0.16 to P0.23 as a output IODIR1= 0XFF<<16; // Set pin P1.16 to P1.23 as a output GLCD_INIT(); glcd_clr(); for (j=0;j<2;j++) { for(i=0;i<128;i++) { PAGE_COL_SEL(j,i); { GLCD_DATA(0x0f); } } } }
1*)Interfacing GLCD with LPC2148 to display line on screen
/*********************************************************
Hardware Setup:-
LCD data pin :-P0.16-P0.23
RS - P1.16
RW - P1.17
EN - P1.18
CS1 - P1.19
CS2 - P1.20
RST - P1.21
********************************************************************************/
//Include Controller specific header file
#include <lpc214x.h>
#include "image.h"
//Define Macro Functions
#define GLCD_CS1_SET() IOSET1=1<<19;
#define GLCD_CS2_SET() IOSET1=1<<20;
#define GLCD_RST_SET() IOSET1=1<<21;
#define GLCD_CS1_CLR() IOCLR1=1<<19;
#define GLCD_CS2_CLR() IOCLR1=1<<20;
#define GLCD_RST_CLR() IOCLR1=1<<21;
unsigned char c=0;
//Function to generate software delay
//Calibrated to 1ms
void delay_ms(unsigned int time)
{
unsigned int i, j;
for (j=0; j<time; j++)
for(i=0; i<8002; i++);
}
void GLCD_command(unsigned char command)
{
IOCLR0 = 0xFF<<16; // Clear LCD Data lines
IOCLR1=1<<16; // RS=0 for command
IOCLR1=1<<17; // RW=0 for write
IOSET0=command<<16; // put command on data line
IOSET1=(1<<18); // en=1
delay_ms(1) ; // delay
IOCLR1=(1<<18); // en=0
}
void GLCD_data(unsigned char data)
{
IOCLR0 = 0xFF<<16; // Clear LCD Data lines
IOSET1=1<<16; // RS=1 for data
IOCLR1=1<<17; // RW=0 for write
IOSET0= data<<16; // put command on data line
IOSET1=(1<<18); //en=1
delay_ms(1) ; //delay
IOCLR1=(1<<18); //en=0
}
void GLCD_init()
{
GLCD_RST_SET(); //Set the Reset Pin
GLCD_CS1_SET(); //Select Chip1
GLCD_CS2_SET(); //Select Chip2
GLCD_command(0x3F); //GLCD_Display_ON_Command
delay_ms(10) ; //Delay
GLCD_command(0xB8); //Set Page Address to 0
delay_ms(10) ; //Delay
GLCD_command(0x40); //Set Coloumn Address to 0
delay_ms(10) ; //Delay
}
void GLCD_setpage(unsigned char page)
{
GLCD_CS1_SET(); //Select Chip1
GLCD_CS2_SET(); //Select Chip2
GLCD_command(0xB8|page); //GLCD_pageset_Command
delay_ms(10) ; //Delay
}
void GLCD_setcolumn(unsigned char column)
{
if(column<64)
{
c=column;
GLCD_CS1_SET(); //Select Chip1
GLCD_CS2_CLR(); //Select Chip2
GLCD_command(0x40|column); //GLCD_columnset_Command
delay_ms(10);
}
else
{
c=column;
GLCD_CS1_CLR(); //Select Chip1
GLCD_CS2_SET(); //Select Chip2
GLCD_command(0x40|column-64);
delay_ms(10);
}
}
void GLCD_Clear_Display()
{
int i,j;
for(i=0;i<8;i++)
{
GLCD_setpage(i);
GLCD_setcolumn(0);
for(j=0;j<64;j++) //Send data to first half
GLCD_data(0x01);
GLCD_setcolumn(64);
for(j=0;j<64;j++) //Send data to second half
GLCD_data(0x01);
}
}
int main(void)
{
//PINSEL1 = 0x00; //Configure PORT0 as GPIO
//PINSEL2 = 0X00; //Configure PORT1 as GPIO
IODIR1= 0xFF<<16; //Configure P1.23 - P1.16 as output
IODIR0= 0xFF<<16; //Configure P0.23 - P0.16 as output
GLCD_init(); //Initialize GLCD 128x64
GLCD_Clear_Display();
delay_ms(500);
while(1);
}
/********************************************************* Hardware Setup:- LCD data pin :-P0.16-P0.23 RS - P1.16 RW - P1.17 EN - P1.18 CS1 - P1.19 CS2 - P1.20 RST - P1.21 ********************************************************************************/ //Include Controller specific header file #include <lpc214x.h> #include "image.h" //Define Macro Functions #define GLCD_CS1_SET() IOSET1=1<<19; #define GLCD_CS2_SET() IOSET1=1<<20; #define GLCD_RST_SET() IOSET1=1<<21; #define GLCD_CS1_CLR() IOCLR1=1<<19; #define GLCD_CS2_CLR() IOCLR1=1<<20; #define GLCD_RST_CLR() IOCLR1=1<<21; unsigned char c=0; //Function to generate software delay //Calibrated to 1ms void delay_ms(unsigned int time) { unsigned int i, j; for (j=0; j<time; j++) for(i=0; i<8002; i++); } void GLCD_command(unsigned char command) { IOCLR0 = 0xFF<<16; // Clear LCD Data lines IOCLR1=1<<16; // RS=0 for command IOCLR1=1<<17; // RW=0 for write IOSET0=command<<16; // put command on data line IOSET1=(1<<18); // en=1 delay_ms(1) ; // delay IOCLR1=(1<<18); // en=0 } void GLCD_data(unsigned char data) { IOCLR0 = 0xFF<<16; // Clear LCD Data lines IOSET1=1<<16; // RS=1 for data IOCLR1=1<<17; // RW=0 for write IOSET0= data<<16; // put command on data line IOSET1=(1<<18); //en=1 delay_ms(1) ; //delay IOCLR1=(1<<18); //en=0 } void GLCD_init() { GLCD_RST_SET(); //Set the Reset Pin GLCD_CS1_SET(); //Select Chip1 GLCD_CS2_SET(); //Select Chip2 GLCD_command(0x3F); //GLCD_Display_ON_Command delay_ms(10) ; //Delay GLCD_command(0xB8); //Set Page Address to 0 delay_ms(10) ; //Delay GLCD_command(0x40); //Set Coloumn Address to 0 delay_ms(10) ; //Delay } void GLCD_setpage(unsigned char page) { GLCD_CS1_SET(); //Select Chip1 GLCD_CS2_SET(); //Select Chip2 GLCD_command(0xB8|page); //GLCD_pageset_Command delay_ms(10) ; //Delay } void GLCD_setcolumn(unsigned char column) { if(column<64) { c=column; GLCD_CS1_SET(); //Select Chip1 GLCD_CS2_CLR(); //Select Chip2 GLCD_command(0x40|column); //GLCD_columnset_Command delay_ms(10); } else { c=column; GLCD_CS1_CLR(); //Select Chip1 GLCD_CS2_SET(); //Select Chip2 GLCD_command(0x40|column-64); delay_ms(10); } } void GLCD_Clear_Display() { int i,j; for(i=0;i<8;i++) { GLCD_setpage(i); GLCD_setcolumn(0); for(j=0;j<64;j++) //Send data to first half GLCD_data(0x01); GLCD_setcolumn(64); for(j=0;j<64;j++) //Send data to second half GLCD_data(0x01); } } int main(void) { //PINSEL1 = 0x00; //Configure PORT0 as GPIO //PINSEL2 = 0X00; //Configure PORT1 as GPIO IODIR1= 0xFF<<16; //Configure P1.23 - P1.16 as output IODIR0= 0xFF<<16; //Configure P0.23 - P0.16 as output GLCD_init(); //Initialize GLCD 128x64 GLCD_Clear_Display(); delay_ms(500); while(1); }
3)Interfacing GLCD with LPC2148 to display image on screen
/**************************************************************************************************
Expt. 3b.: Interfacing GLCD to LPC2148 to display image on screen
Platform: LPC2148 Development Board.
College: PICT
Hardware Setup:-
LCD data pin :-P0.16-P0.23
RS - P1.16
RW - P1.17
EN - P1.18
CS1 - P1.19
CS2 - P1.20
RST - P1.21
********************************************************************************/
/**************************************************************************************************
# include<lpc214x.h>
# define GLCD_CS1_SET IOSET1= 1<<19
# define GLCD_CS2_SET IOSET1= 1<<20
# define GLCD_RST_SET IOSET1= 1<<21
# define GLCD_CS1_CLR IOCLR1= 1<<19
# define GLCD_CS2_CLR IOCLR1= 1<<20
# define GLCD_RST_CLR IOCLR1= 1<<21
# define RS_CMD IOCLR1= 1<<16
# define RS_DATA IOSET1= 1<<16
# define write IOCLR1= 1<<17
# define en_high IOSET1= 1<<18
# define en_low IOCLR1= 1<<18
void ms_delay(unsigned char t)
{
int i, j;
for(i=0;i<t;i++)
{
for(j=0;j<8002;j++);
}
}
void GLCD_CMD( unsigned char cmd)
{
RS_CMD;
write;
IOCLR0=0x00FF0000;
IOSET0=(cmd<<16);
en_high;
ms_delay(1);
en_low;
}
void GLCD_INIT()
{
GLCD_RST_SET;
GLCD_CS1_SET;
GLCD_CS2_SET;
GLCD_CMD(0x3F);
GLCD_CMD(0xB8);
GLCD_CMD(0x40);
}
void PAGE_COL_SEL( unsigned char pag,unsigned char col)
{
if(col<64)
{
GLCD_CS1_SET;
GLCD_CS2_CLR;
GLCD_CMD(0x40|col);
GLCD_CMD(0xB8|pag);
}
else
{
GLCD_CS1_CLR;
GLCD_CS2_SET;
GLCD_CMD(0x40|(col-64));
GLCD_CMD(0xB8|pag);
}
}
void GLCD_DATA( unsigned char data)
{
RS_DATA;
write;
IOCLR0=0x00ff0000;
IOSET0=data<<16;
en_high;
ms_delay(1);
en_low;
}
void glcd_clr()
{ int i,j;
for (i=0;i<8;i++)
{
for (j=0;j<127;j++)
{
PAGE_COL_SEL(i,j);
GLCD_DATA(0x00);
}
}
}
int main()
{
int i,j,k=0;
unsigned char x[]={ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xE0,0xF0,0xFC,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0xF0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2F,0xFF,0xFF,0xDF,0xFF,0xF7,0xFB,0xFB,0xFB,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x6F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x07,0x0F,0x3D,0xD1,0xC3,0xE7,0xEF,0xFF,0xFF,0xFF,0xFF,0xFF,0x6F,0x73,0x78,0xFF,0xF7,0xFF,0x7F,0x3F,0xBE,0xBA,0x3F,0x7B,0xDB,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xF0,0xF0,0xE0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x0F,0x1F,0x3F,0x67,0x21,0x0F,0x3E,0x3F,0x3F,0x3F,0x1F,0x3F,0x1F,0x0F,0x0F,0x0F,0x0F,0x07,0x03,0x00,0x00,0x83,0x0F,0x07,0x1F,0x07,0x00,0x00,0x00,0x70,0x98,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00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
for(j=0;j<128;j++)
{
PAGE_COL_SEL(i,j);
{
GLCD_DATA(x[k]);
k=k+1;
}
}
}
}
/************************************************************************************************** Expt. 3b.: Interfacing GLCD to LPC2148 to display image on screen Platform: LPC2148 Development Board. College: PICT Hardware Setup:- LCD data pin :-P0.16-P0.23 RS - P1.16 RW - P1.17 EN - P1.18 CS1 - P1.19 CS2 - P1.20 RST - P1.21 ********************************************************************************/
/************************************************************************************************** # include<lpc214x.h> # define GLCD_CS1_SET IOSET1= 1<<19 # define GLCD_CS2_SET IOSET1= 1<<20 # define GLCD_RST_SET IOSET1= 1<<21 # define GLCD_CS1_CLR IOCLR1= 1<<19 # define GLCD_CS2_CLR IOCLR1= 1<<20 # define GLCD_RST_CLR IOCLR1= 1<<21 # define RS_CMD IOCLR1= 1<<16 # define RS_DATA IOSET1= 1<<16 # define write IOCLR1= 1<<17 # define en_high IOSET1= 1<<18 # define en_low IOCLR1= 1<<18 void ms_delay(unsigned char t) { int i, j; for(i=0;i<t;i++) { for(j=0;j<8002;j++); } } void GLCD_CMD( unsigned char cmd) { RS_CMD; write; IOCLR0=0x00FF0000; IOSET0=(cmd<<16); en_high; ms_delay(1); en_low; } void GLCD_INIT() { GLCD_RST_SET; GLCD_CS1_SET; GLCD_CS2_SET; GLCD_CMD(0x3F); GLCD_CMD(0xB8); GLCD_CMD(0x40); } void PAGE_COL_SEL( unsigned char pag,unsigned char col) { if(col<64) { GLCD_CS1_SET; GLCD_CS2_CLR; GLCD_CMD(0x40|col); GLCD_CMD(0xB8|pag); } else { GLCD_CS1_CLR; GLCD_CS2_SET; GLCD_CMD(0x40|(col-64)); GLCD_CMD(0xB8|pag); } } void GLCD_DATA( unsigned char data) { RS_DATA; write; IOCLR0=0x00ff0000; IOSET0=data<<16; en_high; ms_delay(1); en_low; } void glcd_clr() { int i,j; for (i=0;i<8;i++) { for (j=0;j<127;j++) { PAGE_COL_SEL(i,j); GLCD_DATA(0x00); } } } int main() { int i,j,k=0; unsigned char x[]={ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xE0,0xF0,0xFC,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0xF0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2F,0xFF,0xFF,0xDF,0xFF,0xF7,0xFB,0xFB,0xFB,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x6F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x07,0x0F,0x3D,0xD1,0xC3,0xE7,0xEF,0xFF,0xFF,0xFF,0xFF,0xFF,0x6F,0x73,0x78,0xFF,0xF7,0xFF,0x7F,0x3F,0xBE,0xBA,0x3F,0x7B,0xDB,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xF0,0xF0,0xE0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x0F,0x1F,0x3F,0x67,0x21,0x0F,0x3E,0x3F,0x3F,0x3F,0x1F,0x3F,0x1F,0x0F,0x0F,0x0F,0x0F,0x07,0x03,0x00,0x00,0x83,0x0F,0x07,0x1F,0x07,0x00,0x00,0x00,0x70,0x98,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x77,0xFF,0x77,0x3F,0xFF,0xBF,0x7F,0xBF,0x3F,0xFF,0xBF,0xFF,0x5F,0xFF,0xFF,0x77,0xCF,0xBF,0xFB, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x00,0x18,0x3C,0x7E,0xFC,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0x38,0x1C,0x0C,0x06,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0xC0,0xE0,0xF8,0xFE,0xFF,0xFF,0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xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xF8,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0x07,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; PINSEL1= 0x00000000; PINSEL2= 0x00000000; IODIR1= 0X00FF0000; IODIR0= 0X00FF0000; GLCD_INIT(); glcd_clr(); for (i=0;i<8;i++) { for(j=0;j<128;j++) { PAGE_COL_SEL(i,j); { GLCD_DATA(x[k]); k=k+1; } } } }
No comments:
Post a Comment