RCTIME
 
Syntax

int RCTIME(int pin, int state ) ;

Description

Measure the time which pin remains at state, returning the value to variable.
The length of time is measured in microseconds(us). The minimum time measured is 1 microseconds.
If pin is not at level when the function is called variable is set to 1.
If pin remains at level longer than 1 second variable is set to 0.

Example

    printf("\n check RCTIME into a 700ohm 0.1uF drive on 14, sense on 13\n");
    OUTPUT (14);
//  while(1) {HIGH(14);WAIT(1);LOW(14);WAIT(1);} // scope loop
    
    HIGH (14); 
    printf("high to low ");
    WAIT(10);  // make sure line is high
    LOW(14);
    printf("%d microseconds, high to low ",RCTIME (13, 1));
    WAIT(10);  // make sure line is low
    HIGH (14); 
    printf("%d microseconds, low to high\n", (RCTIME (13, 0));
 check RCTIME into a 700ohm 0.1uF drive on 14, sense on 13
high to low 89 microseconds, high to low 56 microseconds, low to high

See also