NCD Articles Home Copyright © 2008, National Control Devices LLC
By Ryan Sheldon
Contact Us
 

Analog to Digital Conversion:

Converting Voltages to Numbers

 

This video is a basic introduction to Analog to Digital Conversion and how to use it in conjunction with our Controllers.
Also read our "Analog to Digital Conversion" Article.

Throughout the internet, you will see many topics on Analog to Digital Conversion.  Here, we will explore A/D as it pertains to NCD devices.  As our devices evolve, we will enhance this article to match the capabilities of newer devices.  Currently, we support 3 kinds of Analog to Digital Converters.  8-Bit, 10-Bit, and 12-Bit.

If you are not familiar with what an Analog to Digital Converter is, here I will explain it as it pertains to our devices.  A/D conversion is the process of converting a voltage in the range of 0 to 5VDC into a number that can be processed by custom software that you develop.  The higher the voltage, the higher the number.  For the time being, there are a few limitations to the A/D converters we currently employ in our devices.  Therefore, the following rules MUST be observed to prevent damage to the device:

IMPORTANT A/D Converter Wiring Rules

  • NEVER Exceed 5 DC Volts on ANY Analog Input.  Doing so WILL damage the device.
  • NEVER Apply a Negative Voltage BELOW 0 Volts.  Doing so WILL damage the device.
  • NEVER Apply ANY AC Voltage to ANY Analog Input.  Doing so WILL damage the device.
  • The Ground of the Device is ALWAYS Shared the Ground of your Voltage Input.

NCD ProXR Series Controllers support 8-Bit, 10-Bit, and 12-Bit A/D conversion depending on the model of the controller.  The ProXR command set is used to request a A/D value from the controller.  This command used also depends on the model of the controller.  You must always ask the controller for a A/D value.  ProXR controllers do not spontaneously generate data.  They are command driven ONLY.

8-Bit Analog to Digital Conversion means a voltage from 0-5 volts will be divided into 256 parts and be returned to the user as a value from 0-255.  8-Bit is the most popular choice, mainly because only a single byte of data is required to return the result.  Of the three resolutions supported, this is the lowest resolution, but because only a single byte of data is returned, it is also the fastest to respond.

10-Bit Analog to Digital Conversion means a voltage from 0-5 volts will be divided into 1024 parts and be returned to the user as two values, which are recombined to make a single value from 0 to 1023.  These two values are called Least Significant Byte and Most Significant Byte.  Since two bytes are returned, this operation is slower than 8-Bit A/D.  But 10-Bit is higher resolution, and can provide a more accurate voltage measurement.

12-Bit Analog to Digital Conversion means a voltage from 0-5 volts will be divided into 4096 parts and be returned to the user as two values, which are recombined to make a single value from 0 to 4095.  These two values are called Least Significant Byte and Most Significant Byte.  Since two bytes are returned, this operation is slower than 8-Bit A/D.  But 12-Bit is higher resolution, and can provide a more accurate voltage measurement than 8 or 10-Bit A/D.

When asking a controller for a 10-Bit or 12-Bit analog to digital conversion value, two bytes are returned as mentioned above.  These two bytes, MSB and LSB (Most and Least Significant Bytes) are recombined to form a single number, which is your final A/D value.  Using the formula below, you can EASILY convert any LSB and MSB data into a usable value by applying the following methodology:

  • First, Clear your Serial Buffer
  • Next, Ask the Controller for a 10-Bit or 12-bit Value (depending on controller)
  • The Controller will Respond with LSB and MSB Values
  • ADValue = (MSB x 256) + LSB

That's really all there is to Analog to Digital Conversion.  But the applications are limitless.  A/D is often used to read light levels and temperature levels.  You can easily activate relays when A/D limits are reached.  If it gets too dark outside, a light can be triggered.  If it gets too cold, a heater can be activated.  It can also be used to detect audio levels in a room when connected to a microphone, or even be used to read switches, potentiometers, and analog joysticks.  The applications are limitless, and surprisingly easy to integrate.

Visit out Analog to Digital page for a complete listing of all boards currently available.