Functions

MSX-E312x Analog output functions
[MSX-E312x functions]

Contain the analog output initialisation and read/write functions. More...

Functions


Detailed Description

Conversion of a digital value into an analog value

The functions MSXExxxx__AnalogOutputWrite1Value and MSXExxxx__AnalogOutputGetChannelValue both take or return a digital value.

You will probably want to use Volts or Amperes, so you will have to convert that digital value into a real Volt (or ampere) value.

In bipolar mode, the digital range is from 0 to 0xffff (16bits), and corresponds to the range -10V to +10V.

In unipolar mode, the digital range is from 0 to 0x7fff (8bits), and corresponds to the range 0V to +10V.

From digital to analog

In bipolar mode: anavalue = (( digvalue - 32767.0 ) / 32767.0) * 10.0
In unipolar mode: anavalue = (digvalue * 10.0) / 32767.0

From analog to digital

In bipolar mode: digvalue = (32767.0 * anavalue / 10.0) + 32768.0;
In bipolar mode: digvalue = 32767.0 * anavalue / 10.0;