How does it work?
Counter 2 Click is based on the S-35770, a 24-bit binary-up counter IC from ABLIC with an I2C interface that provides an accurate external event counting solution. This highly integrated device is designed to count externally input clock signals via the IN pin, making it ideal for applications such as industrial metering, instrumentation, amusement systems, and life cycle counters. The S-35770 monitors a rising edge (LOW to HIGH transition) on the IN pin to increment the counter value. It features a wide counting range from 0 up to 16,777,215 (0xFFFFFF), and once the maximum count is reached, the counter rolls over to 0 upon the next LOW to HIGH transition on the IN pin.

Communication with the host MCU is handled through a fast I2C-bus serial interface, supporting frequencies up to 1MHz, allowing read and write access to the counter’s internal registers. In addition to the standard I2C communication lines, the Click board™ uses an RST pin for externally resetting the counter. During I2C communication sequences, defined from the start to stop conditions, the IC temporarily halts edge detection on the IN pin to preserve count integrity. However, a single count-up operation may be triggered if the IN pin is LOW at the beginning and HIGH at the end of the I2C transaction.
This Click board™ is designed in a unique format supporting the newly introduced MIKROE feature called "Click Snap." Unlike the standardized version of Click boards, this feature allows the main sensor/IC/module area to become movable by breaking the PCB, opening up many new possibilities for implementation. Thanks to the Snap feature, the S-35770 can operate autonomously by accessing its signals directly on the pins marked 1-8. Additionally, the Snap part includes a specified and fixed screw hole position, enabling users to secure the Snap board in their desired location.
For clear visual indication of counter overflows, the board includes an LP (Loop) pin connected to a red LOOP LED, which lights up when the counter loops back to zero, providing immediate feedback to the user.
This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the VCC SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. Also, this Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used as a reference for further development.
Click Snap
Click Snap is an innovative feature of our standardized Click add-on boards, designed to bring greater flexibility and optimize your prototypes. By simply snapping the PCB along predefined lines, you can easily detach the main sensor/IC/module area, reducing the overall size, weight, and power consumption - ideal for the final phase of prototyping. For more details about Click Snap, visit the official page dedicated to this feature.
Specifications
Type |
Rotary encoder |
Applications |
Ideal for use in industrial metering, instrumentation, amusement equipment, and life-cycle tracking applications |
On-board modules |
S-35770 - 24-bit binary-up counter IC from ABLIC |
Key Features |
24-bit binary-up counter with a wide counting range, I2C communication, external clock pulse detection, reset capability, counter overflow indication, temporary counting pause during I2C communication to preserve data integrity, support for the Click Snap feature, and more |
Interface |
I2C |
Feature |
Click Snap,ClickID |
Compatibility |
mikroBUS™ |
Click board size |
M (42.9 x 25.4 mm) |
Input Voltage |
3.3V or 5V |
Pinout diagram
This table shows how the pinout on Counter 2 Click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Notes |
Pin |
 |
Pin |
Notes |
---|
|
NC |
1 |
AN |
PWM |
16 |
NC |
|
Reset |
RST |
2 |
RST |
INT |
15 |
LP |
Counter Loop Indicator |
ID COMM |
CS |
3 |
CS |
RX |
14 |
NC |
|
|
NC |
4 |
SCK |
TX |
13 |
NC |
|
|
NC |
5 |
MISO |
SCL |
12 |
SCL |
I2C Clock |
|
NC |
6 |
MOSI |
SDA |
11 |
SDA |
I2C Data |
Power Supply |
3.3V |
7 |
3.3V |
5V |
10 |
5V |
Power Supply |
Ground |
GND |
8 |
GND |
GND |
9 |
GND |
Ground |
Onboard settings and indicators
Label |
Name |
Default |
Description |
---|
LD1 |
PWR |
- |
Power LED Indicator |
LD2 |
LOOP |
- |
Counter Loop LED Indicator |
JP1 |
VCC SEL |
Left |
Power Voltage Level Selection 3V3/5V: Left position 3V3, Right position 5V |
Counter 2 Click electrical specifications
Description |
Min |
Typ |
Max |
Unit |
---|
Supply Voltage |
3.3 |
- |
5 |
V |
Counter Resolution |
- |
24 |
- |
bits |
Count Value |
- |
- |
16.777.215 |
- |
Software Support
Counter 2 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.
Example Description
This example demonstrates the use of the Counter 2 Click board. The application reads the current pulse count from the board and handles rollover events using the loop counter mechanism. It logs the total number of detected pulses, including those beyond the register's capacity.
Key Functions
counter2_cfg_setup
This function initializes Click configuration structure to initial values.
counter2_init
This function initializes all necessary pins and peripherals used for this Click board.
counter2_reset_counter
This function performs a hardware counter reset by toggling the RST pin and synchronizing with the LOOP pin.
counter2_get_counter
This function reads the current 24-bit counter value via I2C.
counter2_check_loop
This function checks if the LOOP pin state has changed since the last call.
Application Init
Initializes the logger and the Click board driver and resets the internal pulse counter.
Application Task
Periodically reads the counter value and checks for rollover (loop) events. Logs the total pulse count every second.
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.