adc6 2.0.0.0
main.c File Reference

ADC6 Click example. More...

#include "board.h"
#include "log.h"
#include "adc6.h"

Functions

void application_init (void)
 
void application_task (void)
 
int main (void)
 

Detailed Description

ADC6 Click example.

Description

This application collects data from the sensor, calculates the voltage to a digital value and then logs it.

The demo application is composed of two sections :

Application Init

Initializes driver and sets configuration which enables channel 0, puts AIN0 on positive analog input and AIN1 on negative analog input, enables internal reference voltage (approximately 2.65V (AVDD = 3.3V)), and also enables bipolar operation mode and puts device on full power mode. When the ADC is configured for unipolar operation, the output code is natural (straight) binary with a zero differential input voltage resulting in a code of 0x00000000, a midscale voltage resulting in a code of 0x00800000, and a full-scale input voltage resulting in a code of 0x00FFFFFF. When the ADC is configured for bipolar operation, the output code is offset binary with a negative full-scale voltage resulting in a code of 0x00000000, a zero differential input voltage resulting in a code of 0x00800000, and a positive full-scale input voltage resulting in a code of 0x00FFFFFF.

Application Task

Gets 24-bit converted data in single read mode and logs data on USB UART. Repeats operation every 500 ms.

Author
MikroE Team

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 )