Пример #1
0
/***************************************************************************//**
 * @brief  Read status of LCD controller
 * @return status : Status of LCD controller
 ******************************************************************************/
static unsigned char Lcd_Read_Status (void)
{
    unsigned char status;

    LCD_DATA_DIR_IN();
    GPIO_WriteBit(GPIOA, RS, Bit_RESET);
    GPIO_WriteBit(GPIOA, RW, Bit_SET);
    Delay(10000);
    GPIO_WriteBit(GPIOA, EN, Bit_SET);
    Delay(10000);
    status  = LCD_DATA_IN() << 4;
    GPIO_WriteBit(GPIOA, EN, Bit_RESET);
    Delay(10000);
    GPIO_WriteBit(GPIOA, EN, Bit_SET);
    Delay(10000);
    status |= LCD_DATA_IN();
    GPIO_WriteBit(GPIOA, EN, Bit_RESET);
    LCD_DATA_DIR_OUT();
    return (status);
}
uint8_t  ReadStatus (char Need){
uint8_t res, TimeOut;
res=0;
TimeOut=0;
while (1) {

//	CLREA;
	LCD_DATA_DIR_IN();
	SetCMD;
	ClrRD;				//Разрешение дисплея
	ClrCE;
	res=LCD_DATA_IN();		//Прием статуса из дисплея
	SetRD;
	SetCE;
	LCD_DATA_DIR_OUT();
//    SETEA;

	if ((res & Need) ==Need) return 1;
	TimeOut++;
	if (TimeOut > MaxTimeOut) {/*not=100;ton=6;*/
		return 0;
	}
	}
}