Please enable JavaScript to view this site.

This function is used to perform the calculation of the difference between two integer units, properly handling the "unwrapping" of data whenever the value of an incoming parameter has exceeded the range of the unit used.

Syntax

real delta_enc16 (real actEnc, real oldEnc)

actEnc

Contains the first unit (current value). (16-bit int format: range -32768-:-32767)

oldEnc

Contains the unit to be subtracted from the first (previous value). (16-bit int format: range -32768-:-32767)

Result

Returns the difference actEnc - oldEnc, modulated as if it were a 16-bit integer type variable

Validity

Rule, Task

Note


A typical example of the function's use is to construct a real quota based on an incremental encoder reading.

In the case of encoders, if actEnc is the current encoder reading and oldEnc is the reading taken in the previous sampling, the function returns the number of bits to which the encoder has moved in the period between the two readings.

 

  

Keyboard Navigation

F7 for caret browsing
Hold ALT and press letter

This Info: ALT+q
Page Header: ALT+h
Topic Header: ALT+t
Topic Body: ALT+b
Contents: ALT+c
Search: ALT+s
Exit Menu/Up: ESC