求助,关于滤波

2019-03-24 12:18发布

在MSP430开发板上利用软件产生SPWM波,然后加个滤波电路想产生周期为1s的正弦波,可是加上硬件后出不来正弦波,求助滤波电路应该怎么改,软件设计有问题吗?
下面附有软件程序和外部滤波电路图,滤波电路放大器用的是opa2227,因为放大一倍,所以R4=0,直接连的导线
//******************************************************************************
//  LaunchPad Lab4 - Timer Toggle P1.6,
//
//                MSP430G2553
//             -----------------
//         /||              XIN|-
//          | |                 |
//          --|RST          XOUT|-
//            |                 |
//            |             P1.6|-->LED
//
//******************************************************************************
#include  <msp430g2553.h>
short temp[200]={2500,2578,2656,2735,2813,2891,2968,3045,3121,3197,3272,3346,3420,
  3492,3564,3634,3704,3772,3839,3904,3969,4031,4093,4152,4211,4267,4322,4374,
  4425,4474,4522,4567,4610,4651,4690,4727,4761,4793,4823,4851,4877,4900,4920,
  4939,4955,4968,4979,4988,4994,4998,4999,4998,4994,4988,4979,4968,4955,4939,
  4920,4900,4877,4851,4823,4793,4761,4727,4690,4651,4610,4567,4522,4474,4425,
  4374,4322,4267,4211,4152,4093,4031,3969,3904,3839,3772,3704,3634,3564,3492,
  3420,3346,3272,3197,3121,3045,2968,2891,2813,2735,2656,2578,2500,2421,2343,
  2264,2186,2108,2031,1954,1878,1802,1727,1653,1579,1507,1435,1365,1295,1227,
  1160,1095,1030,968,906,847,788,732,677,625,574,525,477,432,389,348,309,272,
  238,206,176,148,122,99,79,60,44,31,20,11,5,1,0,1,5,11,20,31,44,60,79,99,122,
  148,176,206,238,272,309,348,389,432,477,525,574,625,677,732,788,847,906,968,
  1030,1095,1160,1227,1295,1365,1435,1507,1579,1653,1727,1802,1878,1954,2031,
  2108,2186,2264,2343,2421};
int i=0;
void main(void)
{
WDTCTL = WDTPW + WDTHOLD;                 // Stop watchdog timer
if (CALBC1_1MHZ ==0xFF || CALDCO_1MHZ == 0xFF)
{
  while(1);             // If calibration constants erased, trap CPU!!
}
BCSCTL1 = CALBC1_1MHZ;       // Set range
DCOCTL = CALDCO_1MHZ;        // Set DCO step + modulation
BCSCTL3 |= LFXT1S_2;                      // LFXT1 = VLO
P1DIR = 0x40;                             // P1.6 output (green LED)
P1OUT = 0;                                // LED off
IFG1 &= ~OFIFG;                           // Clear OSCFault flag
BCSCTL1 |= DIVA_0;        // ACLK = VLO
BCSCTL2 |= SELM_0 + DIVM_0 + DIVS_0;      // MCLK = DCO, SMCLK = DCO
// Configure TimerA
TACTL = TASSEL1 +MC_1;         // Source: ACLK, UP mode
CCR0 = 5000;     //Timer count 5100
CCR1 = 2500;      //Timer count 100
CCTL0 = CCIE;                   //CCR0 interrupt enabled
CCTL1 = CCIE;                   //CCR1 interrupt enabled
_BIS_SR(GIE);
for(;;);
}
// Timer A0 interrupt service routine
#pragma vector=TIMER0_A0_VECTOR
__interrupt void Timer_A0 (void)
{
P1OUT |= BIT6;                // P1.6 output High
if(i==199)
{
  i=0;
}
else
{
  i++;
}
if(temp==4999)
{
  CCR1=4998;
}
else
{
  CCR1=temp;
}
}
// Timer A1 Interrupt Vector (TA0IV) handler
#pragma vector=TIMER0_A1_VECTOR
__interrupt void Timer_A1(void)
{
switch( TA0IV )
{
case  2: P1OUT &= ~BIT6;                    // P1.6 output Low
           break;
case 10:
           break;
}
} 此帖出自小平头技术问答
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
10条回答
zgbkdlm
2019-03-24 17:15
< :TI_MSP430_内容页_SA7 --> 用个带通滤波器要好些,
另外这个运放是什么型号?

一周热门 更多>

相关问题

    相关文章