Hi all
i'm bilding an ultrasonic range finder
MY CODE:
noInterrupts(); //disable interrupt
txPulses(); //10 40kHz pulses
StartTime=micros(); //clock function rez 4 usec
Mark=micros();
delay(1); //reverberation time filter
RxFlag=1; //Rx window start
interrupts(); //inable interrupt
delay(20);
RxFlag=0; //Rx window close
range=(Mark-StartTime) / 29 / 2; // microsecend to c"m 340m/s->29usec=1 c"m
THE INTERUPT:
void interruptfunction(){
if(RxFlag ==1){
Mark=micros();
RxFlag=0;} //calculets only first echo
else{ }
}
i have alot of timming problems.
does [noInterrupts()/interrupts()] functio influence micros() function