indexcounter 2.2.0
indexcounter


Index Counter Click

Index Counter 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 : MikroE Team
  • Date : May 2020.
  • Type : GPIO type

Software Support

Example Description

This application enables usage of Index counter Click board which can be used to measure rotational speed.

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.IndexCounter

Example Key Functions

Application Init

Initilaziation of GPIO and write log.

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.
INDEXCOUNTER_MAP_MIKROBUS( cfg, MIKROBUS_1 );
indexcounter_init( &indexcounter, &cfg );
}
#define INDEXCOUNTER_MAP_MIKROBUS(cfg, mikrobus)
Definition indexcounter.h:65
void application_init(void)
Definition main.c:80

Application Task

This is an example which demonstrates the use of the Index Counter Click board. This example shows the direction of movement, Rotations Per Minute ( RPM or speed ) of the three pairs of rotating poles positioned in the sensor operating range. Results are being sent to the Usart Terminal where you can track their changes.

void application_task ( void )
{
// Task implementation.
speed_state = indexcounter_get_speed( &indexcounter );
dir_state = indexcounter_get_dir( &indexcounter );
{
}
if ( ( !enable_speed ) && ( !speed_state ) )
{
}
Delay_1ms();
}
#define INDEXCOUNTER_SPEED_DISABLE
Definition indexcounter.h:84
#define INDEXCOUNTER_SPEED_ENABLE
Definition indexcounter.h:83
#define INDEXCOUNTER_ONE_MIN_CONV_MS
Definition indexcounter.h:86
uint8_t dir_state
Definition main.c:39
void application_task(void)
Definition main.c:105
float speed_rpm
Definition main.c:46
uint8_t enable_speed
Definition main.c:41
void log_display(float rpm_val)
Definition main.c:50
uint8_t speed_state
Definition main.c:40
uint32_t start_timer
Definition main.c:45
uint8_t n_pole_pairs
Definition main.c:42
uint32_t time_cnt
Definition main.c:43
uint32_t pulse_ms
Definition main.c:44

Note

Additional Functions :

  • void log_display ( float rpm_val ) - The function displays all results and a float value with a comma with two decimal places.

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.