Timing

In the C language using simple IDE, how can you stopwatch the time in clock ticks between 2 pulses on a propeller input pin? An even better question is besides the Simple IDE learn file, is there a comprehensive programming guide like there is for Spin? Is there a way besides running loops to make time delays shorter than what pause can?
The Propeller is like cool and stuff..... uhhh.....huh huh.

Comments

  • Mike GreenMike Green Posts: 22,904
    edited 2016-05-01 - 16:56:22
    The system clock is provided as the variable CNT. Save CNT in some variable (someVariable = CNT;) when the first pulse comes in then save it again in another variable when the second pulse comes in. The difference between the two saved values is the number of clock ticks between the two pulses. Have a look at some of the examples in "simpletools.h" like pulse_in.

    pause_ticks uses the waitcnt instruction to delay for a specified number of clock ticks and can provide small precise time delays. If the delays are on the order of microseconds, you'll have to account for the time it takes for your code to execute.

    Currently (as far as I know), there's no comprehensive programming guide like there is for Spin. There is a lot of information in "simpletools.h" and the other Propeller-specific header files.
  • Thanks Mike for your help.
    The Propeller is like cool and stuff..... uhhh.....huh huh.
Sign In or Register to comment.