TOP Contributors

  1. MIKROE (2762 codes)
  2. Alcides Ramos (374 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (139248 times)
  2. FAT32 Library (71743 times)
  3. Network Ethernet Library (57115 times)
  4. USB Device Library (47428 times)
  5. Network WiFi Library (43082 times)
  6. FT800 Library (42403 times)
  7. GSM click (29835 times)
  8. mikroSDK (28073 times)
  9. PID Library (26885 times)
  10. microSD click (26198 times)
Libstock prefers package manager

Package Manager

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]

< Back
mikroSDK Library

ADC 4 click

Rating:

5

Author: MIKROE

Last Updated: 2018-01-18

Package Version: 1.0.0.0

mikroSDK Library: 1.0.0.0

Category: ADC

Downloaded: 6574 times

Not followed.

License: MIT license  

ADC 4 click is an advanced analog to digital multi-channel converter, which can sample inputs from 16 single-ended channels or 8 differential input channel pairs.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "ADC 4 click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "ADC 4 click" changes.

Do you want to report abuse regarding "ADC 4 click".

  • mikroSDK Library 2.0.0.0
  • Comments (0)
DOWNLOAD LINK RELATED COMPILER CONTAINS
mikroBasic PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc

mikroSDK Library Blog

ADC 4 Click

ADC 4 Click

Native view of the ADC 4 Click board.

View full image
ADC 4 Click

ADC 4 Click

Front and back view of the ADC 4 Click board.

View full image

Library Description

Initializes and defines GPIO port driver and driver functions which are realized for communication via SPI bus and for calculating and converting analog signal to a digital one, according to the value of the referent voltage.

Key functions

uint8_t adc4_writeReg( const uint8_t regAddress, uint8_t *value );- This function writes data in the register determined by register address parameter of the function.

uint8_t adc4_readReg( const uint8_t regAddress, uint8_t *value );- This function reads data from the register determined by register address parameter of the function.

void adc4_reset(void);- This function reset ADC 4 click.

uint8_t adc4_getErrPin(void);- This function returns the value of INT (ERROR) pin which is controlled by ERR_DAT bit in the GPIOCON register.

void adc4_getConfig( const uint8_t regAddress, uint16_t *value );- This function writes the value of the configuration registers in storage determined by pointer value.

void adc4_setConfig( const uint8_t regAddress, uint16_t value );- This function writes a 16-bit value in the configuration registers determined by register address parameter.

uint32_t adc4_getData(void);- This function checks ready bit, is data ready or not, and returns 24-bit value from the data register.

uint16_t adc4_getVoltage(void);- This function returns 16-bit calculated value and AD converted voltage value.

Examples Description

The demo application is composed of three sections:

  • System Initialization - Initializes GPIO pins (CS, INT), SPI module for communication with ADC 4 click and UART for data logging.
  • Application Initialization - Initializes ADC 4 driver and sets up working mode.
  • Application Task - (code snippet) - Sequential read of voltage. Information about the current voltage is logged to UART. Operation is repeated each second. Settings are set to calculate and convert input voltage in the range from -2.5V to 2.5V.
void applicationTask()
{
    voltage = adc4_getVoltage();

    IntToStr( voltage, text );
    mikrobus_logWrite( "Current Voltage : ", _LOG_TEXT );
    mikrobus_logWrite( text, _LOG_TEXT );
    mikrobus_logWrite( " mV", _LOG_LINE );

    Delay_ms( 1000 );
}

Other MikroElektronika libraries used in the example:

  • Conversions
  • C_String
  • SPI
  • UART

Additional notes and information

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.

ALSO FROM THIS AUTHOR

RTD Click

0

RTD Click is based on MAX31865 resistance to digital converter from Maxim Integrated, optimized for platinum resistance temperature detectors, or RTD.

[Learn More]

STSPIN820 Click

5

STSPIN820 click is a stepper motor driver with the PWM current control, selectable microstepping up to 256 microsteps, and a wide voltage range.

[Learn More]

Thermo 21 Click

0

Thermo 21 Click is a compact add-on board that provides an accurate temperature measurement. This board features the ADT7301, a high-precision digital temperature sensor from Analog Devices. The ADT7301 houses an on-chip temperature sensor, a 13-bit A/D converter, a reference circuit, and serial interface logic functions in one package. Characterized by its high accuracy (up to ±0.5°C typical) and high resolution of 0.03125°C, this temperature sensor provides temperature data to the host controller with a configurable SPI interface. This Click board™ is appropriate for process control, environmental monitoring, domestic appliances, electronic test equipment, or other temperature measurement applications.

[Learn More]