adc9 2.0.0.0
main.c File Reference

Adc9 Click example. More...

#include "board.h"
#include "log.h"
#include "adc9.h"

Macros

#define VREF   2048
 

Functions

void measurement_init (adc9_t *ctx, adc9_rw_t *rw)
 
void application_init (void)
 
void application_task (void)
 
int main (void)
 

Variables

int32_t adc_value
 
float m_volts
 

Detailed Description

Adc9 Click example.

Description

This click is 8th channel analog to digital converter expansion board, usefull for projects where we have demand for multi channel ADC conversion such as microcontrollers with small number or none analog inputs. It offers integrated features, such as internal oscillator, temperature sensor and burnout sensor detection, in order to reduce system component count and total solution cost.

The demo application is composed of two sections :

Application Init

Initalizes SPI driver, resets and starts the device, and makes an initial log.

Application Task

This is an example that shows the capabilities of the ADC 9 click by calculating voltage level based on ADC from channels 0(positive) and 1(negative), and logs the result.

Additional Function

  • void measurement_init ( adc9_t *ctx, adc9_rw_t *rw ) - Measurement Initialization function is used to easily apply desired settings, in this case device is set to read ADC value from channels 0 (positive) and 1 (negative) with default data format, gain, boost and internal clock.

NOTE

Depending on the VOLT SEL jumper position on the click board the user needs to set VREF macro value (mV) in the code.

Author
MikroE Team

Macro Definition Documentation

◆ VREF

#define VREF   2048

Function Documentation

◆ application_init()

void application_init ( void )

Logger initialization. Default baud rate: 115200 Default log level: LOG_LEVEL_DEBUG

Note
If USB_UART_RX and USB_UART_TX are defined as HAL_PIN_NC, you will need to define them manually for log to work. See LOG_MAP_USB_UART macro definition for detailed explanation.

◆ application_task()

void application_task ( void )

◆ main()

int main ( void )

◆ measurement_init()

void measurement_init ( adc9_t * ctx,
adc9_rw_t * rw )

Variable Documentation

◆ adc_value

int32_t adc_value

◆ m_volts

float m_volts