CART
  • Cart is empty.

    ItemQuantityPrice

    Total: $0

LCD test


Print text on LCD with different contrast changed over time.

Toolkit:STM Development System

Location:/bipom/devtools/STM32/examples/lcd

Code Example


/*******************************************************************************
;
;	DelayLCD is a call-back function from LCD driver.
;	It has to provide  the necessary delay in ms.
;	If user application is based on FreeRTOS it is necessary
;	to use vTaskDelay.
;	If user application is stand-alone it is necessary
;	to use delayMs.
*******************************************************************************/
void DelayLCD(int ms) {
	vTaskDelay(ms);
}

//********************************************************************************

static void vLCDTEST( void *pvParameters ) {
	char line[32] = {0};
	int contrast = 100;
	(void) pvParameters;
	//

	// Adjust contrast

	AdjustContrastLCD(contrast);
	// Initialize LCD 

	InitializeLCD();
	// Clear display

	CursorOffLCD();
	ClearLCD();
	strcpy(line, "Mini-Max/STM32-F1");
	SetTopLineLCD();
	printf_LCD(line,1);
	//

	strcpy(line, "FreeRTOS LCD TEST");
	SetBottomLineLCD();
	printf_LCD(line,2);
	vTaskDelay(3000);
	ClearLCD();
	while(1) {
		AdjustContrastLCD(contrast);
		//

		strcpy(line, "Mini-Max/STM32-F1");
		SetTopLineLCD();
		printf_LCD(line,1);
		//

		bipom_sprintf(line, "LCD contrast:%03d", contrast);
		SetBottomLineLCD();
		printf_LCD(line,1);
		WriteDataLCD('%');
		//

		vTaskDelay(1000);
		//

		if( contrast )	contrast -= 10;
		else			contrast =	100;	
  	}
}

//********************************************************************************

int main(void) 
{
	/* Initialize all port pins */
	DIO_Init();
	delayMs(250);
	//

	tprintf("\n\rMini-Max/STM32F1");
	tprintf("\n\rLCD TEST REV 1.01");
	//

	if(pdPASS != 
		xTaskCreate (vLCDTEST, ( const signed portCHAR * const )"LCDTEST", 
			configMINIMAL_STACK_SIZE<<4, NULL, tskIDLE_PRIORITY, NULL )) {
		tprintf("\n\rERROR: can't create LCDTEST task");
		for(;;);
	}
	/* Now all the tasks have been started - start the scheduler. */
	vTaskStartScheduler();
	return 0;
}