Experience a breakthrough in signal generation – our voltage-to-frequency solution transforms voltage inputs into finely tuned frequency signals, granting you unprecedented control over your waveform generation
A
A
Hardware Overview
How does it work?
V to Hz Click is based on the TC9400, a voltage-to-frequency and frequency-to-voltage converter from Microchip. It accepts voltage at its input and generates a pulse train, with a frequency linearly proportional to the input voltage. The pulse train is present on two output pins: the full frequency pin outputs signal with the pulse rate linear to the input voltage, while the half frequency pin outputs signal with the pulse rate equal to the half of the full frequency pin pulse rate. When V to Hz click is operated for the first time, it needs to be calibrated. The click is equipped with two variable resistors for gain and offset fine tuning. There are several steps that should be followed when calibrating. An input signal of 10mV should be applied to the input. The offset should be adjusted so that a 10Hz signal appears on the output. An input signal of 5V should be applied to the input. The gain should be adjusted so that 10kHz signal
appears on the output. V to Hz Click is equipped with the input voltage terminal (VOLT IN), which is used to connect the control voltage up to 5V. Besides having control voltage input on this terminal, it is possible to select the voltage generated by the MCU as the control voltage input, too. INPUT SEL switch can be set so that the PWM pin from the mikroBUS™ is used as the control voltage input. The PWM signal generated by the MCU is filtered out by the onboard low pass filter so that the control voltage remains constant. For this reason, PWM signal frequency from the MCU should be at least 40 kHz. The output terminal (FREQ OUT) is used to output the generated frequency. There are two outputs routed to this two-pole screw terminal: the first output is full frequency output (f), while the second output is the half of the generated frequency (f/2). The frequency output is also
routed to the INT pin of the mikroBUS™. To select between the half and the full frequency output routed to the INT pin, the FREQ SEL SMD jumper needs to be switched to the correct position. Both of the half frequency and the full frequency outputs are pulled HIGH (3.3V) with an onboard resistor, which means that the output generated signal amplitude will be 3.3V. To provide 12V for the TC9400, V to Hz click employs a boost converter, built around the MIC2606, a boost regulator from Microchip, which works at 2MHz. This IC provides 12V for supplying the TC9400 out of 5V routed from the mikroBUS™ socket. EN pin of the boost regulator is routed to the mikroBUS™ CS pin and it is used to enable power output from the boost regulator, effectively enabling the TC9400 itself. EN pin is pulled to a HIGH logic level (3.3V) by the onboard resistor.
Features overview
Development board
PIC32MZ Clicker is a compact starter development board that brings the flexibility of add-on Click boards™ to your favorite microcontroller, making it a perfect starter kit for implementing your ideas. It comes with an onboard 32-bit PIC32MZ microcontroller with FPU from Microchip, a USB connector, LED indicators, buttons, a mikroProg connector, and a header for interfacing with external electronics. Thanks to its compact design with clear and easy-recognizable silkscreen markings, it provides a fluid and immersive working experience, allowing access anywhere and under
any circumstances. Each part of the PIC32MZ Clicker development kit contains the components necessary for the most efficient operation of the same board. In addition to the possibility of choosing the PIC32MZ Clicker programming method, using USB HID mikroBootloader, or through an external mikroProg connector for PIC, dsPIC, or PIC32 programmer, the Clicker board also includes a clean and regulated power supply module for the development kit. The USB Micro-B connection can provide up to 500mA of current, which is more than enough to operate all onboard
and additional modules. All communication methods that mikroBUS™ itself supports are on this board, including the well-established mikroBUS™ socket, reset button, and several buttons and LED indicators. PIC32MZ Clicker is an integral part of the Mikroe ecosystem, allowing you to create a new application in minutes. Natively supported by Mikroe software tools, it covers many aspects of prototyping thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.
Microcontroller Overview
MCU Card / MCU

Architecture
PIC32
MCU Memory (KB)
1024
Silicon Vendor
Microchip
Pin count
64
RAM (Bytes)
524288
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Click board™ Schematic

Step by step
Project assembly
Track your results in real time
Application Output
1. Application Output - In Debug mode, the 'Application Output' window enables real-time data monitoring, offering direct insight into execution results. Ensure proper data display by configuring the environment correctly using the provided tutorial.

2. UART Terminal - Use the UART Terminal to monitor data transmission via a USB to UART converter, allowing direct communication between the Click board™ and your development system. Configure the baud rate and other serial settings according to your project's requirements to ensure proper functionality. For step-by-step setup instructions, refer to the provided tutorial.

3. Plot Output - The Plot feature offers a powerful way to visualize real-time sensor data, enabling trend analysis, debugging, and comparison of multiple data points. To set it up correctly, follow the provided tutorial, which includes a step-by-step example of using the Plot feature to display Click board™ readings. To use the Plot feature in your code, use the function: plot(*insert_graph_name*, variable_name);. This is a general format, and it is up to the user to replace 'insert_graph_name' with the actual graph name and 'variable_name' with the parameter to be displayed.

Software Support
Library Description
This library contains API for V To Hz Click driver.
Key functions:
vtohz_set_duty_cycle
- Generic sets PWM duty cyclevtohz_pwm_stop
- Stop PWM modulevtohz_pwm_start
- Start PWM module.
Open Source
Code example
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.
/*!
* \file
* \brief VtoHz Click example
*
* # Description
* This application converts an analog voltage input signal into a pulse wave signal of a certain frequency.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes driver and enables the click board.
*
* ## Application Task
* Alternates between different output frequencies.
*
* ## Additional functions
* - set_output_frequency - Changing the output frequency by setting the PWM duty cycle to desired value.
*
* @note Output frequency may vary depending on the offset and gain potentiometers on board the click.
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "vtohz.h"
// ------------------------------------------------------------------ VARIABLES
static vtohz_t vtohz;
static log_t logger;
static float duty_cycle = 0.5;
// ------------------------------------------------------- ADDITIONAL FUNCTIONS
uint16_t pwm_period;
static uint8_t set_output_frequency ( float frequency )
{
float duty_cycle;
if ( frequency > 10000 )
{
return -1;
}
duty_cycle = frequency;
duty_cycle /= 10000;
vtohz_set_duty_cycle( &vtohz, duty_cycle );
vtohz_pwm_start( &vtohz );
return 0;
}
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
vtohz_cfg_t cfg;
/**
* 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 @b LOG_MAP_USB_UART macro definition for detailed explanation.
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
// Click initialization.
vtohz_cfg_setup( &cfg );
VTOHZ_MAP_MIKROBUS( cfg, MIKROBUS_1 );
vtohz_init( &vtohz, &cfg );
vtohz_enable ( &vtohz );
}
void application_task ( void )
{
set_output_frequency( 1000 ); //1000 Hz output
log_printf( &logger, "Output frequency: \t 1000 Hz\r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
set_output_frequency( 2000 ); //2000 Hz output
log_printf( &logger, "Output frequency: \t 2000 Hz\r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
set_output_frequency( 5000 ); //5000 Hz output
log_printf( &logger, "Output frequency: \t 5000 Hz\r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
set_output_frequency( 10000 ); //10000 Hz output
log_printf( &logger, "Output frequency: \t 10000 Hz\r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
int main ( void )
{
/* Do not remove this line or clock might not be set correctly. */
#ifdef PREINIT_SUPPORTED
preinit();
#endif
application_init( );
for ( ; ; )
{
application_task( );
}
return 0;
}
// ------------------------------------------------------------------------ END