User Tools

Site Tools


jvs:cigal:manual:chapter6:r_await

CIGAL Reference Manual, Chapter 6 (RealTime): r_await

r_await -- Wait for an analog input value

usage: r_await opflg eflag ltime Databuf Chan WaitVal [WaitFlg TimBuf Min_T Del_T TMAX]

R_AWAIT is a REALTIME operator that waits for a change in an analog input channel. The channel is specified by the CHAN argument (value 0-15). The operation waits until the value of the specified channel crosses the value specified by WAITVAL. The desired direction of crossing can be specified by WAITFLG, which is a bitflag with the following meanings:

    WAITFLG = 1 - terminate on a rising transition  [default]
              2 - terminate on a falling transition
              4 - suspend all other operations until the wait is satisfied
                  (or the operator presses a key or mouse button).  Normally
                  R_AWAIT only suspends operations in its own timer or
                  repeat loop.
            10o - terminate on relative min/max
            20o - terminate on relative zero cossings (midpt bet max & min)
            40o - take data from parallel read calls (more efficient)
           100o - use previous values to initialize the range
           200o - use previous values for range and state

 Note: 10o, 20o, 100o & 200o are for analog only and are combined with the
       "rising" (max) and "falling" (min) options

TIMEBUF can be used to specify a long array to store the time that the wait terminated. If the DATABUF is an autoincremented array (e.g. buf++) then TIMEBUF will also be incremented after storing the timestamp.

If WAITFLG has the 10o or 20o bit set the R_AWAIT operator does not simply wait for the analog signal to cross some absolute value; instead it monitors the shape of the analog waveform and tries to identify a relative trigger point, regardless of absolute signal intensity. In this case the WAITVAL is treated as a noise parameter; the signal must change by more than this amount to be considered a true change.

MIN_T specifies the minimum time setting; at least MIN_T time must pass since the last R_AWAIT was satisfied before the current R_AWAIT will terminate. DEL_T can be used to specify the sampling frequency (this is ignored if the 40o bit is set in WAITFLG). TMAX can be used to specify an absolute time limit by which the R_AWAIT must terminate; if this time is reached the value -32767 is returned in DATABUF. TMAX must be specified in absolute time units (eg. clock ticks since the beginning of REALTIME).

Note: MIN_T DEL_T and TMAX are all long values.

See Also:
CIGAL Home, CIGAL Manual, RealTime List, Manual Help

jvs/cigal/manual/chapter6/r_await.txt · Last modified: 2023/02/23 18:43 (external edit)