F28335与上位机通过SCI传数据,菜鸟只调试出来传一个数据。
时间:10-02
整理:3721RD
点击:
如果需要传两个或者其他怎么设置呢?下面是我的发送一个字符的程序
interrupt void scibTxFifoIsr(void)
{
Uint16 i;
ScibRegs.SCIFFTX.bit.TXFFINTCLR=1; // Clear Interrupt flag
PieCtrlRegs.PIEACK.all|=0x100; // Issue PIE ACK
}
interrupt void scibRxFifoIsr(void)
{
Uint16 i;
for(i=0;i<1;i++)
{
rdataB=ScibRegs.SCIRXBUF.all; // Read data
}
ScibRegs.SCIFFRX.bit.RXFFOVRCLR=1; // Clear Overflow flag
ScibRegs.SCIFFRX.bit.RXFFINTCLR=1; // Clear Interrupt flag
PieCtrlRegs.PIEACK.all|=0x100; // Issue PIE ack
for(i=0; i<1; i++)
{
ScibRegs.SCITXBUF=rdataB; // Send data
}
}
void scib_fifo_init()
{
ScibRegs.SCICCR.all =0x0007; // 1 stop bit, No loopback
// No parity,8 char bits,
// async mode, idle-line protocol
ScibRegs.SCICTL1.all =0x0003; // enable TX, RX, internal SCICLK,
// Disable RX ERR, SLEEP, TXWAKE
ScibRegs.SCICTL2.bit.TXINTENA =1;
ScibRegs.SCICTL2.bit.RXBKINTENA =1;
ScibRegs.SCIHBAUD =0x0001;
ScibRegs.SCILBAUD =0x00E7;//SCI_PRD;// 9600
ScibRegs.SCIFFTX.all=0xC021;
ScibRegs.SCIFFRX.all=0x0021;
ScibRegs.SCIFFCT.all=0x00;
ScibRegs.SCICTL1.all =0x0023; // Relinquish SCI from Reset
ScibRegs.SCIFFTX.bit.TXFIFOXRESET=1;
ScibRegs.SCIFFRX.bit.RXFIFORESET=1;
}
interrupt void scibTxFifoIsr(void)
{
Uint16 i;
ScibRegs.SCIFFTX.bit.TXFFINTCLR=1; // Clear Interrupt flag
PieCtrlRegs.PIEACK.all|=0x100; // Issue PIE ACK
}
interrupt void scibRxFifoIsr(void)
{
Uint16 i;
for(i=0;i<1;i++)
{
rdataB=ScibRegs.SCIRXBUF.all; // Read data
}
ScibRegs.SCIFFRX.bit.RXFFOVRCLR=1; // Clear Overflow flag
ScibRegs.SCIFFRX.bit.RXFFINTCLR=1; // Clear Interrupt flag
PieCtrlRegs.PIEACK.all|=0x100; // Issue PIE ack
for(i=0; i<1; i++)
{
ScibRegs.SCITXBUF=rdataB; // Send data
}
}
void scib_fifo_init()
{
ScibRegs.SCICCR.all =0x0007; // 1 stop bit, No loopback
// No parity,8 char bits,
// async mode, idle-line protocol
ScibRegs.SCICTL1.all =0x0003; // enable TX, RX, internal SCICLK,
// Disable RX ERR, SLEEP, TXWAKE
ScibRegs.SCICTL2.bit.TXINTENA =1;
ScibRegs.SCICTL2.bit.RXBKINTENA =1;
ScibRegs.SCIHBAUD =0x0001;
ScibRegs.SCILBAUD =0x00E7;//SCI_PRD;// 9600
ScibRegs.SCIFFTX.all=0xC021;
ScibRegs.SCIFFRX.all=0x0021;
ScibRegs.SCIFFCT.all=0x00;
ScibRegs.SCICTL1.all =0x0023; // Relinquish SCI from Reset
ScibRegs.SCIFFTX.bit.TXFIFOXRESET=1;
ScibRegs.SCIFFRX.bit.RXFIFORESET=1;
}
还想来学习下的,结果没人回复啊。话说你搞定了么,求指导下
用的什么接口?485还是232?