Пример #1
0
/**
  * @brief  Init the GPIO port of the LCD and LCD peripheral.
  * @param  None 
  * @retval None
  */
void LCD_Seg_Init(void)
{
    uint16_t i;
    LCD_InitPara LCD_InitStructure;

    /* Configure the LCD GPIO pins */
    LCD_GPIO_Config(); 

    /*!< Enable the clock of LCD */
    RCC_APB1PeriphClock_Enable(RCC_APB1PERIPH_LCD, ENABLE);
    for(i=0;i<500;i++);
    /* Configure the LCD interface */
    LCD_InitStructure.LCD_Prescaler = LCD_PRESCALER_1;
    LCD_InitStructure.LCD_Divider = LCD_DIVIDER_16;
    LCD_InitStructure.LCD_Duty = LCD_DUTY_1_4;
    LCD_InitStructure.LCD_VBias = LCD_BIAS_1_3;
    LCD_InitStructure.LCD_VSRC = LCD_VOLTAGESOURCE_INTERNAL;
    LCD_Init(&LCD_InitStructure);

    /* Configure the Pulse On Duration */
    LCD_PulseOnDurationConfig(LCD_PULSEON_DURATION_7);

    /* Configure the Datatime Period */
    LCD_DeadTimeConfig(LCD_DEADTIME_PERIOD_7);

    /* Configure the LCD Contrast LEVEL_7(3.51V) */
    LCD_ContrastConfig(LCD_CONTRAST_LEVEL_7);

    /* Enable high drive function */
    LCD_HighDrive_Enable(ENABLE);

    /* Loop until SYNF flag is set */
    while ((LCD->SFR & LCD_FLAG_SYNF) == (uint32_t)RESET)
    {
    }
    /* Enable LCD peripheral */
    LCD_Enable(ENABLE);

    /* Wait the LCD is enable */
    while(!(LCD_GetBitState(LCD_FLAG_ONF)))
    {
    }

    /* Wait the LCD CFGR register synchronization */
//    while(!(LCD_GetBitState(LCD_FLAG_VRDYF)))
//    {
//    }

}
Пример #2
0
void LCD_HardwareInit(void)
{
  unsigned long segments = S8 | S9 | S10 | S11 | S12 | S13 | S14 | S15 | S16 | S17 | S18 | S19;
  CLK_RTCClockConfig(CLK_RTCCLKSource_LSI, CLK_RTCCLKDiv_2);
  CLK_PeripheralClockConfig(CLK_Peripheral_RTC, ENABLE);
  
  CLK_PeripheralClockConfig(CLK_Peripheral_LCD, ENABLE);
  LCD_Init(LCD_Prescaler_4, LCD_Divider_24, LCD_Duty_1_3, LCD_Bias_1_3, LCD_VoltageSource_External);
  LCD_PortMaskConfig(LCD_PortMaskRegister_1, (uint8_t)(segments >> 8));
  LCD_PortMaskConfig(LCD_PortMaskRegister_2, (uint8_t)(segments >> 16));
  LCD_PortMaskConfig(LCD_PortMaskRegister_3, (uint8_t)(segments >> 24));
  LCD_PulseOnDurationConfig(LCD_PulseOnDuration_0);
  LCD_ContrastConfig(LCD_Contrast_Level_7);
  LCD_Cmd(ENABLE);
}
Пример #3
0
void lcd_init(void)
{
 LCD_Init(LCD_Prescaler_2, 
LCD_Divider_16,
LCD_Duty_1_4,
LCD_Bias_1_3,
LCD_VoltageSource_Internal);
LCD_PortMaskConfig(LCD_PortMaskRegister_0, 0xff);
LCD_PortMaskConfig(LCD_PortMaskRegister_1,0xff);
LCD_PortMaskConfig(LCD_PortMaskRegister_2,0x03);
LCD_PulseOnDurationConfig(LCD_PulseOnDuration_1);
LCD_Cmd(ENABLE);
LCD_ContrastConfig(LCD_Contrast_Level_5);

};
Пример #4
0
Файл: lcd.c Проект: ezhov/test2
void startLcd()
{
    int i;
    long j;

    CLK_PeripheralClockConfig(CLK_Peripheral_RTC, ENABLE);
    CLK_RTCClockConfig(CLK_RTCCLKSource_LSI, CLK_RTCCLKDiv_1);
    CLK_PeripheralClockConfig(CLK_Peripheral_LCD, ENABLE);

    LCD_Init(LCD_Prescaler_1, LCD_Divider_31, LCD_Duty_1_4, LCD_Bias_1_3, LCD_VoltageSource_Internal);
    LCD_PortMaskConfig(LCD_PortMaskRegister_0, 0xff);
    LCD_PortMaskConfig(LCD_PortMaskRegister_1, 0xff);
    LCD_PortMaskConfig(LCD_PortMaskRegister_2, 0xff);
    LCD_ContrastConfig(LCD_Contrast_3V0);
    LCD_DeadTimeConfig(LCD_DeadTime_0);
    LCD_PulseOnDurationConfig(LCD_PulseOnDuration_1);

    LCD_Cmd(ENABLE);
}
Пример #5
0
void LCD_SC_Init(void)
{
	/* Enable LCD clock */
	CLK_PeripheralClockConfig(CLK_Peripheral_RTC, ENABLE);
	CLK_PeripheralClockConfig(CLK_Peripheral_LCD, ENABLE);
	CLK_RTCClockConfig(CLK_RTCCLKSource_LSE, CLK_RTCCLKDiv_1);

	/* Initialize the LCD */
	LCD_Init(LCD_Prescaler_2, LCD_Divider_18, LCD_Duty_1_8,
	   		LCD_Bias_1_4, LCD_VoltageSource_Internal);

	/* Mask register*/
	LCD_PortMaskConfig(LCD_PortMaskRegister_0, 0xff);
	LCD_PortMaskConfig(LCD_PortMaskRegister_1, 0x3f);

	LCD_ContrastConfig(LCD_Contrast_Level_7);
	LCD_PulseOnDurationConfig(LCD_PulseOnDuration_7);

	/*  Enable LCD peripheral */
	LCD_Cmd(ENABLE);
}
/**
  * @brief  Configures the LCD GLASS relative GPIO port IOs and LCD peripheral.
  * @param  None 
  * @retval None
  */
void LCD_GLASS_Init(void)
{
  LCD_InitTypeDef LCD_InitStructure;
  
  LCD_GPIOConfig(); /*!< Configure the LCD Glass GPIO pins */

  /*!< Configure the LCD interface -------------------------------------------*/
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_LCD, ENABLE); /*!< Enable LCD APB1 Clock */
  
  LCD_InitStructure.LCD_Prescaler = LCD_Prescaler_8;
  LCD_InitStructure.LCD_Divider = LCD_Divider_16;
  LCD_InitStructure.LCD_Duty = LCD_Duty_1_4;
  LCD_InitStructure.LCD_Bias = LCD_Bias_1_3;
  LCD_InitStructure.LCD_VoltageSource = LCD_VoltageSource_Internal;
  LCD_Init(&LCD_InitStructure);

  /*!< Configure the Pulse On Duration */
  LCD_PulseOnDurationConfig(LCD_PulseOnDuration_2);
  
  /*!< Configure the LCD Contrast (3.51V) */
  LCD_ContrastConfig(LCD_Contrast_Level_7);

  /*!< Wait Until the LCD FCR register is synchronized */
  LCD_WaitForSynchro();
  
  /*!< Enable LCD peripheral */
  LCD_Cmd(ENABLE);
  
  /*!< Wait Until the LCD is enabled */
  while(LCD_GetFlagStatus(LCD_FLAG_ENS) == RESET)
  {
  }
  /*!< Wait Until the LCD Booster is ready */  
  while(LCD_GetFlagStatus(LCD_FLAG_RDY) == RESET)
  {
  }    
}