求助关于MSP430FG4619与LCD显示问题

2019-03-24 14:44发布

我用的是MSP430FG4619,连接的LCD是NHD‐C12832A1Z‐NSW‐BBW‐3V3
用SPI,我查了有3pin和4pin模式, 我的这个连接用了SCL, STE, SIMO,SOMI没有连,不知道是3pin还是4pin
初始化还是有困难,请大家帮帮忙
以下是LCD datasheet上提供的sample code

void data_out(unsigned char i) //Data Output Serial Interface
{
unsigned int n;
CS = 0;
A0 = 1;
for(n=0; n<8; n++){
i <<=1;
SCL = 0;
P1 = i;
delay(2);
SCL = 1;
}
CS = 1;
}
void comm_out(unsigned char j) //Command Output Serial Interface
{
unsigned int n;
CS = 0;
A0 = 0;
for(n=0; n<8; n++){
j <<=1;
SCL = 0;
P1 = j;
delay(2);
SCL = 1;
}
CS = 1;
}
/****************************************************
* Initialization For controller *
*****************************************************/
void init_LCD()
{
comm_out(0xA0);
comm_out(0xAE);
comm_out(0xC0);
comm_out(0xA2);
comm_out(0x2F);
comm_out(0x26);
comm_out(0x81);
comm_out(0x2F);
}
/*****************************************************/ 此帖出自小平头技术问答
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
8条回答
chenc_44
2019-03-24 22:12
< :TI_MSP430_内容页_SA7 --> void spi_IO( unsigned char data[], int bytes )
{
    int n=0;
    // Set Chip Select low, so LCD panel knows we are talking to it.
    CS_L;
    while(n < bytes)
    {      
        UCA0TXBUF = data[n];   // load byte into transmit buffer
         n++;
       //_BIS_SR(LPM0_bits + GIE);   // sleep until done   
    }
   
    // Set Chip Select back high to finish the communication.
   CS_H;
}

以上是我用来给lcd发命令的,比如说我有8bytes要通过TXBUF发给lcd,我停止debugging的时候能看到TXBUF里面是最后一个byte
这是不是说明前面的都发送成功了呢?
还有,数据放到TXBUF里面是不是就直接发送了还是需要其他命令来让它发送?
谢谢

一周热门 更多>

相关问题

    相关文章