pressure12 2.2.0
pressure12


Pressure 12 Click

Pressure 12 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.


Click Library

  • Author : Luka Filipovic
  • Date : Nov 2019.
  • Type : ADC type

Software Support

Example Description

Reads ADC value, convert ADC data to Voltage[ mV ] and pressure [ mBar ].

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.Pressure12

Example Key Functions

Application Init

Initializes ADC and LOG for logging data.

void application_init ( void )
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
// Click initialization.
PRESSURE12_MAP_MIKROBUS( cfg, MIKROBUS_1 );
if ( pressure12_init( &pressure12, &cfg ) == ADC_ERROR )
{
log_info( &logger, "---- Application Init Error ----" );
log_info( &logger, "---- Please, run program again ----" );
for ( ; ; );
}
log_info( &logger, "---- Application Init Done ----\r\n" );
pressure_val = 0;
voltage_val = 0;
}
#define PRESSURE12_MAP_MIKROBUS(cfg, mikrobus)
Definition pressure12.h:65
void application_init(void)
Definition main.c:40

Application Task

Reads ADC value, convert ADC data to Voltage[ mV ] on the AN pin and convert to Pressure data in mBar. All data logs to the USBUART each second.

void application_task ( void )
{
if ( pressure12_read_pin_voltage( &pressure12, &voltage_val ) != ADC_ERROR )
{
log_printf( &logger, " Voltage [V] : %.2f\r\n", voltage_val );
}
if ( pressure12_get_pressure( &pressure12, &pressure_val ) != ADC_ERROR )
{
log_printf( &logger, " Pressure [mBar] : %u\r\n", pressure_val );
}
log_printf( &logger, "-----------------------------\r\n" );
Delay_ms ( 1000 );
}
err_t pressure12_read_pin_voltage(pressure12_t *ctx, float *data_out)
Generic function for read voltage.
void application_task(void)
Definition main.c:75

Note

Output is proportional to the difference between applied pressure and atmospheric (ambient) pressure.

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
  • UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.

Additional Notes and Information

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.