• Welcome to Circuitbenders Forum.

The Error of My program

Started by ling1995, March 14, 2017, 08:17:57 AM

Previous topic - Next topic

ling1995

Hello~all,it's my first time to be here and I hope I have chosen the right forum to put forward my
I'm so confusing about the following question, could you help me?
I have wroten a program about the output value of spi enter to TLV5616 (this is its datasheet:http://www.kynix.com/uploadfiles/pdf8827/TLV5616CDR.pdf) to have a da change.However,I found that the output voltage of port didn't have any change.Could anybody help me? I don't know whether the reading order of tlv5616 is wrong? Or my program is wrong?
void main(void)
{
        char temp;
        InitSysCtrl();
        Init_SPI();
        SpiaRegs.SPICTL.bit.TALK=1;//FS引脚控制
        TX_SPI(0X016a);
        SpiaRegs.SPICTL.bit.TALK=0;//FS引脚控制
        while(1);
}
主函数里通过控制TALK位所连FS引脚下降沿进行读取转换。发送完毕后将FS拉高完成
发送函数
void TX_SPI(char c)
{
        while(SpiaRegs.SPISTS.bit.BUFFULL_FLAG==1);
        SpiaRegs.SPITXBUF=c;
        while(SpiaRegs.SPISTS.bit.BUFFULL_FLAG==1);
}
。。。。。。其他应该没问题初始化中SpiaRegs.SPIBRR=0x07;
Your help will be appreciated!

PS:I have upload the picture,please have a look carefully!Thank you in advance!