Back to Sealevel      

Manual Conversion of A/D Values

To properly use the values returned from the SeaI/O 470 module's A/D channels, the application program must convert the returned 16-value to a voltage. SM_AtoDConversion() and SM_DtoAConversion() has been provided to assist the programmer and eliminate error. At times, it may be desirable to manually convert the 16-bit values to voltages. The following is a brief tutorial on how to do so.

Analog to Digital Conversion in Postive Voltage Ranges (0-10V or 0-5V)

When the SeaI/O 470 module is configured for 0-10V or 0-5V ranges, the 12-bit (padded to 16-bit) values received from the A/D inputs will range between 0 and 4096. The formula for converting the returned values to voltage is shown below:


  {voltage} = ({value} / 4096) * {max range}

For example, a returned value of 1319 (0x527) on a SeaI/O 470 module configured for a 0-10V range equals a voltage input of 3.22V.


  {voltage} = (1319 / 4096) * (10 V)

  {voltage} = 3.22 V

Differential Voltage Range (+/-10V or +/-5V)

When the SeaI/O 470 module is configured for +/-10V or +/-5V, the uppermost bit determines whether the returned values is either positive (zero) or negative (one). The lower 11 bits provide the precision. If the returned value is less than or equal to 2048, then the resulting voltage must be positive, otherwise it is negative. To calculate the voltage, choose the correct formula below:


  If the {value} is less than or equal to 2048,

	{voltage} = {value} / 2048 * {max range}

  Else

	{voltage} = ({value} - 4096) / 2048 * {max range}

For example, a returned value of 659 (0x293) on a SeaI/O 470 with a voltage range of +/-10V is less than 2048, so the calculated voltage is positive. Using the first formula above, the returned value results in a calculated voltage of 3.22V.


  {voltage} = 659 / 2048 * 10V

  {voltage} = 3.22V

If the polarity at the input is reversed, the returned value from SM_ReadInputRegisters() is 3434 (0xD6A). Since the returned value is greater than 2048, the calculated voltage must be negative and therefore the second formula is used.


  {voltage} = (3434 - 4096) / 2048 * 10V

  {voltage} = -3.23V

Current Loop Mode

In current loop mode, the returned value is the differential voltage measured across a precision 249 Ohm resisitor. Use the appropriate formula above to determine the voltage. For example, if we use the 3.23V result shown above, the current would be calculated as follows:


  {current} = {voltage} / {resistance}

  {current} = 3.23V / 249 Ohms

  {current} = 12.97 mA

 
 
Generated on 15 Dec 2008.