PreviousNext
captureTicks
Help > OS functions > Timing > captureTicks

Function

 

Get the number of ticks counted from the last startCapture and captureTicks calling.

Purpose

 

Measurement of elapsed time.

Syntax

 

void captureTicks()

Parameters

 

  –

Return value

 

  –

Output value

 

     param3:  ticks counted from the last startCapture  (0 - 65535)

     param4:  ticks counted from the last captureTicks or startCapture, whatever was the latest

                     (0 - 65535)

Preconditions

 

     startCapture should be used at least once before.

     To ensure correct operation the counter must not overflow. That is why captureTicks should be called max. ~655 s after last startCapture or captureTicks calling.

Remarks

 

See Example E05–DELAYS.

Side effects

 

     Functionality is affected by bondRequestAdvanced, RFRXpacket and RFTXpacket.

     Internal ticks are based on the internal RC oscillator if RF IC is sleeping. Thus, the delay can vary with temperature, etc. in this case. See MCU datasheet.

See also

 

startCapture, setRFready

Example

 

startCapture();     // Reset counter of ticks

waitMS(200);        // Delay 200 ms

captureTicks();     // param3 == 20, param4 == 20

waitMS(150);        // Delay 150 ms

captureTicks();     // param3 == 35, param4 == 15

startCapture();     // Reset counter of ticks

waitMS(100);        // Delay 100 ms

captureTicks();     // param3 == 10, param4 == 10