Other Parts Discussed in Thread: CC2530, , MSP430FR2311, MSP430FR2000, MSP430G2211, MSP430G2452, MSP430G2553
HI Guys,
I´m starting to work with MSP430 and I´m really impressed with this wonderful micro controller. I already have some experience with 8051 and Texas CC2530/31.
I would like to make a synchronism between trigger wave and sine wave using Zero Crossing Detector for use it in a PWM circuit to dimmer loads over 110/220V 60 Hz.
I didn't work with Zero Crossing Detector (ZCD) before, and I would like to understanding how the best way to implement it in a MSP430.
I´m using a ZCD through 4n25 optocupler like that:
I believe that I need to use:
an INTERRUPT to make a delay via timer and after it staring trigger wave on TRIAC.
Somebody can share a part of code or an AN to help me how to make it using INT or another procedure?
You can see bellow my dimmer code, using P1.3 and P1.3 pins:
#include <msp430g2231.h>
int main(void) {
WDTCTL = WDTPW + WDTHOLD;
P1DIR |= BIT2;
P1REN |= BIT3;
P1OUT |= BIT3;
P1SEL |= BIT2;
TA0CCR0 = 1000;
TA0CCTL1 = OUTMOD_7;
TA0CCR1 = 0;
TA0CTL = TASSEL_2 + MC_1;
while(1)
{
if ((P1IN & BIT3) != BIT3) {
__delay_cycles(200000);
TA0CCR1 = TA0CCR1 + 100;
if (TA0CCR1 > 1000) { TA0CCR1 = 0; }
}
}
return 0;
}
Best Regards,
Alex