初级会员

- 积分
- 113
- 金钱
- 113
- 注册时间
- 2012-8-2
- 在线时间
- 13 小时
|

楼主 |
发表于 2012-9-10 11:58:49
|
显示全部楼层
LCD_InitTypeDef LCD_InitStruct;
// LCD_GLASS_Configure_GPIO (); // LCD使用到的IO端口初始化
// RCC_APB1PeriphClockCmd(RCC_APB1Periph_LCD | RCC_APB1Periph_PWR, ENABLE);
LCD_InitStruct.LCD_Prescaler = LCD_Prescaler_32768; //LCD_Prescaler_1;
LCD_InitStruct.LCD_Divider = LCD_Divider_31;
LCD_InitStruct.LCD_Duty = LCD_Duty_1_4;
LCD_InitStruct.LCD_Bias = LCD_Bias_1_3;
LCD_InitStruct.LCD_VoltageSource = LCD_VoltageSource_Internal;
/* Initialize the LCD */
LCD_Init(&LCD_InitStruct);
void LCD_Init(LCD_InitTypeDef* LCD_InitStruct)
{
/* Check function parameters */
assert_param(IS_LCD_PRESCALER(LCD_InitStruct->LCD_Prescaler));
assert_param(IS_LCD_DIVIDER(LCD_InitStruct->LCD_Divider));
assert_param(IS_LCD_DUTY(LCD_InitStruct->LCD_Duty));
assert_param(IS_LCD_BIAS(LCD_InitStruct->LCD_Bias));
assert_param(IS_LCD_VOLTAGE_SOURCE(LCD_InitStruct->LCD_VoltageSource));
LCD->FCR &= (uint32_t)FCR_MASK;
LCD->FCR |= (uint32_t)(LCD_InitStruct->LCD_Prescaler | LCD_InitStruct->LCD_Divider);
LCD_WaitForSynchro();
LCD->CR &= (uint32_t)CR_MASK;
LCD->CR |= (uint32_t)(LCD_InitStruct->LCD_Duty | LCD_InitStruct->LCD_Bias | \
LCD_InitStruct->LCD_VoltageSource);
}
/**
* @brief Waits until the LCD FCR register is synchronized in the LCDCLK domain.
* This function must be called after any write operation to LCD_FCR register.
* @param None
* @retval None
*/
void LCD_WaitForSynchro(void)
{
/* Loop until FCRSF flag is set */
while ((LCD->SR & LCD_FLAG_FCRSF) == (uint32_t)RESET)
{
}
}
每次都是死在LCD_WaitForSynchro()里面出不来,LCD_SR的第五位FCRSF一直没有置一,资料上说是硬件控制的,不知道在那里能解决这个问题
|
|