Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Winstar GLCD display

Status
Not open for further replies.

hemnath

Advanced Member level 3
Advanced Member level 3
Joined
Jun 24, 2012
Messages
702
Helped
61
Reputation
120
Reaction score
57
Trophy points
1,308
Location
Chennai
Visit site
Activity points
6,589
Hi, I'm interfacing GLCD with PIC 18LF2520, Oscillator type: Internal 1Mhz, CCS c compiler, GLCD: Winstar WG12232A-YYH

I having difficult in initializing the Graphic lcd. It does not have Enable pin.

Does anyone have sample code?

Thanks in advance :)
 

Sample code: This code is not working. What could be the problem? any help will get appreciated
Code:
#include "18F2520.h"
#fuses INTRC_IO
#use delay(clock = 1000000)

#define A0	PIN_B3
#define CS1	PIN_B4
#define CS2	PIN_B5

#define   page1      0xb8
#define   page2      0xb9
#define   page3      0xba

void Write_command(unsigned int command);
void Write_data(unsigned int datap);
void write_address(unsigned int page, unsigned int segment);
void full_on();

void main()
{
	output_high(CS1);
	output_high(CS2);
	Write_command(0xe2);   //software Reset
	Write_command(0xa0);   //Select ADC = 0
	Write_command(0xa4);   //Static  Drive OFF
	Write_command(0xa9);   //Select Duty = 1 /32
	Write_command(0xc0);   //Set Start Line 0(C0H)~31(DFH)
	Write_command(0xb8);   //Set Page Address 0(B8H)~3(BBH)
	Write_command(0x00);   //Set segment Address 0(00H)~(4FH)
	Write_command(0xaf);   //Set Display ON

	while(1)
	{	
		full_on();
	}
}

void Write_command(unsigned int command)
{
	output_low(A0);                                //  A0 = 0 is write command
	output_a(command);

	output_low(CS1);
	output_high(CS1);

	output_low(CS2);
	output_high(CS2);
}

void Write_data(unsigned int datap)
{
	output_high(A0);                                //  A0 = 1 is write data
	output_a(datap);

	output_low(CS1);
	output_high(CS1);

	output_low(CS2);
	output_high(CS2);
}

void write_address(unsigned int page, unsigned int segment)
{
	output_high(CS1);
	output_high(CS2);
	Write_command(page);   //Set Page Address 0(B8H)~3(BBH)
	Write_command(segment);   //Set segment Address 0(00H)~(4FH)
}

void full_on()
{
	unsigned int x,y;
	write_address(page1,0x00);
	for(y=0;y<4;y++)
	{
		write_address(page1+y,0x00);
		for(x=0;x<61;x++)
		{
			output_low(CS1);
			output_high(CS2);
			Write_data(0xff);
		}
		for(x=0;x<61;x++)
		{
			output_high(CS1);
			output_low(CS2);
			Write_data(0xff);
		}
	}
}
 
Last edited by a moderator:

If possible, can you check my sample program. It is not working. does my glcd_cmd and glcd_data functions are correct??

- - - Updated - - -

Thanks for replying.
If CS1 and CS2 are enable pins. Do i have to do high to low transition to send the data?
 

Finally i got my lcd working. The problem was with the contrast pins.

I have displayed the character size of 8 x 8. But i want to display a character of 10 x 15. How can i do that? Please help. Is there any library?

HTML:
#include "18F2520.h"
#fuses INTRC_IO                 // Internal oscillator   
#use delay(clock = 1000000)      // 1Mhz clock

// PIN Definitions
#define A0       PIN_B3
#define CS1      PIN_B4
#define CS2      PIN_B5
#define R_W      PIN_C0
#define RST      PIN_C1

void GLCD_INIT();
void glcd_cmd(unsigned char c);
void glcd_data(unsigned char z);

const unsigned char data[]  = {0xFF, 0xFF, 0x18, 0x18, 0x18, 0x18, 0xFF, 0xFF};   

const unsigned char space[] = {0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00};

void main()
{
   unsigned int i,j,k;
   GLCD_INIT();

         k = 0;
   
      for(k = 0; k < 4; k++)
      {
         glcd_cmd(0xB8 + k);
      
         for(j = 0; j < 64; j = j+8)
         {
            glcd_cmd(0 + j);
            
            for(i = 0; i < 8; i++)   
            {
               glcd_data(space[i]);
            }
         }
      }

   while(1)
   { 
      glcd_cmd(0xc0);
      glcd_cmd(0xb8); 
      glcd_cmd(0);
      
      i = 0;
      
      for (i = 0; i < 8; i++)
      {
         glcd_data1(data[i]);
      }
   }   
}

void GLCD_INIT()
{
   output_high(RST);     // RESET = 1

   glcd_cmd(0xe2);   //software Reset
   glcd_cmd(0xa0);   //Select ADC = 0
   glcd_cmd(0xa4);   //Static  Drive OFF
   glcd_cmd(0xa9);   //Select Duty = 1 /32
   glcd_cmd(0xc0);   //Set Start Line 0(C0H)~31(DFH)
   glcd_cmd(0xb8);   //Set Page Address 0(B8H)~3(BBH)
   glcd_cmd(0x00);   //Set segment Address 0(00H)~(4FH)
   glcd_cmd(0xaf);   //Set Display ON
}

void glcd_cmd(unsigned char c)
{
   output_low(A0);
   output_low(R_W);
   output_a(c);

   output_high(CS1);
   output_high(CS2);

   output_low(CS1);
   output_low(CS2);
}

void glcd_data(unsigned char z)
{
   output_high(A0);
   output_low(R_W);
   output_a(z);

   output_high(CS1);
   output_high(CS2);

   output_low(CS1);
   output_low(CS2);
}
 

how to change font size? One page contains 8 bits. how it will get auto incremented to next page when one page value gets overflowed.
do u have any sample program?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top