dtmfgenerator 2.0.0.0
Main Page

DTMF Generator click

‍DTMF Generator Click is a compact add-on board that generates DTMF (Dual-Tone Multi-Frequency) signals designed for MCU interfaces. This board features the HT9200A, a dual-tone multi-frequency decoder mostly used in mobile communications systems from Holtek Semiconductor Inc.

click Product page


Click library

  • Author : Stefan Ilic
  • Date : Jul 2021.
  • Type : GPIO type

Software Support

We provide a library for the DTMFGenerator 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 DTMFGenerator Click driver.

Standard key functions :

Example key functions :

Example Description

‍This is an example which demonstrates the use of DTMF Generator Click board.

The demo application is composed of two sections :

Application Init

‍Initialization driver enables - GPIO, run the power-on sequence, also write log.

void application_init ( void ) {
log_cfg_t log_cfg;
dtmfgenerator_cfg_t dtmfgenerator_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
dtmfgenerator_cfg_setup( &dtmfgenerator_cfg );
DTMFGENERATOR_MAP_MIKROBUS( dtmfgenerator_cfg, MIKROBUS_1 );
if ( DIGITAL_OUT_UNSUPPORTED_PIN == dtmfgenerator_init( &dtmfgenerator, &dtmfgenerator_cfg ) ) {
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
log_printf( &logger, " Powering on device \r\n" );
log_printf( &logger, "--------------------\r\n" );
dtmfgenerator_power_on( &dtmfgenerator );
Delay_ms ( 1000 );
log_info( &logger, " Application Task " );
}
#define DTMFGENERATOR_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition dtmfgenerator.h:107
void application_init(void)
Definition main.c:34

Application Task

‍DTMF Generator click board DTMF generator transmits the signal for generating tone for digits : "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "*" and "#". All data logs write on USB uart changes.

void application_task ( void ) {
log_printf( &logger, " TONE '0' \r\n");
log_printf( &logger, "---------------\r\n" );
dtmfgenerator_transmit_out_tone( &dtmfgenerator, DTMFGENERATOR_OUT_TONE_0, signal_duration );
dtmfgenerator_transmit_out_tone( &dtmfgenerator, DTMFGENERATOR_OUT_TONE_STOP, signal_duration );
log_printf( &logger, " TONE '1' \r\n");
log_printf( &logger, "---------------\r\n" );
dtmfgenerator_transmit_out_tone( &dtmfgenerator, DTMFGENERATOR_OUT_TONE_1, signal_duration );
dtmfgenerator_transmit_out_tone( &dtmfgenerator, DTMFGENERATOR_OUT_TONE_STOP, signal_duration );
log_printf( &logger, " TONE '2' \r\n");
log_printf( &logger, "---------------\r\n" );
dtmfgenerator_transmit_out_tone( &dtmfgenerator, DTMFGENERATOR_OUT_TONE_2, signal_duration );
dtmfgenerator_transmit_out_tone( &dtmfgenerator, DTMFGENERATOR_OUT_TONE_STOP, signal_duration );
log_printf( &logger, " TONE '3' \r\n");
log_printf( &logger, "---------------\r\n" );
dtmfgenerator_transmit_out_tone( &dtmfgenerator, DTMFGENERATOR_OUT_TONE_3, signal_duration );
dtmfgenerator_transmit_out_tone( &dtmfgenerator, DTMFGENERATOR_OUT_TONE_STOP, signal_duration );
log_printf( &logger, " TONE '4' \r\n");
log_printf( &logger, "---------------\r\n" );
dtmfgenerator_transmit_out_tone( &dtmfgenerator, DTMFGENERATOR_OUT_TONE_4, signal_duration );
dtmfgenerator_transmit_out_tone( &dtmfgenerator, DTMFGENERATOR_OUT_TONE_STOP, signal_duration );
log_printf( &logger, " TONE '5' \r\n");
log_printf( &logger, "---------------\r\n" );
dtmfgenerator_transmit_out_tone( &dtmfgenerator, DTMFGENERATOR_OUT_TONE_5, signal_duration );
dtmfgenerator_transmit_out_tone( &dtmfgenerator, DTMFGENERATOR_OUT_TONE_STOP, signal_duration );
log_printf( &logger, " TONE '6' \r\n");
log_printf( &logger, "---------------\r\n" );
dtmfgenerator_transmit_out_tone( &dtmfgenerator, DTMFGENERATOR_OUT_TONE_6, signal_duration );
dtmfgenerator_transmit_out_tone( &dtmfgenerator, DTMFGENERATOR_OUT_TONE_STOP, signal_duration );
log_printf( &logger, " TONE '7' \r\n");
log_printf( &logger, "---------------\r\n" );
dtmfgenerator_transmit_out_tone( &dtmfgenerator, DTMFGENERATOR_OUT_TONE_7, signal_duration );
dtmfgenerator_transmit_out_tone( &dtmfgenerator, DTMFGENERATOR_OUT_TONE_STOP, signal_duration );
log_printf( &logger, " TONE '8' \r\n");
log_printf( &logger, "---------------\r\n" );
dtmfgenerator_transmit_out_tone( &dtmfgenerator, DTMFGENERATOR_OUT_TONE_8, signal_duration );
dtmfgenerator_transmit_out_tone( &dtmfgenerator, DTMFGENERATOR_OUT_TONE_STOP, signal_duration );
log_printf( &logger, " TONE '9' \r\n");
log_printf( &logger, "---------------\r\n" );
dtmfgenerator_transmit_out_tone( &dtmfgenerator, DTMFGENERATOR_OUT_TONE_9, signal_duration );
dtmfgenerator_transmit_out_tone( &dtmfgenerator, DTMFGENERATOR_OUT_TONE_STOP, signal_duration );
log_printf( &logger, " TONE 'A' \r\n");
log_printf( &logger, "---------------\r\n" );
dtmfgenerator_transmit_out_tone( &dtmfgenerator, DTMFGENERATOR_OUT_TONE_A, signal_duration );
dtmfgenerator_transmit_out_tone( &dtmfgenerator, DTMFGENERATOR_OUT_TONE_STOP, signal_duration );
log_printf( &logger, " TONE 'B' \r\n");
log_printf( &logger, "---------------\r\n" );
dtmfgenerator_transmit_out_tone( &dtmfgenerator, DTMFGENERATOR_OUT_TONE_B, signal_duration );
dtmfgenerator_transmit_out_tone( &dtmfgenerator, DTMFGENERATOR_OUT_TONE_STOP, signal_duration );
log_printf( &logger, " TONE 'C' \r\n");
log_printf( &logger, "---------------\r\n" );
dtmfgenerator_transmit_out_tone( &dtmfgenerator, DTMFGENERATOR_OUT_TONE_C, signal_duration );
dtmfgenerator_transmit_out_tone( &dtmfgenerator, DTMFGENERATOR_OUT_TONE_STOP, signal_duration );
log_printf( &logger, " TONE 'D' \r\n");
log_printf( &logger, "---------------\r\n" );
dtmfgenerator_transmit_out_tone( &dtmfgenerator, DTMFGENERATOR_OUT_TONE_D, signal_duration );
dtmfgenerator_transmit_out_tone( &dtmfgenerator, DTMFGENERATOR_OUT_TONE_STOP, signal_duration );
log_printf( &logger, " TONE '*' \r\n");
log_printf( &logger, "---------------\r\n" );
dtmfgenerator_transmit_out_tone( &dtmfgenerator, DTMFGENERATOR_OUT_TONE_STOP, signal_duration );
log_printf( &logger, " TONE '#' \r\n");
log_printf( &logger, "---------------\r\n" );
dtmfgenerator_transmit_out_tone( &dtmfgenerator, DTMFGENERATOR_OUT_TONE_HASH, signal_duration );
dtmfgenerator_transmit_out_tone( &dtmfgenerator, DTMFGENERATOR_OUT_TONE_STOP, signal_duration );
}
#define DTMFGENERATOR_OUT_TONE_8
Definition dtmfgenerator.h:79
#define DTMFGENERATOR_OUT_TONE_2
Definition dtmfgenerator.h:73
#define DTMFGENERATOR_OUT_TONE_A
Definition dtmfgenerator.h:81
#define DTMFGENERATOR_OUT_TONE_9
Definition dtmfgenerator.h:80
#define DTMFGENERATOR_OUT_TONE_6
Definition dtmfgenerator.h:77
#define DTMFGENERATOR_OUT_TONE_7
Definition dtmfgenerator.h:78
#define DTMFGENERATOR_OUT_TONE_4
Definition dtmfgenerator.h:75
#define DTMFGENERATOR_OUT_TONE_HASH
Definition dtmfgenerator.h:86
#define DTMFGENERATOR_OUT_TONE_B
Definition dtmfgenerator.h:82
#define DTMFGENERATOR_OUT_TONE_0
DTMF Generator description setting.
Definition dtmfgenerator.h:71
#define DTMFGENERATOR_OUT_TONE_D
Definition dtmfgenerator.h:84
#define DTMFGENERATOR_OUT_TONE_STOP
Definition dtmfgenerator.h:87
#define DTMFGENERATOR_OUT_TONE_ASTERISK
Definition dtmfgenerator.h:85
#define DTMFGENERATOR_OUT_TONE_5
Definition dtmfgenerator.h:76
#define DTMFGENERATOR_OUT_TONE_1
Definition dtmfgenerator.h:72
#define DTMFGENERATOR_OUT_TONE_C
Definition dtmfgenerator.h:83
#define DTMFGENERATOR_OUT_TONE_3
Definition dtmfgenerator.h:74
void application_task(void)
Definition main.c:67

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.DTMFGenerator

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.