初级会员
- 积分
- 158
- 金钱
- 158
- 注册时间
- 2020-1-15
- 在线时间
- 22 小时
|
楼主 |
发表于 2021-8-7 16:07:32
|
显示全部楼层
我用的是430fr6972的单片机,LCD_C controller,4-Mux Mode,他的com引脚是正常配置为复用功能,seg引脚配置则是通过LCD_ controller 寄存器配置的。
seg引脚通过设置 LCDCPCTL1寄存器,将需要配置的引脚对应的寄存器位置1,来配置。
[img]C:\Users\86138\Desktop- void LcdInit()
- {
- // Initialize IO
- //SEG
- P1OUT &= ~(BIT4 + BIT5 + BIT6 + BIT7); //高电平
- P1DIR |= BIT4 + BIT5 + BIT6 + BIT7; //输出
- P4OUT &= ~(BIT2 + BIT3 + BIT4 + BIT5 + BIT6 + BIT7); //高电平
- P4DIR |= BIT2 + BIT3 + BIT4 + BIT5 + BIT6 + BIT7; //输出
- //COM
- P6SEL1 |= BIT4 + BIT5 + BIT6 + BIT7;
- P6OUT |= BIT4 + BIT5 + BIT6 + BIT7;
- P6DIR |= BIT4 + BIT5 + BIT6 + BIT7; //com输出
-
- //背光灯初始化
- LCD_BLUE_OFF;
- LCD_GREEN_OFF;
- P9DIR |= BIT5 + BIT6;
- LCD_RED_OFF;
- PJDIR |= BIT7;
- // Initialize LCD segments 0 - 9
- LCDCPCTL0 = 0x03FF; //SEG引脚配置使能
-
- PM5CTL0 &= ~LOCKLPM5;
-
- // Initialize LCD_C
- // VLO, Divider = 5 Pre-divider = 8;f LCD=1000Hz; 4-pin MUX
- LCDCCTL0 = LCDSSEL |LCDDIV__5 | LCDPRE__2 | LCD4MUX | LCDLP;
- // VLCD generated internally,
- // V2-V4 generated internally, v5 to ground
- // Set VLCD voltage to 2.84v
- // Enable charge pump and select internal reference for it
- LCDCVCTL = VLCD_5 | VLCDREF_0 | LCDCPEN;
- // Clock synchronization enabled
- LCDCCPCTL = LCDCPCLKSYNC;
- // Clear LCD memory
- LCDCMEMCTL = LCDCLRM;
-
- LCDM1 = 0x00;
- LCDM2 = 0x00;
- LCDM3 = 0x00;
- LCDM4 = 0x00;
- LCDM5 = 0x00;
- LCDCCTL0 |= LCDON;
- }
复制代码 [/img] |
|