Jump to content

Recommended Posts

Hi!

I make a attempt to create a backslash in a CGRAM display but this not works, my code make use of display driver commands, how I can do this work?

thanks

lcd_funcmode();

lcd_write(0x40); // set 40

lcd_datamode();

lcd_write( 0x00 ); // 00000

lcd_write( 0X00 ); // 00000

lcd_write( 0X10 ); // 10000

lcd_write( 0X08 ); // 01000

lcd_write( 0X04 ); // 00100

lcd_write( 0X02 ); // 00010

lcd_write( 0X01 ); // 00001

lcd_write( 0X00 ); // 00000

lcd_datamode();

lcd_gotoxy(1,1);

lcd_write (0x00);

Link to post
Share on other sites
  • 2 months later...
Hi!

I make a attempt to create a backslash in a CGRAM display but this not works, my code make use of display driver commands, how I can do this work?

thanks

lcd_funcmode();

lcd_write(0x40); // set 40

lcd_datamode();

lcd_write( 0x00 ); // 00000

lcd_write( 0X00 ); // 00000

lcd_write( 0X10 ); // 10000

lcd_write( 0X08 ); // 01000

lcd_write( 0X04 ); // 00100

lcd_write( 0X02 ); // 00010

lcd_write( 0X01 ); // 00001

lcd_write( 0X00 ); // 00000

lcd_datamode();

lcd_gotoxy(1,1);

lcd_write (0x00);

 

Hi Doglao

 

I wrote this code and it's run very well.

 

The code is here:

 

lcd_clear();

lcd_funcmode();

lcd_write(set_dd_ram + 0x00);

lcd_funcmode();

lcd_write(cgramadd + 0x00 );

lcd_datamode();

lcd_write(00011111b);

lcd_funcmode();

lcd_write(cgramadd + 0x01 );

lcd_datamode();

lcd_write(00010000b);

lcd_funcmode();

lcd_write(cgramadd + 0x02 );

lcd_datamode();

lcd_write(00010000b);

lcd_funcmode();

lcd_write(cgramadd + 0x03 );

lcd_datamode();

lcd_write(00011111b);

lcd_funcmode();

lcd_write(cgramadd + 0x04 );

lcd_datamode();

lcd_write(00000101b);

lcd_funcmode();

lcd_write(cgramadd + 0x05 );

lcd_datamode();

lcd_write(00000101b);

lcd_funcmode();

lcd_write(cgramadd + 0x06 );

lcd_datamode();

lcd_write(00000101b);

lcd_funcmode();

lcd_write(cgramadd + 0x07 );

lcd_datamode();

lcd_write(00011111b);

 

For wite the new character e them for visual it i wrote :

 

lcd_clear();

lcd_datamode();

lcd_write(0x00);

 

and in the first character you see the new simbol

 

i hope that it can help you

 

Hi Masy

Link to post
Share on other sites
Hi!

I make a attempt to create a backslash in a CGRAM display but this not works, my code make use of display driver commands, how I can do this work?

thanks

Here are some functions that will be added to lcd_driver.h file in the future and a sample program that switches between two sets of user defineable characters, one stored in PIC RAM the other in PIC ROM. These functions may change before they finally get added to lcd_driver.h, but they do work as they are:

 

#include <system.h>

#pragma CLOCK_FREQ 40000000

#define LCD_ARGS  1, /* Interface type: mode 0 = 8bit, 1 = 4bit(low nibble), 2 = 4bit(upper nibble) */ \
 1,	 /* Use busy signal: 1 = use busy, 0 = use time delays */\
 PORTC, TRISC,  /* Data port and data port tris register */ \
 PORTB, TRISB,  /* Control port and control port tris register */ \
 5,	/* Bit number of control port is connected to RS */ \
 6,	/* Bit number of control port is connected to RW */ \
 7	 /* Bit number of control port is connected to Enable */
#include <lcd_driver.h>

void lcd_setcgram( const unsigned char *lcd_pattern, unsigned char firstChar, unsigned char numbChars )
{
unsigned char address;

firstChar <<= 3; // this value now becomes the offset to the last piece of data
numbChars <<= 3;   // this value now becomes the number of pieces of data left to transfer
address= 0x40;
address += firstChar; 
address += numbChars;

while( numbChars )
{
 address--;
 numbChars--;
 lcd_function( address );
 lcd_datamode();
 lcd_write( lcd_pattern[numbChars] );
}
}

void lcd_setcgram( rom unsigned char *lcd_pattern, unsigned char firstChar, unsigned char numbChars )
{
unsigned char address;

firstChar <<= 3; // this value now becomes the offset to the last piece of data
numbChars <<= 3;   // this value now becomes the number of pieces of data left to transfer
address= 0x40;
address += firstChar; 
address += numbChars;

while( numbChars )
{
 address--;
 numbChars--;
 lcd_function( address );
 lcd_datamode();
 lcd_write( lcd_pattern[numbChars] );
}
}


const unsigned char lcd_pattern[64]={0x00,0x00,0x1F,0x1F,0x0E,0x0E,0x04,0x00, // 0: ARROW DOWN
			  0x00,0x00,0x04,0x0E,0x0E,0x1F,0x1F,0x00, // 1: ARROW UP
		  0x00,0x0E,0x11,0x11,0x11,0x0E,0x00,0x00, // 2: EMPTY BALL
		 0x00,0x0E,0x1F,0x1F,0x1F,0x0E,0x00,0x00, // 3: FILLED BALL
		 0x1F,0x1F,0x00,0x00,0x11,0x11,0x1B,0x1F, // 4: REVERSED ARROW DOWN
		 0x1F,0x1F,0x1B,0x11,0x11,0x00,0x00,0x1F, // 5: REVERSED ARROW UP
		 0x10,0x18,0x1C,0x1E,0x1C,0x18,0x10,0x00, // 6: ARROW RIGHT
		 0x01,0x03,0x07,0x0F,0x07,0x03,0x01,0x00}; // 7: ARROW LEFT


rom unsigned char* rlcd_pattern={  0x00,0x00,0x1F,0x1F,0x0E,0x0E,0x04,0x1F, // 0: ARROW DOWN
	  0x00,0x00,0x04,0x0E,0x0E,0x1F,0x1F,0x1F, // 1: ARROW UP
		  0x00,0x0E,0x11,0x11,0x11,0x0E,0x00,0x1F, // 2: EMPTY BALL
		 0x00,0x0E,0x1F,0x1F,0x1F,0x0E,0x00,0x1F, // 3: FILLED BALL
		 0x1F,0x1F,0x00,0x00,0x11,0x11,0x1B,0x00, // 4: REVERSED ARROW DOWN
		 0x1F,0x1F,0x1B,0x11,0x11,0x00,0x00,0x00, // 5: REVERSED ARROW UP
		 0x10,0x18,0x1C,0x1E,0x1C,0x18,0x10,0x1F, // 6: ARROW RIGHT
		 0x01,0x03,0x07,0x0F,0x07,0x03,0x01,0x1F}; // 7: ARROW LEFT


void main()
{
lcd_setup();
lcd_clear();

lcd_gotoxy( 0, 0 );

{
 lprintf( "ABCDEF" );

 // display user definable characters
 lcd_write( 0x00 );
 lcd_write( 0x01 );
 lcd_write( 0x02 );
 lcd_write( 0x03 );
 lcd_write( 0x04 );
 lcd_write( 0x05 );
 lcd_write( 0x06 );
 lcd_write( 0x07 );
}

while( 1 )
{
 // switch between user definable character data from RAM and ROM
 delay_s( 1 );
 lcd_setcgram( lcd_pattern, 0, 8 );
 delay_s( 1 );
 lcd_setcgram( rlcd_pattern, 0, 8 );
}

}

Regards

Dave

Link to post
Share on other sites
Hi!

I make a attempt to create a backslash in a CGRAM display but this not works, my code make use of display driver commands, how I can do this work?

thanks

Here are some functions that will be added to lcd_driver.h file in the future and a sample program that switches between two sets of user defineable characters, one stored in PIC RAM the other in PIC ROM. These functions may change before they finally get added to lcd_driver.h, but they do work as they are:

 

#include <system.h>

#pragma CLOCK_FREQ 40000000

#define LCD_ARGS  1, /* Interface type: mode 0 = 8bit, 1 = 4bit(low nibble), 2 = 4bit(upper nibble) */ \
 1,	 /* Use busy signal: 1 = use busy, 0 = use time delays */\
 PORTC, TRISC,  /* Data port and data port tris register */ \
 PORTB, TRISB,  /* Control port and control port tris register */ \
 5,	/* Bit number of control port is connected to RS */ \
 6,	/* Bit number of control port is connected to RW */ \
 7	 /* Bit number of control port is connected to Enable */
#include <lcd_driver.h>

void lcd_setcgram( const unsigned char *lcd_pattern, unsigned char firstChar, unsigned char numbChars )
{
unsigned char address;

firstChar <<= 3; // this value now becomes the offset to the last piece of data
numbChars <<= 3;   // this value now becomes the number of pieces of data left to transfer
address= 0x40;
address += firstChar; 
address += numbChars;

while( numbChars )
{
 address--;
 numbChars--;
 lcd_function( address );
 lcd_datamode();
 lcd_write( lcd_pattern[numbChars] );
}
}

void lcd_setcgram( rom unsigned char *lcd_pattern, unsigned char firstChar, unsigned char numbChars )
{
unsigned char address;

firstChar <<= 3; // this value now becomes the offset to the last piece of data
numbChars <<= 3;   // this value now becomes the number of pieces of data left to transfer
address= 0x40;
address += firstChar; 
address += numbChars;

while( numbChars )
{
 address--;
 numbChars--;
 lcd_function( address );
 lcd_datamode();
 lcd_write( lcd_pattern[numbChars] );
}
}


const unsigned char lcd_pattern[64]={0x00,0x00,0x1F,0x1F,0x0E,0x0E,0x04,0x00, // 0: ARROW DOWN
			  0x00,0x00,0x04,0x0E,0x0E,0x1F,0x1F,0x00, // 1: ARROW UP
		  0x00,0x0E,0x11,0x11,0x11,0x0E,0x00,0x00, // 2: EMPTY BALL
		 0x00,0x0E,0x1F,0x1F,0x1F,0x0E,0x00,0x00, // 3: FILLED BALL
		 0x1F,0x1F,0x00,0x00,0x11,0x11,0x1B,0x1F, // 4: REVERSED ARROW DOWN
		 0x1F,0x1F,0x1B,0x11,0x11,0x00,0x00,0x1F, // 5: REVERSED ARROW UP
		 0x10,0x18,0x1C,0x1E,0x1C,0x18,0x10,0x00, // 6: ARROW RIGHT
		 0x01,0x03,0x07,0x0F,0x07,0x03,0x01,0x00}; // 7: ARROW LEFT


rom unsigned char* rlcd_pattern={  0x00,0x00,0x1F,0x1F,0x0E,0x0E,0x04,0x1F, // 0: ARROW DOWN
	  0x00,0x00,0x04,0x0E,0x0E,0x1F,0x1F,0x1F, // 1: ARROW UP
		  0x00,0x0E,0x11,0x11,0x11,0x0E,0x00,0x1F, // 2: EMPTY BALL
		 0x00,0x0E,0x1F,0x1F,0x1F,0x0E,0x00,0x1F, // 3: FILLED BALL
		 0x1F,0x1F,0x00,0x00,0x11,0x11,0x1B,0x00, // 4: REVERSED ARROW DOWN
		 0x1F,0x1F,0x1B,0x11,0x11,0x00,0x00,0x00, // 5: REVERSED ARROW UP
		 0x10,0x18,0x1C,0x1E,0x1C,0x18,0x10,0x1F, // 6: ARROW RIGHT
		 0x01,0x03,0x07,0x0F,0x07,0x03,0x01,0x1F}; // 7: ARROW LEFT


void main()
{
lcd_setup();
lcd_clear();

lcd_gotoxy( 0, 0 );

{
 lprintf( "ABCDEF" );

 // display user definable characters
 lcd_write( 0x00 );
 lcd_write( 0x01 );
 lcd_write( 0x02 );
 lcd_write( 0x03 );
 lcd_write( 0x04 );
 lcd_write( 0x05 );
 lcd_write( 0x06 );
 lcd_write( 0x07 );
}

while( 1 )
{
 // switch between user definable character data from RAM and ROM
 delay_s( 1 );
 lcd_setcgram( lcd_pattern, 0, 8 );
 delay_s( 1 );
 lcd_setcgram( rlcd_pattern, 0, 8 );
}

}

Regards

Dave

 

Sorry for I not reply before, I'm in a travel!!

Thanks for this reply, i'm going to prove and I post the results here, very thanks Masy and Dave

Link to post
Share on other sites
  • 1 year later...
i need help how can i drive this lcd here is the datasheet.it has just 4 wires, vcc,gnd,clk,dta..?
What display are you talking about exactly???

 

Regards

Dave

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...