专家,您好:
我想用28035的比较器做以下功能(同一个比较器交替控制PWM1与PWM2):
50Hz的交流正半周在1A口信号>DACVAL时,封波PWM2A;
50Hz的交流负半周在1A口信号<DACVAL时,封波PWM1A;
交流过零检测没有问题,DC模块的配置没有问题,自己测试过!
但是实现上述功能时,没有成功。找不出问题所在,请专家帮忙!谢谢
代码如下:
交流正半周10ms
#if 1
EALLOW;
//EPwm1Regs.DCTRIPSEL.bit.DCBHCOMPSEL = DC_COMP1OUT;
//DC–TZ
EPwm1Regs.TZSEL.bit.DCBEVT2 = 0; //disable DCAEVT1 as cbc source for this ePWMmodule
EPwm1Regs.TZSEL.bit.DCAEVT2 = 0;
// Define an event (DCAEVT1) based on TZ1
EPwm2Regs.DCTRIPSEL.bit.DCAHCOMPSEL = DC_COMP1OUT; // DCAH = Comparator 1 output
EPwm2Regs.TZSEL.bit.DCAEVT2 = 1; //Enable DCAEVT1 as cbc source for this ePWMmodule
EPwm2Regs.TZDCSEL.bit.DCAEVT2 = TZ_DCAH_HI;//TZ_DCAH_HI;//TZ_DCAH_LOW; // DCAEVT1 = DCAH high(will become active as Comparator output goes low)
//Enable Interrupt generation;
Comp1Regs.DACVAL.all= 330;//320;//372; //_1.2V
EDIS;
#endif
交流负半周10ms
EALLOW;
//DC–TZ
EPwm2Regs.TZSEL.bit.DCAEVT2 = 0; //disable DCAEVT1 as cbc source for this ePWMmodule
EPwm2Regs.TZSEL.bit.DCBEVT2 = 0;
// Define an event (DCAEVT1) based on TZ1
EPwm1Regs.DCTRIPSEL.bit.DCBLCOMPSEL = DC_COMP1OUT; // DCAH = Comparator 1 output
EPwm1Regs.TZSEL.bit.DCBEVT2 = 1; //Enable DCAEVT1 as cbc source for this ePWMmodule
EPwm1Regs.TZDCSEL.bit.DCBEVT2 = TZ_DCAH_LOW;//TZ_DCAH_HI;//TZ_DCAH_LOW; // DCAEVT1 = DCAH high(will become active as Comparator output goes low)
//Enable Interrupt generation;
Comp1Regs.DACVAL.all= 300;//320;//372; //_1.2V
EDIS;
//DC初始化代码:
EALLOW;
AdcRegs.COMPHYSTCTL.bit.COMP1_HYST_DISABLE = 1; //Hysteresisdisable
Comp1Regs.COMPCTL.bit.CMPINV=0; //0: Output of comparator,1: Inverted 比较器输出没有翻转
Comp1Regs.COMPCTL.bit.COMPSOURCE=0; //connected to internal DAC 连接到内部DAC
Comp1Regs.COMPCTL.bit.SYNCSEL = 0; //Asynchronous version of Comparator output //异步操作
Comp1Regs.COMPCTL.bit.COMPDACEN=1; //for test
Comp1Regs.DACCTL.bit.DACSOURCE=0;
//Comp3Regs.DACVAL.all= 744; //_2.4V–1A—-
//Comp1Regs.DACVAL.all= 350;//320;//372; //_1.2V
EDIS;
盼复!!
seven xie:
在线等
专家,您好:
我想用28035的比较器做以下功能(同一个比较器交替控制PWM1与PWM2):
50Hz的交流正半周在1A口信号>DACVAL时,封波PWM2A;
50Hz的交流负半周在1A口信号<DACVAL时,封波PWM1A;
交流过零检测没有问题,DC模块的配置没有问题,自己测试过!
但是实现上述功能时,没有成功。找不出问题所在,请专家帮忙!谢谢
代码如下:
交流正半周10ms
#if 1
EALLOW;
//EPwm1Regs.DCTRIPSEL.bit.DCBHCOMPSEL = DC_COMP1OUT;
//DC–TZ
EPwm1Regs.TZSEL.bit.DCBEVT2 = 0; //disable DCAEVT1 as cbc source for this ePWMmodule
EPwm1Regs.TZSEL.bit.DCAEVT2 = 0;
// Define an event (DCAEVT1) based on TZ1
EPwm2Regs.DCTRIPSEL.bit.DCAHCOMPSEL = DC_COMP1OUT; // DCAH = Comparator 1 output
EPwm2Regs.TZSEL.bit.DCAEVT2 = 1; //Enable DCAEVT1 as cbc source for this ePWMmodule
EPwm2Regs.TZDCSEL.bit.DCAEVT2 = TZ_DCAH_HI;//TZ_DCAH_HI;//TZ_DCAH_LOW; // DCAEVT1 = DCAH high(will become active as Comparator output goes low)
//Enable Interrupt generation;
Comp1Regs.DACVAL.all= 330;//320;//372; //_1.2V
EDIS;
#endif
交流负半周10ms
EALLOW;
//DC–TZ
EPwm2Regs.TZSEL.bit.DCAEVT2 = 0; //disable DCAEVT1 as cbc source for this ePWMmodule
EPwm2Regs.TZSEL.bit.DCBEVT2 = 0;
// Define an event (DCAEVT1) based on TZ1
EPwm1Regs.DCTRIPSEL.bit.DCBLCOMPSEL = DC_COMP1OUT; // DCAH = Comparator 1 output
EPwm1Regs.TZSEL.bit.DCBEVT2 = 1; //Enable DCAEVT1 as cbc source for this ePWMmodule
EPwm1Regs.TZDCSEL.bit.DCBEVT2 = TZ_DCAH_LOW;//TZ_DCAH_HI;//TZ_DCAH_LOW; // DCAEVT1 = DCAH high(will become active as Comparator output goes low)
//Enable Interrupt generation;
Comp1Regs.DACVAL.all= 300;//320;//372; //_1.2V
EDIS;
//DC初始化代码:
EALLOW;
AdcRegs.COMPHYSTCTL.bit.COMP1_HYST_DISABLE = 1; //Hysteresisdisable
Comp1Regs.COMPCTL.bit.CMPINV=0; //0: Output of comparator,1: Inverted 比较器输出没有翻转
Comp1Regs.COMPCTL.bit.COMPSOURCE=0; //connected to internal DAC 连接到内部DAC
Comp1Regs.COMPCTL.bit.SYNCSEL = 0; //Asynchronous version of Comparator output //异步操作
Comp1Regs.COMPCTL.bit.COMPDACEN=1; //for test
Comp1Regs.DACCTL.bit.DACSOURCE=0;
//Comp3Regs.DACVAL.all= 744; //_2.4V–1A—-
//Comp1Regs.DACVAL.all= 350;//320;//372; //_1.2V
EDIS;
盼复!!
Victor Zheng:
回复 seven xie:
您好,
你可以先试一个正半周,或者单试一个负半周,看能不能成功。
VIctor
专家,您好:
我想用28035的比较器做以下功能(同一个比较器交替控制PWM1与PWM2):
50Hz的交流正半周在1A口信号>DACVAL时,封波PWM2A;
50Hz的交流负半周在1A口信号<DACVAL时,封波PWM1A;
交流过零检测没有问题,DC模块的配置没有问题,自己测试过!
但是实现上述功能时,没有成功。找不出问题所在,请专家帮忙!谢谢
代码如下:
交流正半周10ms
#if 1
EALLOW;
//EPwm1Regs.DCTRIPSEL.bit.DCBHCOMPSEL = DC_COMP1OUT;
//DC–TZ
EPwm1Regs.TZSEL.bit.DCBEVT2 = 0; //disable DCAEVT1 as cbc source for this ePWMmodule
EPwm1Regs.TZSEL.bit.DCAEVT2 = 0;
// Define an event (DCAEVT1) based on TZ1
EPwm2Regs.DCTRIPSEL.bit.DCAHCOMPSEL = DC_COMP1OUT; // DCAH = Comparator 1 output
EPwm2Regs.TZSEL.bit.DCAEVT2 = 1; //Enable DCAEVT1 as cbc source for this ePWMmodule
EPwm2Regs.TZDCSEL.bit.DCAEVT2 = TZ_DCAH_HI;//TZ_DCAH_HI;//TZ_DCAH_LOW; // DCAEVT1 = DCAH high(will become active as Comparator output goes low)
//Enable Interrupt generation;
Comp1Regs.DACVAL.all= 330;//320;//372; //_1.2V
EDIS;
#endif
交流负半周10ms
EALLOW;
//DC–TZ
EPwm2Regs.TZSEL.bit.DCAEVT2 = 0; //disable DCAEVT1 as cbc source for this ePWMmodule
EPwm2Regs.TZSEL.bit.DCBEVT2 = 0;
// Define an event (DCAEVT1) based on TZ1
EPwm1Regs.DCTRIPSEL.bit.DCBLCOMPSEL = DC_COMP1OUT; // DCAH = Comparator 1 output
EPwm1Regs.TZSEL.bit.DCBEVT2 = 1; //Enable DCAEVT1 as cbc source for this ePWMmodule
EPwm1Regs.TZDCSEL.bit.DCBEVT2 = TZ_DCAH_LOW;//TZ_DCAH_HI;//TZ_DCAH_LOW; // DCAEVT1 = DCAH high(will become active as Comparator output goes low)
//Enable Interrupt generation;
Comp1Regs.DACVAL.all= 300;//320;//372; //_1.2V
EDIS;
//DC初始化代码:
EALLOW;
AdcRegs.COMPHYSTCTL.bit.COMP1_HYST_DISABLE = 1; //Hysteresisdisable
Comp1Regs.COMPCTL.bit.CMPINV=0; //0: Output of comparator,1: Inverted 比较器输出没有翻转
Comp1Regs.COMPCTL.bit.COMPSOURCE=0; //connected to internal DAC 连接到内部DAC
Comp1Regs.COMPCTL.bit.SYNCSEL = 0; //Asynchronous version of Comparator output //异步操作
Comp1Regs.COMPCTL.bit.COMPDACEN=1; //for test
Comp1Regs.DACCTL.bit.DACSOURCE=0;
//Comp3Regs.DACVAL.all= 744; //_2.4V–1A—-
//Comp1Regs.DACVAL.all= 350;//320;//372; //_1.2V
EDIS;
盼复!!
seven xie:
回复 Victor Zheng:
单试一个就是OK的。
但两个一起加就不行了。
所以后面我用一个时,会关掉另一个,但还是不行。
专家,您好:
我想用28035的比较器做以下功能(同一个比较器交替控制PWM1与PWM2):
50Hz的交流正半周在1A口信号>DACVAL时,封波PWM2A;
50Hz的交流负半周在1A口信号<DACVAL时,封波PWM1A;
交流过零检测没有问题,DC模块的配置没有问题,自己测试过!
但是实现上述功能时,没有成功。找不出问题所在,请专家帮忙!谢谢
代码如下:
交流正半周10ms
#if 1
EALLOW;
//EPwm1Regs.DCTRIPSEL.bit.DCBHCOMPSEL = DC_COMP1OUT;
//DC–TZ
EPwm1Regs.TZSEL.bit.DCBEVT2 = 0; //disable DCAEVT1 as cbc source for this ePWMmodule
EPwm1Regs.TZSEL.bit.DCAEVT2 = 0;
// Define an event (DCAEVT1) based on TZ1
EPwm2Regs.DCTRIPSEL.bit.DCAHCOMPSEL = DC_COMP1OUT; // DCAH = Comparator 1 output
EPwm2Regs.TZSEL.bit.DCAEVT2 = 1; //Enable DCAEVT1 as cbc source for this ePWMmodule
EPwm2Regs.TZDCSEL.bit.DCAEVT2 = TZ_DCAH_HI;//TZ_DCAH_HI;//TZ_DCAH_LOW; // DCAEVT1 = DCAH high(will become active as Comparator output goes low)
//Enable Interrupt generation;
Comp1Regs.DACVAL.all= 330;//320;//372; //_1.2V
EDIS;
#endif
交流负半周10ms
EALLOW;
//DC–TZ
EPwm2Regs.TZSEL.bit.DCAEVT2 = 0; //disable DCAEVT1 as cbc source for this ePWMmodule
EPwm2Regs.TZSEL.bit.DCBEVT2 = 0;
// Define an event (DCAEVT1) based on TZ1
EPwm1Regs.DCTRIPSEL.bit.DCBLCOMPSEL = DC_COMP1OUT; // DCAH = Comparator 1 output
EPwm1Regs.TZSEL.bit.DCBEVT2 = 1; //Enable DCAEVT1 as cbc source for this ePWMmodule
EPwm1Regs.TZDCSEL.bit.DCBEVT2 = TZ_DCAH_LOW;//TZ_DCAH_HI;//TZ_DCAH_LOW; // DCAEVT1 = DCAH high(will become active as Comparator output goes low)
//Enable Interrupt generation;
Comp1Regs.DACVAL.all= 300;//320;//372; //_1.2V
EDIS;
//DC初始化代码:
EALLOW;
AdcRegs.COMPHYSTCTL.bit.COMP1_HYST_DISABLE = 1; //Hysteresisdisable
Comp1Regs.COMPCTL.bit.CMPINV=0; //0: Output of comparator,1: Inverted 比较器输出没有翻转
Comp1Regs.COMPCTL.bit.COMPSOURCE=0; //connected to internal DAC 连接到内部DAC
Comp1Regs.COMPCTL.bit.SYNCSEL = 0; //Asynchronous version of Comparator output //异步操作
Comp1Regs.COMPCTL.bit.COMPDACEN=1; //for test
Comp1Regs.DACCTL.bit.DACSOURCE=0;
//Comp3Regs.DACVAL.all= 744; //_2.4V–1A—-
//Comp1Regs.DACVAL.all= 350;//320;//372; //_1.2V
EDIS;
盼复!!
Victor Zheng:
回复 seven xie:
您好
一起用的时候是哪个不灵?
专家,您好:
我想用28035的比较器做以下功能(同一个比较器交替控制PWM1与PWM2):
50Hz的交流正半周在1A口信号>DACVAL时,封波PWM2A;
50Hz的交流负半周在1A口信号<DACVAL时,封波PWM1A;
交流过零检测没有问题,DC模块的配置没有问题,自己测试过!
但是实现上述功能时,没有成功。找不出问题所在,请专家帮忙!谢谢
代码如下:
交流正半周10ms
#if 1
EALLOW;
//EPwm1Regs.DCTRIPSEL.bit.DCBHCOMPSEL = DC_COMP1OUT;
//DC–TZ
EPwm1Regs.TZSEL.bit.DCBEVT2 = 0; //disable DCAEVT1 as cbc source for this ePWMmodule
EPwm1Regs.TZSEL.bit.DCAEVT2 = 0;
// Define an event (DCAEVT1) based on TZ1
EPwm2Regs.DCTRIPSEL.bit.DCAHCOMPSEL = DC_COMP1OUT; // DCAH = Comparator 1 output
EPwm2Regs.TZSEL.bit.DCAEVT2 = 1; //Enable DCAEVT1 as cbc source for this ePWMmodule
EPwm2Regs.TZDCSEL.bit.DCAEVT2 = TZ_DCAH_HI;//TZ_DCAH_HI;//TZ_DCAH_LOW; // DCAEVT1 = DCAH high(will become active as Comparator output goes low)
//Enable Interrupt generation;
Comp1Regs.DACVAL.all= 330;//320;//372; //_1.2V
EDIS;
#endif
交流负半周10ms
EALLOW;
//DC–TZ
EPwm2Regs.TZSEL.bit.DCAEVT2 = 0; //disable DCAEVT1 as cbc source for this ePWMmodule
EPwm2Regs.TZSEL.bit.DCBEVT2 = 0;
// Define an event (DCAEVT1) based on TZ1
EPwm1Regs.DCTRIPSEL.bit.DCBLCOMPSEL = DC_COMP1OUT; // DCAH = Comparator 1 output
EPwm1Regs.TZSEL.bit.DCBEVT2 = 1; //Enable DCAEVT1 as cbc source for this ePWMmodule
EPwm1Regs.TZDCSEL.bit.DCBEVT2 = TZ_DCAH_LOW;//TZ_DCAH_HI;//TZ_DCAH_LOW; // DCAEVT1 = DCAH high(will become active as Comparator output goes low)
//Enable Interrupt generation;
Comp1Regs.DACVAL.all= 300;//320;//372; //_1.2V
EDIS;
//DC初始化代码:
EALLOW;
AdcRegs.COMPHYSTCTL.bit.COMP1_HYST_DISABLE = 1; //Hysteresisdisable
Comp1Regs.COMPCTL.bit.CMPINV=0; //0: Output of comparator,1: Inverted 比较器输出没有翻转
Comp1Regs.COMPCTL.bit.COMPSOURCE=0; //connected to internal DAC 连接到内部DAC
Comp1Regs.COMPCTL.bit.SYNCSEL = 0; //Asynchronous version of Comparator output //异步操作
Comp1Regs.COMPCTL.bit.COMPDACEN=1; //for test
Comp1Regs.DACCTL.bit.DACSOURCE=0;
//Comp3Regs.DACVAL.all= 744; //_2.4V–1A—-
//Comp1Regs.DACVAL.all= 350;//320;//372; //_1.2V
EDIS;
盼复!!
seven xie:
回复 Victor Zheng:
您好:
举例说明:
正半周我想封PWM2,但是不想封PWM1.
所以我配置了:
EPwm1Regs.TZSEL.bit.DCBEVT2 = 0; //disable DCAEVT1 as cbc source for this ePWMmodule
EPwm1Regs.TZSEL.bit.DCAEVT2 = 0;
EPwm2Regs.TZSEL.bit.DCAEVT2 = 1; //Enable DCAEVT1 as cbc source for this ePWMmodule
EPwm2Regs.TZDCSEL.bit.DCAEVT2 = TZ_DCAH_HI;
但是实际上PWM1也会封。
所以还请审下我的配置代码,错在哪里。
谢谢
专家,您好:
我想用28035的比较器做以下功能(同一个比较器交替控制PWM1与PWM2):
50Hz的交流正半周在1A口信号>DACVAL时,封波PWM2A;
50Hz的交流负半周在1A口信号<DACVAL时,封波PWM1A;
交流过零检测没有问题,DC模块的配置没有问题,自己测试过!
但是实现上述功能时,没有成功。找不出问题所在,请专家帮忙!谢谢
代码如下:
交流正半周10ms
#if 1
EALLOW;
//EPwm1Regs.DCTRIPSEL.bit.DCBHCOMPSEL = DC_COMP1OUT;
//DC–TZ
EPwm1Regs.TZSEL.bit.DCBEVT2 = 0; //disable DCAEVT1 as cbc source for this ePWMmodule
EPwm1Regs.TZSEL.bit.DCAEVT2 = 0;
// Define an event (DCAEVT1) based on TZ1
EPwm2Regs.DCTRIPSEL.bit.DCAHCOMPSEL = DC_COMP1OUT; // DCAH = Comparator 1 output
EPwm2Regs.TZSEL.bit.DCAEVT2 = 1; //Enable DCAEVT1 as cbc source for this ePWMmodule
EPwm2Regs.TZDCSEL.bit.DCAEVT2 = TZ_DCAH_HI;//TZ_DCAH_HI;//TZ_DCAH_LOW; // DCAEVT1 = DCAH high(will become active as Comparator output goes low)
//Enable Interrupt generation;
Comp1Regs.DACVAL.all= 330;//320;//372; //_1.2V
EDIS;
#endif
交流负半周10ms
EALLOW;
//DC–TZ
EPwm2Regs.TZSEL.bit.DCAEVT2 = 0; //disable DCAEVT1 as cbc source for this ePWMmodule
EPwm2Regs.TZSEL.bit.DCBEVT2 = 0;
// Define an event (DCAEVT1) based on TZ1
EPwm1Regs.DCTRIPSEL.bit.DCBLCOMPSEL = DC_COMP1OUT; // DCAH = Comparator 1 output
EPwm1Regs.TZSEL.bit.DCBEVT2 = 1; //Enable DCAEVT1 as cbc source for this ePWMmodule
EPwm1Regs.TZDCSEL.bit.DCBEVT2 = TZ_DCAH_LOW;//TZ_DCAH_HI;//TZ_DCAH_LOW; // DCAEVT1 = DCAH high(will become active as Comparator output goes low)
//Enable Interrupt generation;
Comp1Regs.DACVAL.all= 300;//320;//372; //_1.2V
EDIS;
//DC初始化代码:
EALLOW;
AdcRegs.COMPHYSTCTL.bit.COMP1_HYST_DISABLE = 1; //Hysteresisdisable
Comp1Regs.COMPCTL.bit.CMPINV=0; //0: Output of comparator,1: Inverted 比较器输出没有翻转
Comp1Regs.COMPCTL.bit.COMPSOURCE=0; //connected to internal DAC 连接到内部DAC
Comp1Regs.COMPCTL.bit.SYNCSEL = 0; //Asynchronous version of Comparator output //异步操作
Comp1Regs.COMPCTL.bit.COMPDACEN=1; //for test
Comp1Regs.DACCTL.bit.DACSOURCE=0;
//Comp3Regs.DACVAL.all= 744; //_2.4V–1A—-
//Comp1Regs.DACVAL.all= 350;//320;//372; //_1.2V
EDIS;
盼复!!
Victor Zheng:
回复 seven xie:
你这里只是让TZ不选DCEVENT作为触发源,DCEVENT可以不过TZ直接封波。你把DC的输入源整个关掉试试。
专家,您好:
我想用28035的比较器做以下功能(同一个比较器交替控制PWM1与PWM2):
50Hz的交流正半周在1A口信号>DACVAL时,封波PWM2A;
50Hz的交流负半周在1A口信号<DACVAL时,封波PWM1A;
交流过零检测没有问题,DC模块的配置没有问题,自己测试过!
但是实现上述功能时,没有成功。找不出问题所在,请专家帮忙!谢谢
代码如下:
交流正半周10ms
#if 1
EALLOW;
//EPwm1Regs.DCTRIPSEL.bit.DCBHCOMPSEL = DC_COMP1OUT;
//DC–TZ
EPwm1Regs.TZSEL.bit.DCBEVT2 = 0; //disable DCAEVT1 as cbc source for this ePWMmodule
EPwm1Regs.TZSEL.bit.DCAEVT2 = 0;
// Define an event (DCAEVT1) based on TZ1
EPwm2Regs.DCTRIPSEL.bit.DCAHCOMPSEL = DC_COMP1OUT; // DCAH = Comparator 1 output
EPwm2Regs.TZSEL.bit.DCAEVT2 = 1; //Enable DCAEVT1 as cbc source for this ePWMmodule
EPwm2Regs.TZDCSEL.bit.DCAEVT2 = TZ_DCAH_HI;//TZ_DCAH_HI;//TZ_DCAH_LOW; // DCAEVT1 = DCAH high(will become active as Comparator output goes low)
//Enable Interrupt generation;
Comp1Regs.DACVAL.all= 330;//320;//372; //_1.2V
EDIS;
#endif
交流负半周10ms
EALLOW;
//DC–TZ
EPwm2Regs.TZSEL.bit.DCAEVT2 = 0; //disable DCAEVT1 as cbc source for this ePWMmodule
EPwm2Regs.TZSEL.bit.DCBEVT2 = 0;
// Define an event (DCAEVT1) based on TZ1
EPwm1Regs.DCTRIPSEL.bit.DCBLCOMPSEL = DC_COMP1OUT; // DCAH = Comparator 1 output
EPwm1Regs.TZSEL.bit.DCBEVT2 = 1; //Enable DCAEVT1 as cbc source for this ePWMmodule
EPwm1Regs.TZDCSEL.bit.DCBEVT2 = TZ_DCAH_LOW;//TZ_DCAH_HI;//TZ_DCAH_LOW; // DCAEVT1 = DCAH high(will become active as Comparator output goes low)
//Enable Interrupt generation;
Comp1Regs.DACVAL.all= 300;//320;//372; //_1.2V
EDIS;
//DC初始化代码:
EALLOW;
AdcRegs.COMPHYSTCTL.bit.COMP1_HYST_DISABLE = 1; //Hysteresisdisable
Comp1Regs.COMPCTL.bit.CMPINV=0; //0: Output of comparator,1: Inverted 比较器输出没有翻转
Comp1Regs.COMPCTL.bit.COMPSOURCE=0; //connected to internal DAC 连接到内部DAC
Comp1Regs.COMPCTL.bit.SYNCSEL = 0; //Asynchronous version of Comparator output //异步操作
Comp1Regs.COMPCTL.bit.COMPDACEN=1; //for test
Comp1Regs.DACCTL.bit.DACSOURCE=0;
//Comp3Regs.DACVAL.all= 744; //_2.4V–1A—-
//Comp1Regs.DACVAL.all= 350;//320;//372; //_1.2V
EDIS;
盼复!!
seven xie:
回复 Victor Zheng:
您指的是哪一位?
DC的输入源?
专家,您好:
我想用28035的比较器做以下功能(同一个比较器交替控制PWM1与PWM2):
50Hz的交流正半周在1A口信号>DACVAL时,封波PWM2A;
50Hz的交流负半周在1A口信号<DACVAL时,封波PWM1A;
交流过零检测没有问题,DC模块的配置没有问题,自己测试过!
但是实现上述功能时,没有成功。找不出问题所在,请专家帮忙!谢谢
代码如下:
交流正半周10ms
#if 1
EALLOW;
//EPwm1Regs.DCTRIPSEL.bit.DCBHCOMPSEL = DC_COMP1OUT;
//DC–TZ
EPwm1Regs.TZSEL.bit.DCBEVT2 = 0; //disable DCAEVT1 as cbc source for this ePWMmodule
EPwm1Regs.TZSEL.bit.DCAEVT2 = 0;
// Define an event (DCAEVT1) based on TZ1
EPwm2Regs.DCTRIPSEL.bit.DCAHCOMPSEL = DC_COMP1OUT; // DCAH = Comparator 1 output
EPwm2Regs.TZSEL.bit.DCAEVT2 = 1; //Enable DCAEVT1 as cbc source for this ePWMmodule
EPwm2Regs.TZDCSEL.bit.DCAEVT2 = TZ_DCAH_HI;//TZ_DCAH_HI;//TZ_DCAH_LOW; // DCAEVT1 = DCAH high(will become active as Comparator output goes low)
//Enable Interrupt generation;
Comp1Regs.DACVAL.all= 330;//320;//372; //_1.2V
EDIS;
#endif
交流负半周10ms
EALLOW;
//DC–TZ
EPwm2Regs.TZSEL.bit.DCAEVT2 = 0; //disable DCAEVT1 as cbc source for this ePWMmodule
EPwm2Regs.TZSEL.bit.DCBEVT2 = 0;
// Define an event (DCAEVT1) based on TZ1
EPwm1Regs.DCTRIPSEL.bit.DCBLCOMPSEL = DC_COMP1OUT; // DCAH = Comparator 1 output
EPwm1Regs.TZSEL.bit.DCBEVT2 = 1; //Enable DCAEVT1 as cbc source for this ePWMmodule
EPwm1Regs.TZDCSEL.bit.DCBEVT2 = TZ_DCAH_LOW;//TZ_DCAH_HI;//TZ_DCAH_LOW; // DCAEVT1 = DCAH high(will become active as Comparator output goes low)
//Enable Interrupt generation;
Comp1Regs.DACVAL.all= 300;//320;//372; //_1.2V
EDIS;
//DC初始化代码:
EALLOW;
AdcRegs.COMPHYSTCTL.bit.COMP1_HYST_DISABLE = 1; //Hysteresisdisable
Comp1Regs.COMPCTL.bit.CMPINV=0; //0: Output of comparator,1: Inverted 比较器输出没有翻转
Comp1Regs.COMPCTL.bit.COMPSOURCE=0; //connected to internal DAC 连接到内部DAC
Comp1Regs.COMPCTL.bit.SYNCSEL = 0; //Asynchronous version of Comparator output //异步操作
Comp1Regs.COMPCTL.bit.COMPDACEN=1; //for test
Comp1Regs.DACCTL.bit.DACSOURCE=0;
//Comp3Regs.DACVAL.all= 744; //_2.4V–1A—-
//Comp1Regs.DACVAL.all= 350;//320;//372; //_1.2V
EDIS;
盼复!!
seven xie:
回复 Victor Zheng:
您好:
DCTRIPSEL里面没有关掉的设置,只有TZ或者COPOUT或者RSV
专家,您好:
我想用28035的比较器做以下功能(同一个比较器交替控制PWM1与PWM2):
50Hz的交流正半周在1A口信号>DACVAL时,封波PWM2A;
50Hz的交流负半周在1A口信号<DACVAL时,封波PWM1A;
交流过零检测没有问题,DC模块的配置没有问题,自己测试过!
但是实现上述功能时,没有成功。找不出问题所在,请专家帮忙!谢谢
代码如下:
交流正半周10ms
#if 1
EALLOW;
//EPwm1Regs.DCTRIPSEL.bit.DCBHCOMPSEL = DC_COMP1OUT;
//DC–TZ
EPwm1Regs.TZSEL.bit.DCBEVT2 = 0; //disable DCAEVT1 as cbc source for this ePWMmodule
EPwm1Regs.TZSEL.bit.DCAEVT2 = 0;
// Define an event (DCAEVT1) based on TZ1
EPwm2Regs.DCTRIPSEL.bit.DCAHCOMPSEL = DC_COMP1OUT; // DCAH = Comparator 1 output
EPwm2Regs.TZSEL.bit.DCAEVT2 = 1; //Enable DCAEVT1 as cbc source for this ePWMmodule
EPwm2Regs.TZDCSEL.bit.DCAEVT2 = TZ_DCAH_HI;//TZ_DCAH_HI;//TZ_DCAH_LOW; // DCAEVT1 = DCAH high(will become active as Comparator output goes low)
//Enable Interrupt generation;
Comp1Regs.DACVAL.all= 330;//320;//372; //_1.2V
EDIS;
#endif
交流负半周10ms
EALLOW;
//DC–TZ
EPwm2Regs.TZSEL.bit.DCAEVT2 = 0; //disable DCAEVT1 as cbc source for this ePWMmodule
EPwm2Regs.TZSEL.bit.DCBEVT2 = 0;
// Define an event (DCAEVT1) based on TZ1
EPwm1Regs.DCTRIPSEL.bit.DCBLCOMPSEL = DC_COMP1OUT; // DCAH = Comparator 1 output
EPwm1Regs.TZSEL.bit.DCBEVT2 = 1; //Enable DCAEVT1 as cbc source for this ePWMmodule
EPwm1Regs.TZDCSEL.bit.DCBEVT2 = TZ_DCAH_LOW;//TZ_DCAH_HI;//TZ_DCAH_LOW; // DCAEVT1 = DCAH high(will become active as Comparator output goes low)
//Enable Interrupt generation;
Comp1Regs.DACVAL.all= 300;//320;//372; //_1.2V
EDIS;
//DC初始化代码:
EALLOW;
AdcRegs.COMPHYSTCTL.bit.COMP1_HYST_DISABLE = 1; //Hysteresisdisable
Comp1Regs.COMPCTL.bit.CMPINV=0; //0: Output of comparator,1: Inverted 比较器输出没有翻转
Comp1Regs.COMPCTL.bit.COMPSOURCE=0; //connected to internal DAC 连接到内部DAC
Comp1Regs.COMPCTL.bit.SYNCSEL = 0; //Asynchronous version of Comparator output //异步操作
Comp1Regs.COMPCTL.bit.COMPDACEN=1; //for test
Comp1Regs.DACCTL.bit.DACSOURCE=0;
//Comp3Regs.DACVAL.all= 744; //_2.4V–1A—-
//Comp1Regs.DACVAL.all= 350;//320;//372; //_1.2V
EDIS;
盼复!!
Victor Zheng:
回复 seven xie:
选一个肯定不会被触发的