[逆变器]

阳*电源等企业500KW并网逆变器源码加注释

[复制链接]
1536|4
手机看帖
扫描二维码
随时随地手机跟帖
njliu|  楼主 | 2016-2-17 16:32 | 显示全部楼层 |阅读模式
贴不了全部源码,增加附件,需要的发信息至njget@163.com 索要,硬件也可以提供!一、主程序
void main(void)
{
   InitSysCtrl();  //Initialize System Control in the DSP2833x_SysCtrl.c;   PLL, WatchDog, enable Peripheral Clocks
   MemCopy(&RamfuncsLoadStart,&RamfuncsLoadEnd,&RamfuncsRunStart);//快速程序拷入RAM
   InitFlash();    //Initialize Plash
   InitGpio();     //Initalize GPIO in the DSP2833x_Gpio.c
   InitXint1();   

   DINT;           //Clear all interrupts and initialize PIE vector table: Disable CPU interrupts

   InitPieCtrl();  //Initialize the PIE control registers in the DSP2833x_PieCtrl.c

   IER = 0x0000;   // Disable CPU interrupts and clear all CPU interrupt flags
   IFR = 0x0000;

   InitPieVectTable();  // Initialize the PIE vector table with pointers to the shell Interrupt Service Routines (ISR).
                       // in DSP2833x_PieVect.c
   EALLOW;  // This is needed to write to EALLOW protected registers
   PieVectTable.SCIRXINTB = &SCIRXINTB_ISR;  //装载中断程序入口地址
   PieVectTable.EPWM1_INT = &EPWM1_INT_ISR;
   PieVectTable.ECAP1_INT = &ECAP1_INT_ISR;
   PieVectTable.XINT1 = &XINT1_ISR;
   EDIS;    // This is needed to disable write to EALLOW protected registers

   InitCpuTimers();   // For this example, only initialize the Cpu Timers
   InitSpi();         //初始化Spi模块
   InitSci();         //初始化Sci模块
   InitEPwm();        //初始化EPwm模块
   InitECapture();    //初始化ECap模块
   InitAdc();         //初始化Adc模块
   InitXintf();       //初始化外部接口
   InitUserRegs();    //初始化用户自定义寄存器

#if (CPU_FRQ_150MHZ)
   ConfigCpuTimer(&CpuTimer0, 150, 1000000);
   ConfigCpuTimer(&CpuTimer1, 150, 1000000);
   ConfigCpuTimer(&CpuTimer2, 150, 1000000);
#endif
#if (CPU_FRQ_100MHZ)
   ConfigCpuTimer(&CpuTimer0, 100, 1000000);
ConfigCpuTimer(&CpuTimer1, 100, 1000000);
   ConfigCpuTimer(&CpuTimer2, 100, 1000000);

#endif

   CpuTimer0Regs.TCR.all = 0x4001; // Use write-only instruction to set TSS bit = 0
   CpuTimer1Regs.TCR.all = 0x4001; // Use write-only instruction to set TSS bit = 0
   CpuTimer2Regs.TCR.all = 0x4001; // Use write-only instruction to set TSS bit = 0

   IER |= M_INT1;   //0x0001,  
   IER |= M_INT3;   //0x0004,
   IER |= M_INT4;   //0x0008,
   IER |= M_INT9;   //0x0100,

   PieCtrlRegs.PIECTRL.bit.ENPIE = 1;     // Enable the PIE block
   PieCtrlRegs.PIEIER1.bit.INTx4 = 1;     // PIE Group 1,
   PieCtrlRegs.PIEIER3.bit.INTx1 = 1;     // PIE Group 3,
   PieCtrlRegs.PIEIER4.bit.INTx1 = 1;     // PIE Group 4,
   PieCtrlRegs.PIEIER9.bit.INTx3 = 1;     // PIE Group 9,

   EINT;   // Enable Global interrupt INTM
   ERTM;   // Enable Global realtime interrupt DBGM

   for(;;)
   {
      if(SciuserRegs.flagsci.bit.Recv_byt)
   {
      recvdelt();    //与触摸屏通信
   }

      
评论
徐松 2019-8-13 16:07 回复TA
感谢楼主! 

相关帖子

Dongfangyuxiao| | 2016-2-17 21:45 | 显示全部楼层
谢谢楼主分享!

使用特权

评论回复
Dongfangyuxiao| | 2016-2-17 21:46 | 显示全部楼层
2833x才出来没多久吧?这么快就有成熟产品出来了?

使用特权

评论回复
ll121408228| | 2018-10-27 20:57 | 显示全部楼层
主程序也没有贴全,就一点,没法参考。

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

11

主题

29

帖子

1

粉丝