counter
2.0.0.0
|
Counter click carries an LS7366R 32-bit quadrature counter. The top of the board has a pinout for interfacing with incremental encoders. The interface has ENCA and ENCB pins, along with ENCI, which is a programmable index.
We provide a library for the Counter Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Package can be downloaded/installed directly form compilers IDE(recommended way), or downloaded from our LibStock, or found on mikroE github account.
This library contains API for Counter Click driver.
void counter_cfg_setup ( counter_cfg_t *cfg );
COUNTER_RETVAL counter_init ( counter_t *ctx, counter_cfg_t *cfg );
void counter_default_cfg ( counter_t *ctx );
uint8_t counter_read_cntr ( counter_t *ctx );
uint8_t counter_read_str ( counter_t *ctx );
uint8_t counter_read_otr ( counter_t *ctx );
Measuring RPM and speed of DC motor shafts
The demo application is composed of two sections :
Initializes driver init and chip init
This application reads data from CNTR. 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.
The full application code, and ready to use projects can be installed directly form compilers IDE(recommneded) or found on LibStock page or mikroE GitHub accaunt.
Other mikroE Libraries used in the example:
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all Mikroelektronika compilers, or any other terminal application of your choice, can be used to read the message.