counter 2.0.0.0
main.c File Reference

Counter Click example. More...

#include "board.h"
#include "log.h"
#include "counter.h"

Functions

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

Detailed Description

Counter Click example.

Description

This application measures the speed and the position of the DC motor shafts.

The demo application is composed of two sections :

Application Init

Initializes driver and configures the click board.

Application Task

Reads data from the CNTR register and calculates the speed of the motor in Rad/s. All data is being displayed on the USB UART terminal where you can track their changes. The CNTR is a software configurable 8, 16, 24 or 32-bit up/down counter which counts the up/down pulses resulting from the quadrature clocks applied at the A and B inputs, or alternatively, in non-quadrature mode, pulses applied at the A input.

NOTE

An appropriate motor with optical encoder needs to be connected to the click board.

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 )