Beginners: please read this post and this post before posting to the forum.
0 Members and 1 Guest are viewing this topic.
# include<avr/io.h># include<stdio.h> int main() { unsigned long int a,b; DDRC=_BV(0); while(1) { PORTC=0x01; a=600000000; while(a>0) { b=600000000; while(b>0) { b=b-1; } a=a-1; } PORTC=0x00; a=600000000; while(a>0) { b=600000000; while(b>0) { b=b-1; } a=a-1; } } return(0); }
man those mistakes are made by beginners didnt u see the code its clearly written DDRC|=_BV(0)
void interrupt(void){ if(PIR1&1) //timer1 overflow { if(state==1) //it was high { PORTC=0; //bring it to low state=0; time=45535+pulseLength; TMR1L=Lo(time); TMR1H=Hi(time); state=0; } else { PORTC=1; time=65535-pulseLength; TMR1L=Lo(time); TMR1H=Hi(time); state=1; } PIR1=(PIR1&0b11111110); }}