Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/26/06 06:26
Read: times


 
#126999 - scrolling graphic LCD using matrix keypad
Dear pals,

I’m using the 128x64 graphic LCD using KS0108 controller.
http://www.8052.com/forum/read.phtml?id=90456 by Michael Karas

The explanation of the methods regarding scrolling, in the above mentioned link is very much informative. Here, I’m using the normal method (using the display start line register) for scrolling the screen.
The LCD screen is divided into 8 pages; eight lines can be viewed physically at a time. I’ve to implement a menu based system. Below is the code, where I’m displaying a menu having 16 statements. Based on the explanation, I’ve written the below code.


unsigned char *smt1 ="1.rotor rpm";	//example statements to be displayed 
unsigned char *smt2 ="2.generator rpm";
unsigned char *smt3 ="3.running g1";
unsigned char *smt4 = "4.gear oil motor on;
unsigned char *smt5 = "5.hydrulic pressure high";
unsigned char *smt6 = "6.manual yaw clockwise";
unsigned char *smt7 = "7.manual yaw counterclockwise";
unsigned char *smt8 = "8.auto yaw clockwise";
unsigned char *smt9 = "9.auto yaw counter clockwise";
unsigned char *smt10 = "10.start";
unsigned char *smt11 = "11.stop";
unsigned char *smt12 = "12.reset";
unsigned char *smt13 = "13.hyd pump error";
unsigned char *smt14 = "14.brake error";
unsigned char *smt15 = "15.brake solenoid";
unsigned char *smt16 = "16.running g2";

int screen=1;	//screen=1à menu screen
		//screen=0à number screen

void program(void)
{
	lcd_writecommand(SET_RAM_0);
	lcd_clrscr();
	screen=0;		//To enter digit password

	password_status=enterpassword(menu2.password);

	if(password_status)	//true, for correct password
	{
	screen=1;		//menu screen
	lcd_clrscr();
	lcd_gotoxy(0,0);

		lcd(smt1);		//first eight statments
		lcd_putc('\n');		
		lcd(smt2);
		lcd_putc('\n');		//’/n’ - calling the newline() function
		lcd(smt3);
		lcd_putc('\n');
		lcd(smt4);
		lcd_putc('\n');
		lcd(smt5);
		lcd_putc('\n');
		lcd(smt6);
		lcd_putc('\n');
		lcd(smt7);
		lcd_putc('\n');
		lcd(smt8);

		lcd(smt9);		//second eight statements
		lcd_putc('\n');
		lcd(smt10);
		lcd_putc('\n');
		lcd(smt11);
		lcd_putc('\n');
		lcd(smt12);
		lcd_putc('\n');
		lcd(smt13);
		lcd_putc('\n');
		lcd(smt14);
		lcd_putc('\n');
		lcd(smt15);
		lcd_putc('\n');
		lcd(smt16);

	}

void func_key(char Newkey,int screen)
{
	char key;
	key=Newkey;		//’Newkey’ is the detected key

	if(screen==0)	//number keys			
	{
		switch(key)
		{
		case 0:lcd_putc(0x30);		//'0'
			break;
		case 1:lcd_putc(0x31);		//'1'
			 break;
		case 2:lcd_putc(0x32);		//'2'
			 break;
		case 3:lcd_putc(0x33);		//'3'
			 break;
		case 4:lcd_putc(0x34);		//'4'
			 break;
		case 5:lcd_putc(0x35);		//'5'
			 break;
		case 6:lcd_putc(0x36);		//'6'
			 break;
		case 7:lcd_putc(0x37);		//'7'
			break;
		case 8:lcd_putc(0x38);		//'8'
			break;
		case 9:lcd_putc(0x39);		//'9'
			break;
		case 10:up_key();		//'up'
			break;
		case 11:right_key();		//'->'
			break;
		case 12:down_key();		//'down'
			break;
		case 13:left_key();		//'<-'
			break;
		}
    }
	else					//menu function keys	
	{
		switch(key)
		{
		case 2:	program();
			break;
		case 10:lcd_scroll_up();	//scroll up
			break;
		case 12:lcd_scroll_down();	//scroll down
			break;
		case 14:menu();			//'Menu'
			 break;
		case 15:enter();		//'enter'
			 break;	
		}
	}
}

void lcd_scroll_down(void)
{
	SetStartLine(line_num+8);
	return;
}

void lcd_scroll_up(void)
{
	SetStartLine(line_num-8);
	return;
}

void SetStartLine(unsigned char line)	//Display start line setting function
{
	lcd_writecommand(SET_RAM_0 | (line & 63));
	return;
}

Initially I included the first eight statements alone in the code. When the up/down key is pressed, the statement in the first line gets shifted to last line in the display.
Also, when I included all the 16 statements in the program() function, the second set of eight gets displayed in a single last line itself and for up/down key press, the statement in last line gets shifted.
Please tell how to display the 16 statements using the scroll up/down keys.

waiting for your reply,

regards,
veena.

List of 18 messages in thread
TopicAuthorDate
scrolling graphic LCD using matrix keypad            01/01/70 00:00      
   Use array of strings            01/01/70 00:00      
   Maybe try something different            01/01/70 00:00      
   scrolling function....            01/01/70 00:00      
      Table            01/01/70 00:00      
      XDATA?            01/01/70 00:00      
   the reason is...            01/01/70 00:00      
   scrolling display using key...            01/01/70 00:00      
      How do you want to scroll?            01/01/70 00:00      
      Do as Michael said?            01/01/70 00:00      
      "display start line command" is not the way            01/01/70 00:00      
         Why not?            01/01/70 00:00      
            Re: Why not?            01/01/70 00:00      
   scrolling can be done as...            01/01/70 00:00      
      Re: scrolling can be done as...            01/01/70 00:00      
   I wonder            01/01/70 00:00      
      Scrolling            01/01/70 00:00      
         ah            01/01/70 00:00      

Back to Subject List