SPLat Logo

fAnOut c+ [D>=18]

fAnOut c+ [D>=18]

Outputs the floating point number in W to analog output c.

W must be between 0 and 1, representing a fraction of full scale value. For example, if the analog output range is 0-10V, 0.5 in W will give 5V out (half scale). The actual analog output obtained is the closest approximation available given the resolution and accuracy of the analog output. The higher the resolution of the analog output, the closer the approximation will be.

For numbers outside the range 0 to 1 the result will be as shown in the following table:

W Output
0 <= W < 1.0 W * full scale
-1.0 < W < 0 -W * full scale
1.0 <= W <= +Inf Full scale
-Inf <= W <= -1.0 Full scale
NaN 0

This behaviour is closely analogous to the Fix instruction when used to convert a floating point value for use with AnOut.

This instruction breaks with our past practice of using letter designations for analog inputs and outputs. Instead we use numeric channel numbers. The correspondence between letter designation and channel number is simply that A=0, B=1, C=3 etc. The analog window in SPLat/PC from V7.18.0 shows both schemes.

Analog I/O using normalized floating point numbers has three advantages:

  1. It handles analog resolution greater than 8 bits. Because the old AnIn and Anout work through X, and X is an 8-bit register, they are limited to 8-bit I/O.
  2. If you write your program using only floating point analog I/O, if and when you switch to a SPLat controller with higher analog resolution, your program will work exactly as before but return higher resolution results.
  3. The instructions can be jndexed.

The channel number c will be jndexed when executed inside a MultiTrack task and will be indexed if the instruction is preceded by the IasJ: precode.

If you write your program using only floating point analog I/O, if and when you switch to a SPLat controller with higher analog resolution, your program will work exactly as before but return higher resolution results. However, this instruction cannot deliver more analog resolution than the board hardware is capable of. Please see the documentation for your particular board.

Dialect exclusions: Not available in dialects before 18

See also AnIn, AnOut, fAnin