TI中文支持网
TI专业的中文技术问题搜集分享网站

SCI的BRKDT的使用方法

  看了这个BRKDT的说明但是对这个的具体作用不是很明白。麻烦TI的工作人员给解释一下。谢谢。

Jason Wu4:

具体哪一块没弄明白,是中断触发条件还是其他?请具体说明

  看了这个BRKDT的说明但是对这个的具体作用不是很明白。麻烦TI的工作人员给解释一下。谢谢。

JLDN:

回复 Jason Wu4:

你好!在HV_SOLAR_DC_AC_v1.1在这个示例里的SciCommsGui.c有程序用到BRKTD.如下所示:

void GetDataByte(void) // Task 5{ if (SciaRegs.SCIRXST.bit.RXRDY == 1) // check if a char has been received {  RxChar = SciaRegs.SCIRXBUF.all;  RcvTaskPointer = &EchoDataByte;  // point to next state  //RcvTskPtrShdw = 6;    // DEBUG  EchoDataByte();     }else if (SciaRegs.SCIRXST.bit.BRKDT == 1 )//|| SerialCommsTimer > 2500) //~2 s timeout {  // If break detected or serialport times out, reset SCI  //— Needed by some serialports when code is run with an emulator     SciaRegs.SCICCR.all =0x0007;     // 1 stop bit,  No loopback                                                   // No parity,8 char bits,                                                  // async mode, idle-line protocol      SciaRegs.SCICTL1.all =0x0003;    // enable TX, RX, internal SCICLK,                                             // Disable RX ERR, SLEEP, TXWAKE       SciaRegs.SCICTL2.all =0x0000;                                                                                                                                                                 SciaRegs.SCICTL1.all =0x0027;  // Relinquish SCI from Reset       

  asm(" RPT#8 || NOP");  //—

  SendTaskPtr = 0;     // Init to 1st state   SerialCommsTimer = 0;                                                CommsOKflg = 0;  RcvTaskPointer = &GetCmdByte;  // go back and wait for new CMD                        } else if (SerialCommsTimer > 500)  // 1000*1mS = 1 sec timeout {  CommsOKflg = 0;  RcvTaskPointer = &GetCmdByte;  // Abort, go back wait for new CMD  SerialCommsTimer = 0; } }

void EchoDataByte(void) // Task 6{    if(SciaRegs.SCICTL2.bit.TXRDY == 1)  // is TXBUF empty ?, i.e. TXRDY = 1    {     SciaRegs.SCITXBUF=RxChar;   // if yes, echo back the received char  RcvTaskPointer = &PackWord;  if(CmdPacket[0] == 7)    RcvTaskPointer = &PackLong;  //RcvTskPtrShdw = 7;    // DEBUG    }}void PackLong(void) // expects LSB first then MSB // Task 7  预计LSB第一MSB然后{ if(ByteNum>0) {   RxLong += RxChar<<((3-ByteNum)*8);  ByteNum–;  RcvTaskPointer = &GetDataByte;  //RcvTskPtrShdw = 5;    // DEBUG*  GetDataByte(); } else {  RxLong += RxChar;  ByteNum=3;  //CmdPacket[2] = RxWord;    // store data in packet  RcvTaskPointer = &CmdInterpreter;  //RcvTskPtrShdw = 8;    // DEBUG  TaskDoneFlag = 0;      // indicate new task underway  表明新的任务正在进行中 }}

在这里的BRKTD是表示当通讯异常时如帧错误时复位SCI?还是其他什么作用。我就是想了解一下这个BRKTD的应用场合。谢谢!

赞(1)
未经允许不得转载:TI中文支持网 » SCI的BRKDT的使用方法
分享到: 更多 (0)