We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
Rating:
Author: MIKROE
Last Updated: 2019-03-18
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: ADC
Downloaded: 3901 times
Not followed.
License: MIT license
ADC 8 Click is a high precision, low-power, 16-bit analog-to-digital converter (ADC), based around the ADS1115 IC. It is capable of sampling signals on four single-ended or two differential input channels.
Do you want to subscribe in order to receive notifications regarding "ADC 8 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "ADC 8 click" changes.
Do you want to report abuse regarding "ADC 8 click".
Library Description
The library contains functions for the complete communication of the MCU with click. The user can use functions to read the ADC values and voltage on the channel. The library also offers functions for writting data into the register and reading data from the register, as well as the configuration of the device for successful measurement.
Key functions:
float adc8_getVoltage(uint8_t channel)
- Read Voltage in mVuint16_t adc8_getADCValue(uint8_t channel)
- Get ADC value reads from the channelvoid adc8_deviceConfig(uint16_t cfg)
- Device configuration for measurementExamples description
The application is composed of the three sections :
Note: On the input channel AIN0,AIN1,AIN2 and AIN3 sets maximum voltage GND - 0.3V < VIN > VDD + 0.3V.
void applicationTask()
{
// Single channel
vSingle_CH0 = adc8_getVoltage(_ADC8_SINGLE_CHANNEL_0);
vSingle_CH1 = adc8_getVoltage(_ADC8_SINGLE_CHANNEL_1);
vSingle_CH2 = adc8_getVoltage(_ADC8_SINGLE_CHANNEL_2);
vSingle_CH3 = adc8_getVoltage(_ADC8_SINGLE_CHANNEL_3);
mikrobus_logWrite("______________________________________________", _LOG_LINE);
mikrobus_logWrite(" Channel | CH 0 | CH 1 | CH 2 | CH 3 |", _LOG_LINE);
mikrobus_logWrite(" Single |", _LOG_TEXT);
IntToStr(vSingle_CH0, demoText);
mikrobus_logWrite(demoText, _LOG_TEXT);
mikrobus_logWrite(" |", _LOG_TEXT);
IntToStr(vSingle_CH1, demoText);
mikrobus_logWrite(demoText, _LOG_TEXT);
mikrobus_logWrite(" |", _LOG_TEXT);
IntToStr(vSingle_CH2, demoText);
mikrobus_logWrite(demoText, _LOG_TEXT);
mikrobus_logWrite(" |", _LOG_TEXT);
IntToStr(vSingle_CH3, demoText);
mikrobus_logWrite(demoText, _LOG_TEXT);
mikrobus_logWrite(" |", _LOG_LINE);
// Diff channel
vDiff_CH01 = adc8_getVoltage(_ADC8_DIFF_CHANNEL_0_1);
vDiff_CH03 = adc8_getVoltage(_ADC8_DIFF_CHANNEL_0_3);
vDiff_CH13 = adc8_getVoltage(_ADC8_DIFF_CHANNEL_1_3);
vDiff_CH23 = adc8_getVoltage(_ADC8_DIFF_CHANNEL_2_3);
mikrobus_logWrite("______________________________________________", _LOG_LINE);
mikrobus_logWrite(" Channel | CH 0-1 | CH 0-3 | CH 1-3 | CH 2-3 |", _LOG_LINE);
mikrobus_logWrite(" Diff |", _LOG_TEXT);
IntToStr(vDiff_CH01, demoText);
mikrobus_logWrite(demoText, _LOG_TEXT);
mikrobus_logWrite(" |", _LOG_TEXT);
IntToStr(vDiff_CH03, demoText);
mikrobus_logWrite(demoText, _LOG_TEXT);
mikrobus_logWrite(" |", _LOG_TEXT);
IntToStr(vDiff_CH13, demoText);
mikrobus_logWrite(demoText, _LOG_TEXT);
mikrobus_logWrite(" |", _LOG_TEXT);
IntToStr(vDiff_CH23, demoText);
mikrobus_logWrite(demoText, _LOG_TEXT);
mikrobus_logWrite(" |", _LOG_LINE);
mikrobus_logWrite("|--------------------------------------------|", _LOG_LINE);
Delay_1sec();
}
Other mikroE Libraries used in the example:
I2C
Conversions
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.