lcd其他的都配置好了,但是,lcd_ram0里写数据的时候,发现lcd全部点亮了,com0对应的seg口,都不知道如何解决,
我发现都是那些单独一个com的lcd_ram区,都是些数据会导致出错,有人遇到这样的问题吗
[mw_shl_code=c,true]void LCD_Conv_Serial_Number(uint8_t SerialNumber)
{
uint8_t temp;
LCD_ClearFlag();
while(!LCD_GetFlagStatus());
temp = SerialNumber / 100;
LCD_PageSelect(LCD_PageSelection_SecondPage);
LCD->RAM[LCD_RAMRegister_14] = (LCD->RAM[LCD_RAMRegister_14] & ~0x02) | ((CapNumberMap[temp] >> 6) & 0X02);//A
LCD->RAM[LCD_RAMRegister_16] = (LCD->RAM[LCD_RAMRegister_16] & ~0x02) | ((CapNumberMap[temp] >> 5) & 0X02);//B
LCD->RAM[LCD_RAMRegister_18] = (LCD->RAM[LCD_RAMRegister_18] & ~0x02) | ((CapNumberMap[temp] >> 4) & 0X02);//C
LCD->RAM[LCD_RAMRegister_20] = (LCD->RAM[LCD_RAMRegister_20] & ~0x02) | ((CapNumberMap[temp] >> 3) & 0X02);//D
LCD->RAM[LCD_RAMRegister_14] = (LCD->RAM[LCD_RAMRegister_14] & ~0x01) | ((CapNumberMap[temp] >> 2) & 0X01); //F
LCD->RAM[LCD_RAMRegister_16] = (LCD->RAM[LCD_RAMRegister_16] & ~0x01) | ((CapNumberMap[temp] >> 1) & 0X01); //G
LCD->RAM[LCD_RAMRegister_18] = (LCD->RAM[LCD_RAMRegister_18] & ~0x01) | ((CapNumberMap[temp] >> 3) & 0X01); //E
//temp = SerialNumber % 100 / 10;
//LCD_PageSelect(LCD_PageSelection_SecondPage);
LCD->RAM[LCD_RAMRegister_14] = (LCD->RAM[LCD_RAMRegister_14] & ~0x08) | ((CapNumberMap[temp] >> 4) & 0X08);//A
LCD->RAM[LCD_RAMRegister_16] = (LCD->RAM[LCD_RAMRegister_16] & ~0x08) | ((CapNumberMap[temp] >> 3) & 0X08);//B
LCD->RAM[LCD_RAMRegister_18] = (LCD->RAM[LCD_RAMRegister_18] & ~0x08) | ((CapNumberMap[temp] >> 2) & 0X08);//C
LCD->RAM[LCD_RAMRegister_20] = (LCD->RAM[LCD_RAMRegister_20] & ~0x08) | ((CapNumberMap[temp] >> 1) & 0X08);//D
LCD->RAM[LCD_RAMRegister_14] = (LCD->RAM[LCD_RAMRegister_14] & ~0x04) | ((CapNumberMap[temp] >> 0) & 0X04);//F
LCD->RAM[LCD_RAMRegister_16] = (LCD->RAM[LCD_RAMRegister_16] & ~0x04) | ((CapNumberMap[temp] << 1) & 0X04);//G
LCD->RAM[LCD_RAMRegister_18] = (LCD->RAM[LCD_RAMRegister_18] & ~0x04) | ((CapNumberMap[temp] >> 1) & 0X04);//E
temp = SerialNumber % 10;
LCD_ClearFlag();
while(!LCD_GetFlagStatus());
//LCD_PageSelect(LCD_PageSelection_SecondPage);
LCD->RAM[LCD_RAMRegister_0] = (LCD->RAM[LCD_RAMRegister_0] & ~(0x04)) | ((CapNumberMap[temp] >> 5) & 0X04); //A
LCD->RAM[LCD_RAMRegister_3] = (LCD->RAM[LCD_RAMRegister_3] & ~(0x40)) | ((CapNumberMap[temp] >> 4) & 0X40); //B
LCD->RAM[LCD_RAMRegister_7] = (LCD->RAM[LCD_RAMRegister_7] & ~(0x04)) | ((CapNumberMap[temp] >> 3) & 0X04); //C
LCD->RAM[LCD_RAMRegister_10] = (LCD->RAM[LCD_RAMRegister_10] & (~0x40)) | ((CapNumberMap[temp] >> 2) & 0X40);//D
LCD->RAM[LCD_RAMRegister_0] = (LCD->RAM[LCD_RAMRegister_0] & (~0x02)) | ((CapNumberMap[temp] >> 1) & 0X02); //F
LCD->RAM[LCD_RAMRegister_3] = (LCD->RAM[LCD_RAMRegister_3] & (~0x20)) | ((CapNumberMap[temp] >> 0) & 0X20); //G
LCD->RAM[LCD_RAMRegister_7] = (LCD->RAM[LCD_RAMRegister_7] & (~0x02)) | ((CapNumberMap[temp] >> 2) & 0X02); //E
}[/mw_shl_code]
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>