Circuitbenders Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Author Topic: The Error of My program  (Read 791 times)

ling1995

  • Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 2
The Error of My program
« on: March 14, 2017, 08:17:57 AM »

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!
Logged