clockgen6  2.0.0.0
Main Page

Clock Gen 6 click

Clock Gen 6 Click is a compact add-on board representing a digital oscillator solution. This board features the MIC1557, an IttyBitty CMOS RC oscillator designed to provide rail-to-rail pulses for precise time delay or frequency generation from Microchip Technology. The MIC1557 has a single threshold and trigger connection, internally connected, for astable (oscillator) operation only. It also has an enable/reset control signal routed to the RST pin of the mikroBUS™ socket, which controls the bias supply to the oscillator’s internal circuitry and optimizes power consumption used for oscillator power ON/OFF purposes. In addition, it provides the ability to select the desired frequency programmed via a digital potentiometer, the MAX5401.

click Product page


Click library

  • Author : Stefan Filipovic
  • Date : Dec 2021.
  • Type : SPI type

Software Support

We provide a library for the Clock Gen 6 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 from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Library Description

This library contains API for Clock Gen 6 Click driver.

Standard key functions :

Example key functions :

Example Description

This example demonstrates the use of Clock Gen 6 click board which acts as an astable oscillator.

The demo application is composed of two sections :

Application Init

Initializes the driver and performs the click default configuration which sets the digital potentiometer to max position and enables the clock output.

void application_init ( void )
{
log_cfg_t log_cfg;
clockgen6_cfg_t clockgen6_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
clockgen6_cfg_setup( &clockgen6_cfg );
CLOCKGEN6_MAP_MIKROBUS( clockgen6_cfg, MIKROBUS_1 );
if ( DIGITAL_OUT_UNSUPPORTED_PIN == clockgen6_init( &clockgen6, &clockgen6_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( CLOCKGEN6_ERROR == clockgen6_default_cfg ( &clockgen6 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}

Application Task

Changes the clock output frequency by changing the digital potentiometer position every second. The potentiometer position value will be displayed on the USB UART.

void application_task ( void )
{
{
if ( CLOCKGEN6_OK == clockgen6_set_digipot ( &clockgen6, pos ) )
{
log_printf( &logger, " DIGIPOT position: %u\r\n", pos );
Delay_ms ( 1000 );
pos -= 5;
}
}
}

The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Other Mikroe Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.ClockGen6

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. UART terminal is available in all MikroElektronika compilers.


CLOCKGEN6_OK
@ CLOCKGEN6_OK
Definition: clockgen6.h:151
CLOCKGEN6_MAP_MIKROBUS
#define CLOCKGEN6_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: clockgen6.h:100
clockgen6_enable_output
void clockgen6_enable_output(clockgen6_t *ctx)
Clock Gen 6 enable output function.
application_task
void application_task(void)
Definition: main.c:66
CLOCKGEN6_DIGIPOT_POSITION_MIN
#define CLOCKGEN6_DIGIPOT_POSITION_MIN
Definition: clockgen6.h:71
clockgen6_cfg_setup
void clockgen6_cfg_setup(clockgen6_cfg_t *cfg)
Clock Gen 6 configuration object setup function.
clockgen6_init
err_t clockgen6_init(clockgen6_t *ctx, clockgen6_cfg_t *cfg)
Clock Gen 6 initialization function.
clockgen6_default_cfg
err_t clockgen6_default_cfg(clockgen6_t *ctx)
Clock Gen 6 default configuration function.
CLOCKGEN6_ERROR
@ CLOCKGEN6_ERROR
Definition: clockgen6.h:152
clockgen6_t
Clock Gen 6 Click context object.
Definition: clockgen6.h:115
application_init
void application_init(void)
Definition: main.c:30
clockgen6_disable_output
void clockgen6_disable_output(clockgen6_t *ctx)
Clock Gen 6 disable output function.
clockgen6_set_digipot
err_t clockgen6_set_digipot(clockgen6_t *ctx, uint8_t position)
Clock Gen 6 set digipot function.
CLOCKGEN6_DIGIPOT_POSITION_MAX
#define CLOCKGEN6_DIGIPOT_POSITION_MAX
Clock Gen 6 digipot settings.
Definition: clockgen6.h:70
clockgen6_cfg_t
Clock Gen 6 Click configuration object.
Definition: clockgen6.h:130