We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
Rating:
Author: MIKROE
Last Updated: 2021-10-04
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Clock generator
Downloaded: 5040 times
Not followed.
License: MIT license
Waveform Click is a precise sine/triangle/square waveform generator, capable of reproducing frequencies up to 12MHz.
Do you want to subscribe in order to receive notifications regarding "Waveform click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Waveform click" changes.
Do you want to report abuse regarding "Waveform click".
Library Description
Library contains generic functions for controlling the waveform and frequency
output of the click board.
Key functions:
void waveform_sineOutput(uint32_t f)
- Function for setting the sine wave output.void waveform_triangleOutput(uint32_t f)
- Function for setting the triangle wave output.void waveform_squareOutput(uint32_t f)
- Function for setting the square wave output.Examples description
The application is composed of the three sections :
void applicationTask()
{
char rxDat;
uint32_t freqTmp;
if(UART_Rdy_Ptr())
{
rxDat = UART_Rd_Ptr();
mikrobus_logWrite(&rxDat,_LOG_BYTE);
}
if(rxDat>0)
{
switch(rxDat)
{
case waveform_cmd[0]: {
waveform_digipotInc();
rxDat = 0;
break;
}
case waveform_cmd[1]: {
waveform_digipotDec();
rxDat = 0;
break;
}
case waveform_cmd[2]: {
freq += 1;
freqTmp = freq << 14;
waveform_sineOutput(freqTmp);
rxDat = 0;
break;
}
case waveform_cmd[3]: {
freq -= 1;
freqTmp = freq << 14;
waveform_sineOutput(freqTmp);
rxDat = 0;
break;
}
case waveform_cmd[4]: {
freq += 1;
freqTmp = freq << 14;
waveform_triangleOutput(freqTmp);
rxDat = 0;
break;
}
case waveform_cmd[5]: {
freq -= 1;
freqTmp = freq << 14;
waveform_triangleOutput(freqTmp);
rxDat = 0;
break;
}
case waveform_cmd[6]: {
freq += 1;
freqTmp = freq << 14;
waveform_squareOutput(freqTmp);
rxDat = 0;
break;
}
case waveform_cmd[7]: {
freq -= 1;
freqTmp = freq << 14;
waveform_squareOutput(freqTmp);
rxDat = 0;
break;
}
default : {
break;
}
}
}
rxDat = 0;
}
Additional Functions :
uint32_t waveform_aproxFreqcalculation(float freqency)
- This function is used to calculate the aproximate value that will be written to the frequency set register.Other mikroE Libraries used in the example:
SPI
UART
Conversions
C_Sring
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.