Instructions
UM-0085-B09 DT80 Range User Manual Page 68
RG
• any channel's value (e.g. a measured temperature) may be assigned to a channel variable by using the =nCV
channel option
• certain special channel options (e.g. histogram) return multiple data values, which are written to a specified
range of channel variables. See Multi Value Statistical Options (P78).
• data values read from a serial sensor using the generic serial channel type (n
SERIAL) may be assigned to
CVs. See Generic Serial Channel (P348).
• CVs can be set or read by an external Modbus master device. See Modbus Interface (P175).
• CVs can be configured to follow the state of an alarm (e.g set to 1 if the alarm is active, 0 if it is not). See Alarm
Digital Action Channels (P85).
Expressions
Some examples of using expressions to set CVs:
1..20CV=10.2 initialise multiple CVs
RA1S 1V 9CV=9CV+1 count the number of measurements taken
5CV(W)=3CV*SIN(21CV)+2CV*COS(21CV)
See also Expressions (P69).
=nCV Channel Option
The =nCV channel option allows a channel value to be assigned directly to a CV, typically so it can then be used in
further calculations.
This can be used to apply a complicated linearisation equation, e.g.:
1V(=2CV,W) 2CV(S9,"temp~K")=2CV/(LN(2CV+1))
This will measure a voltage and assign it to 2CV (note the W option – we are not interested in logging/returning the raw
voltage value). The value in 2CV is then plugged into the specified expression and the result stored back in 2CV. Finally
a span (
S9, which must have been previously defined) is applied and the result is returned with appropriate name and
units.
An arithmetic operator may also be applied during the assignment, as follows:
Channel Option
Action
=nCV
nCV = channel value
+=nCV
nCV = nCV +
channel value
-=nCV
nCV = nCV - channel value
*=nCV
nCV = nCV * channel value
/=nCV
nCV = nCV
/ channel value
These allow a CV to be used as an accumulator, e.g.
RA1M 3C(+=2CV) 2CV("Total")
will report the number of counts received in each one minute period, plus the total counts, i.e.:
3C 192 Counts
Total 192
3C 77 Counts
Total 269
Storage Precision
Channel variables may be used to store values with magnitudes from 10-38 to 1038. However, it is important to be aware
that values are stored with 24 bits of precision, or approximately 7.25 significant digits when written in decimal form. This
means that whenever the DT80 displays a value, it will only be accurate to 7 significant digits. The 8th digit can be used
to distinguish values which are close together, but its value may be out by a few counts. Any changes in the 9th or later
digits will not be reflected in the stored value.
This is particularly noticable when incrementing large integer values. For example:
1CV=3600000
RA1S 1CV=1CV+1
1CV 3600000.0
1CV 3600000.8
1CV 3600002.0
In this example 8 significant digits are being displayed, so the last one is not accurate. It would be better in this case to
not display any decimal places, i.e.
1CV(FF0)=1CV+1.
Once the magnitude of the CV value exceeds 224 (16,777,216), adding one to it will no longer cause its value to change.
A consequence of this is that if you manually count something using a channel variable (e.g.
1CV=1CV+1) then it will
stop counting once its value reaches 16,777,216. Note that this only applies to manual counting using CVs – hardware
and software counters (HSC and C channel types) can count over the full 32-bit range.