不知道楼主是否还在用N76E616...我最近在用这个片子,弄LCD得时候遇到问题想请教下:我往LCDDAT里面写0X01,0X02,都能在正确的位置显示码段,但是写0X04或者大于0x04的值时就会将那个引脚对应的4个码段全部显示。。。
这个是初始化函数:
void LCD_Initial(void)
{
//step1: enable clock source
clr_EXTEN1;//clr_EXTEN1;
clr_EXTEN0;//set_EXTEN0;
//USE IN CLK 11.059MHz
//set_HIRCEN;
set_LIRCEN;
//step2: check ready
//?? while((CKSWT&SET_BIT6)==0);
LCDCLK = 0x23;// USE LIRC as lcd CLK SOURCE // LCDCLK = 0x13; //;Select LXT as LCD clock source
Set_All_GPIO_Input_Mode();
LCDCON = 0x00; //;VLCD = 0.9VDD (VDD = 3.3V, VLCD = 3.0V)
//;1/4 duty, 1/3 bias, 150kO resistor ladder
LCDSEG0=0xff; //use seg0-seg22
LCDSEG1=0xff;
LCDSEG2=0x7f;
// LCDSEG3=0x9f;
LCDCON |= SET_BIT7; //LCDEN = 1
}
这个是显示函数:
void lcd_disp_7seg2(uint8_t num)
{
switch (num)
{
case 0: //show "0" -- 1'st 14seg Display
{
LCDPTR = 11;
LCDDAT = (A_1 + B_1 + C_1 + D_1);
LCDPTR = 10;
LCDDAT = (E_1 + F_1);
}break;
case 1: //show "1" -- 1'st 14seg Display
{
LCDPTR = 11;
LCDDAT = (B_1 + C_1);
LCDPTR = 10;
LCDDAT = 0X00;
}break;
case 2: //show "2" -- 1'st 14seg Display
{
LCDPTR = 11;
LCDDAT = (A_1 + B_1 + D_1);
LCDPTR = 10;
LCDDAT = (G_1+E_1);
}break;
case 3: //show "3" -- 1'st 14seg Display
{
LCDPTR = 11;
LCDDAT = (A_1 + B_1 + C_1 + D_1);
LCDPTR = 10;
LCDDAT = G_1;
}break;
case 4: //show "4" -- 1'st 14seg Display
{
LCDPTR = 11;
LCDDAT = (B_1+C_1);
LCDPTR = 10;
LCDDAT = (F_1 + G_1);
}break;
case 5: //show "5" -- 1'st 14seg Display
{
LCDPTR = 11;
LCDDAT = (A_1 + C_1 + D_1);
LCDPTR = 10;
LCDDAT = (F_1 + G_1);
}break;
case 6: //show "6" -- 1'st 14seg Display
{
LCDPTR = 11;
LCDDAT = (A_1 + C_1 + D_1);
LCDPTR = 10;
LCDDAT =(E_1+F_1 + G_1);
}break;
case 7: //show "7" -- 1'st 14seg Display
{
LCDPTR = 11;
LCDDAT = (A_1 + B_1 + C_1);
LCDPTR = 10;
LCDDAT = 0X00;
}break;
case 8: //show "8" -- 1'st 14seg Display
{
LCDPTR = 11;
LCDDAT = (A_1 + B_1 + C_1+D_1);
LCDPTR = 10;
LCDDAT = (E_1+F_1 + G_1);
}break;
case 9: //show "9" -- 1'st 14seg Display
{
LCDPTR = 11;
LCDDAT = (A_1 + B_1 + C_1+D_1);
LCDPTR = 10;
LCDDAT = (F_1 + G_1);
}break;
}
}
void lcd_disp_7seg3(uint8_t num)
{
switch (num)
{
case 0: //show "0" -- 1'st 14seg Display
{
LCDPTR = 13;
LCDDAT = (A_1 + B_1 + C_1 + D_1);
LCDPTR = 12;
LCDDAT = (E_1 + F_1);
}break;
case 1: //show "1" -- 1'st 14seg Display
{
LCDPTR = 13;
LCDDAT = (B_1 + C_1);
LCDPTR = 12;
LCDDAT = 0X00;
}break;
case 2: //show "2" -- 1'st 14seg Display
{
LCDPTR = 13;
LCDDAT = (A_1 + B_1 + D_1);
LCDPTR = 12;
LCDDAT = (G_1+E_1);
}break;
case 3: //show "3" -- 1'st 14seg Display
{
LCDPTR = 13;
LCDDAT = (A_1 + B_1 + C_1 + D_1);
LCDPTR = 12;
LCDDAT = G_1;
}break;
case 4: //show "4" -- 1'st 14seg Display
{
LCDPTR = 13;
LCDDAT = (B_1+C_1);
LCDPTR = 12;
LCDDAT = (F_1 + G_1);
}break;
case 5: //show "5" -- 1'st 14seg Display
{
LCDPTR = 13;
LCDDAT = (A_1 + C_1 + D_1);
LCDPTR = 12;
LCDDAT = (F_1 + G_1);
}break;
case 6: //show "6" -- 1'st 14seg Display
{
LCDPTR = 13;
LCDDAT = (A_1 + C_1 + D_1);
LCDPTR = 12;
LCDDAT =(E_1+F_1 + G_1);
}break;
case 7: //show "7" -- 1'st 14seg Display
{
LCDPTR = 13;
LCDDAT = (A_1 + B_1 + C_1);
LCDPTR = 12;
LCDDAT = 0X00;
}break;
case 8: //show "8" -- 1'st 14seg Display
{
LCDPTR = 13;
LCDDAT = (A_1 + B_1 + C_1+D_1);
LCDPTR = 12;
LCDDAT = (E_1+F_1 + G_1);
}break;
case 9: //show "9" -- 1'st 14seg Display
{
LCDPTR = 13;
LCDDAT = (A_1 + B_1 + C_1+D_1);
LCDPTR = 12;
LCDDAT = (F_1 + G_1);
}break;
}
} |