range = get_srf04(); // get range from srf04 (round trip flight
time in 0.8uS units)
cursor(24); // sets cursor to 2nd row of LCD03
sprintf(s,"Range = %dcm ", range/72); // convert to cm
print(s); // send it to the LCD03
cursor(44); // sets cursor to 3rd row of LCD03
sprintf(s,"Range = %dinch ", range/185); // convert to inches
print(s); // send it to the LCD03
TMR1H = 0; // 52mS delay - this is so that the
SRF04 ranging is not too rapid
TMR1L = 0; // and the previous pulse has faded
away before we start the next one
T1CON = 0x21; // 1:4 prescale and running
TMR1IF = 0;
while(!TMR1IF); // wait for delay times
TMR1ON = 0; // stop timer