Erst mal danke fuers posten, hier unten findest du meine ir-routinen. Der rote Quelltext (SQRT) braucht die 10ms. Vielleicht kann man dass ja auch irgendwie anders machen. PIC ist uebrigens PIC16F628A.

Danke fuer die Hilfe

Thomas

#int_RTCC
RTCC_isr()
{
int_count++;
}

#int_RB
portb()
{
if(test == 0)
{
// Check for 1 because only PIN B0 has the low_to_high detection
if(INFRA == 1)
{
set_timer0(0);
int_count = 0;
test = 1;
}
}

else
{
if(ULTRA == 1)
{

time = int_count * INT_TIME + get_timer0() * MIN_TIME;
// time_in_sec = time * E-6

d = sqrt((time / 1000 * SONIC_SPEED) * (time / 1000 * SONIC_SPEED) - h_2);

// *E-6 that it x is also in mm, the SQRT needs about 10 MS. ONly with 1 Sender is this long time acceptable => d is in mm

if(left == 1)
dist = START_DIST - d;

// dist = distance away from start position

else
dist = START_DIST + d;

if(aim > dist)
output_high(SPEED); // Compare Aim

if(aim <= dist)
{
output_low(SPEED);
end = 1;
}

if(dist > START_DIST)
left = 0;

test = 0;

disable_interrupts(INT_RB);
// Disable Prot B interrupts because ervery interrupt in the next 300ms is wrong
}
}
}