28335编程
时间:10-02
整理:3721RD
点击:
interrupt void sciaTxFifoIsr(void)
{
Uint16 i;
for(i=0; i< 8; i++)
{
SciaRegs.SCITXBUF=sdataA; // Send data
}
for(i=0; i< 8; i++) //Increment send data for next cycle
{
sdataA = (sdataA+1) & 0x00FF;
}
SciaRegs.SCIFFTX.bit.TXFFINTCLR=1; // Clear SCI Interrupt flag
PieCtrlRegs.PIEACK.all|=0x100; // Issue PIE ACK
}
interrupt void sciaRxFifoIsr(void)
{
Uint16 i;
for(i=0;i<8;i++)
{
rdataA=SciaRegs.SCIRXBUF.all; // Read data
}
for(i=0;i<8;i++) // Check received data
{
if(rdataA != ( (rdata_pointA+i) & 0x00FF)) error();
}
rdata_pointA = (rdata_pointA+1) & 0x00FF;
SciaRegs.SCIFFRX.bit.RXFFOVRCLR=1; // Clear Overflow flag
SciaRegs.SCIFFRX.bit.RXFFINTCLR=1; // Clear Interrupt flag
PieCtrlRegs.PIEACK.all|=0x100; // Issue PIE ack
}
其中for(i=0; i< 8; i++) {sdataA = (sdataA+1) & 0x00FF}和if(rdataA != ( (rdata_pointA+i) & 0x00FF)) 以及rdata_pointA = (rdata_pointA+1) & 0x00FF是什么意思啊
{
Uint16 i;
for(i=0; i< 8; i++)
{
SciaRegs.SCITXBUF=sdataA; // Send data
}
for(i=0; i< 8; i++) //Increment send data for next cycle
{
sdataA = (sdataA+1) & 0x00FF;
}
SciaRegs.SCIFFTX.bit.TXFFINTCLR=1; // Clear SCI Interrupt flag
PieCtrlRegs.PIEACK.all|=0x100; // Issue PIE ACK
}
interrupt void sciaRxFifoIsr(void)
{
Uint16 i;
for(i=0;i<8;i++)
{
rdataA=SciaRegs.SCIRXBUF.all; // Read data
}
for(i=0;i<8;i++) // Check received data
{
if(rdataA != ( (rdata_pointA+i) & 0x00FF)) error();
}
rdata_pointA = (rdata_pointA+1) & 0x00FF;
SciaRegs.SCIFFRX.bit.RXFFOVRCLR=1; // Clear Overflow flag
SciaRegs.SCIFFRX.bit.RXFFINTCLR=1; // Clear Interrupt flag
PieCtrlRegs.PIEACK.all|=0x100; // Issue PIE ack
}
其中for(i=0; i< 8; i++) {sdataA = (sdataA+1) & 0x00FF}和if(rdataA != ( (rdata_pointA+i) & 0x00FF)) 以及rdata_pointA = (rdata_pointA+1) & 0x00FF是什么意思啊
这分别是发生低字节,和高字节,各8位;你的数据一共是16为的,rdata_pointA = (rdata_pointA+1) & 0x00FF这个是接受低字节8位数据。