1、BY-HNP816TA-Model:

 

 

2、测试过程

看液晶手册,4个com口,两个管脚对应一个显示位,只是做测试,我是把液晶的pin(1~6)接到了MSP430FR4133的P3.0~P3.5做测试,我只接了COM口和一个显示位来做测试,

液晶管脚 单片机管脚 对应液晶功能

LCD_pin1 ————–MSP430FR4133_P3.0(L8)– COM0

LCD_pin2 ————–MSP430FR4133_P3.0(L9)– COM1

LCD_pin3 ————–MSP430FR4133_P3.0(L10)– COM2

LCD_pin4 ————–MSP430FR4133_P3.0(L11)– COM3

LCD_pin5 ————–MSP430FR4133_P3.0(L12)
Segment1

LCD_pin6 ————–MSP430FR4133_P3.0(L13)
Segment1

LCD的编码:

0x1-S 0x10-D

0x2-E 0x20-C

0x4-G 0x40-B

0x8-F 0x80-A

数字(10进制) 对应的段 编码(16进制)
0 A+B+C+D+E+F 0x2+0x08+0x10+0x20+0x40+0x80=0xFA
1 B+C 0x20+0x40=0x60
2 A+B+D+E+G 0xD6
3 A+B+C+D+G 0xF4
4 B+C+F+G 0x6C
5 A+C+D+F+G 0xBC
6 A+C+D+E+F+G 0xBE
7 A+B+C 0xE0
8 A+B+C+D+E+F+G 0xFE
9 A+B+C+D+F+G 0xFC

需要显示T位只需要在这些编码加上T的编码值0x01就可以了显示出来了

3、测试的代码:

 

//
//                MSP430FR4133
//             -----------------
//         /|\|                 |
//          | |              XIN|--
// GND      --|RST              |  ~32768Hz
//  |         |             XOUT|--
//  |--0.1uF--|R13              |
//  |--0.1uF--|R23      (L11)COM3|----------------|
//  |--0.1uF--|R33      (L10)COM2|---------------||
//          --|LCDC2    (L9)COM1|--------------|||
//     4.7uF  |         (L8)COM0|-------------||||
//          --|LCDC1            |    -------------
//            |             |---| 1 2 3 4 5 6 |
//            |   except L2~L13 |    -------------
//            |                 |       LCD
//            |                 |
//
//  LCD pin - Port Pin Map
//  LCD pin   HNP816TA-Model
//    1         L8  (P3.0)
//    2         L9  (P3.1)
//    3         L10 (P3.2)
//    4         L11 (P3.3)
//    5         L12 (P3.4)
//    6         L13 (P3.5)

//用来测试液晶的程序
#define CPU_F ((double)1000000) //延迟函数 使用频率
#define delay_us(x) __delay_cycles((long)(CPU_F*(double)x/1000000.0)) //延迟1us
#define delay_ms(x) __delay_cycles((long)(CPU_F*(double)x/1000.0)) //延迟1ms

#include <msp430.h>

const char digit[10] =
{
0xFA, // "0"
0x60, // "1"
0xD6, // "2"
0xF4, // "3"
0x6C, // "4"
0xBC, // "5"
0xBE, // "6"
0xE0, // "7"
0xFE, // "8"
0xFC // "9"
};

int main( void )
{
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer

// Configure XT1 oscillator
P4SEL0 |= BIT1 | BIT2; // P4.2~P4.1: crystal pins
do
{
CSCTL7 &= ~(XT1OFFG | DCOFFG); // Clear XT1 and DCO fault flag
SFRIFG1 &= ~OFIFG;
}while (SFRIFG1 & OFIFG); // Test oscillator fault flag
CSCTL6 = (CSCTL6 & ~(XT1DRIVE_3)) | XT1DRIVE_2; // Higher drive strength and current consumption for XT1 oscillator


// Disable the GPIO power-on default high-impedance mode
// to activate previously configured port settings
PM5CTL0 &= ~LOCKLPM5;

// Configure LCD pins
SYSCFG2 |= LCDPCTL; // R13/R23/R33/LCDCAP0/LCDCAP1 pins selected

LCDPCTL0 = 0x3F00; //使用的管脚配置


LCDCTL0 = LCDSSEL_0 | LCDDIV_7; // flcd ref freq is xtclk

// LCD Operation - Mode 3, internal 3.08v, charge pump 256Hz
LCDVCTL = LCDCPEN | LCDREFEN | VLCD_6 | (LCDCPFSEL0 | LCDCPFSEL1 | LCDCPFSEL2 | LCDCPFSEL3);

LCDMEMCTL |= LCDCLRM; // Clear LCD memory

LCDCSSEL0 = 0x0F00; // 设置 COMs 和段脚
LCDCSSEL1 = 0x0000; // L8, L9, L10, L11: COM pins
LCDCSSEL2 = 0x0000;

LCDM4 = 0x21; // L8 = COM0, L9 = COM1
LCDM5 = 0x84; // L10 = COM2, L11 = COM3


LCDCTL0 |= LCD4MUX | LCDON; // Turn on LCD, 4-mux selected


PMMCTL0_H = PMMPW_H; // Open PMM Registers for write
PMMCTL0_L |= PMMREGOFF_L; // and set PMMREGOFF

unsigned char count=0;

while(1)
{

LCDMEM[6]=digit[count];

if(count<9)
{
count++;
}
else
{
count=0;
}

delay_ms(1000);


}

}

 

 

发表评论

你的电子邮件地址不会被公开 * 为必填字段

提交评论