#include "DSP2833x_Device.h" // DSP2833x Headerfile Include File
#include "DSP2833x_Examples.h" // DSP2833x Examples Include File
#define SCI 1
#define UART_INT 0
interrupt void scibTxFifoIsr(void);
void scib_fifo_init();
void error(void);
Uint16 sdataB[6]={0x03,0x06,0x00,0x00,0x04,0x7F};
void main(void)
{
Uint16 i;
InitSysCtrl();
InitGpio();
InitSciGpio();
DINT;
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
EALLOW;
PieVectTable.SCITXINTB = &scibTxFifoIsr;
EDIS;
scib_fifo_init();
PieCtrlRegs.PIECTRL.bit.ENPIE = 1;
PieCtrlRegs.PIEIER9.bit.INTx3=1;
PieCtrlRegs.PIEIER9.bit.INTx4=1;
IFR = 0x0000;
IER = 0x100;
EINT;
for(;;);
}
interrupt void scibTxFifoIsr(void)
{
Uint16 i;
for(i=0;i<6;i++)
{
ScibRegs.SCITXBUF=sdataB
;
}
ScibRegs.SCIFFTX.bit.TXFFINTCLR=1; // Clear Interrupt flag
PieCtrlRegs.PIEACK.all|=0x100;
}
void scib_fifo_init()
{
ScibRegs.SCICCR.all =0x0007;
ScibRegs.SCICTL1.all =0x0003;
ScibRegs.SCICTL2.bit.TXINTENA =1;
ScibRegs.SCIHBAUD =0x001e;
ScibRegs.SCICCR.bit.LOOPBKENA =0;
ScibRegs.SCIFFTX.all=0xC020;
ScibRegs.SCIFFCT.all=0x00;
ScibRegs.SCICTL1.all =0x0023;
ScibRegs.SCIFFTX.bit.TXFIFOXRESET=1;
ScibRegs.SCIFFRX.bit.RXFIFORESET=1;
}
void error(void)
{
asm(" ESTOP0"); // Test failed!! Stop!
for (;;);
}
//===========================================================================
// No more.
//===========================================================================
这是我自己改的,应该有很多错误,各位大神别笑话我,我是新手,帮我看下吧,我想用dsp的sci实现和下位机的modbus通信,下位机是变频器,rs485接口,只要把数据发送过去,下位机能接到就可以,没有校验位,不需要返回,单向的发送就行,求高手指点!!!谢谢了!!
一周热门 更多>