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: 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.
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".
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:
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:
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.