Alphanumeric LCD


Alphanumeric LCD example. This can be used with LCD242-BK and many other LCD's. LCD contrast can be adjusted in software using PWM on MINI-MAX/ARM boards. This example uses lcd_iprintf() and other built-in LCD functions from BiPOM Library.

Toolkit:ARM Development System

Location:/bipom/devtools/GCC/LPC2000/examples/lcd

Code Example


int main (void)
{
	ERRCODE ec;
	UINT pwm;

	/* Initialize the system */
	Initialize();

	/* Send messages to TERMINAL window */
	tiprintf("\n\rBIPOM MINI-MAX/ARM");
	tiprintf("\n\rLCD TEST ");

	/* Set LCD contrast using Pulse Width Modulated analog output */
	ec = WritePWM(0);
	
	if(ec) 
		tprintf( "\n\rERROR: Can't adjust LCD contrast,ec =%d", ec );
		
	/* Initialize 4-bit LCD interface */
	InitializeLCD();	
	
	/* Disable cursor */
	CursorOffLCD();	
	
	/* Put the message to TOP line of LCD */	
	SetTopLineLCD();
	lcd_iprintf("  BIPOM MINI-MAX/ARM");
	
	/* Put the message to BOTTOM line of LCD */	
	SetBottomLineLCD();
	lcd_iprintf("      LCD TEST");
	
	/* Wait for 5 seconds */
	delayMs(5000);
	
	/* Clear display */
	ClearLCD();
	
	/* As a test, continuously change LCD contrast */
	for (;;)
	{
		for( pwm = 0; pwm < 180; pwm += 20 )
		{
			ec = WritePWM(pwm);
			
			if(ec) 
				tprintf("\n\rERROR: Can't adjust LCD contrast,ec =%d",ec);
			
			SetTopLineLCD();
			lcd_iprintf("   LCD CONTRAST TEST");
			
			SetBottomLineLCD();
			lcd_iprintf("   CONTRAST  = %5d",pwm);
			
			/* Wait for 3 seconds  */
			delayMs(3000);	
		}
	}
}