Need your help- A question about light control circuit using atmega8

Status
Not open for further replies.

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.
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);}
}
}
View attachment test.zip
 

Only the timestep too small error needs your attention. It indicates an "everydays" SPICE convergence problem. Some hints can be found in the Proteus help. In general, you need to tune the simulator options respectively interactive simulation SPICE options.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…