bibiboo
Newbie level 4
- Joined
- Sep 1, 2012
- Messages
- 5
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,318
I have some problems with my little project. I have made zero crossing detector circuit work well and use atmega8 to create a square ware base on the output of this circuit like in the picture below. However when i try to pass the signal to light control block ( with moc3021) errors appeared. Please help me! My deadline is comming. I attached my code using winavr and proteus here. Thanks first.
View attachment test.zip
Code:
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
void main (void)
{ DDRB = (1<<DDB0);
PORTB = (1<<PB0);
sei();
MCUCR = ( 1<< ISC00) | (0<<ISC01);
GICR |= (0<<INT0);
for(;;) {
if (GIFR&& (1<<INTF0)) { PORTB = (0<<PB0);
_delay_ms (4);
PORTB= (1<<PB0);
GIFR |= (1<<INTF0);}
}
}