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: 2020-04-06
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Measurements
Downloaded: 2983 times
Not followed.
License: MIT license
AN to PWM Click is a device that converts the value of the input analog signal with virtually any wave shape to a fixed frequency PWM voltage output, with a duty cycle proportional to the input voltage
Do you want to subscribe in order to receive notifications regarding "Analog To PWM click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Analog To PWM click" changes.
Do you want to report abuse regarding "Analog To PWM click".
Library Description
The library contains a interrupt pin state function.
Key functions:
uint8_t antopwm_get_int_state( )
- Gets interrupt pin stateExamples description
The application is composed of three sections :
void application_task ( )
{
uint8_t drdy;
char rsp_data;
drdy = UART_Rdy_Ptr( );
if ( drdy != 0 )
{
rsp_data = UART_Rd_Ptr( );
switch ( rsp_data )
{
case '+' :
{
// Reset flags
period_flag = 0;
idle_high_cnt = 0;
idle_low_cnt = 0;
period_cnt = 0;
while ( period_flag != 1 );
idle_high_cnt /= 10;
idle_low_cnt /= 10;
if ( ( idle_high_cnt != 0 ) && ( idle_high_cnt != 0 ) )
{
tmp_value = calc_percentage( idle_high_cnt );
FloatToStr( tmp_value, demo_text );
mikrobus_logWrite( "> Idle [HIGH]: ~ ", _LOG_TEXT );
mikrobus_logWrite( demo_text, _LOG_TEXT );
mikrobus_logWrite( " %", _LOG_LINE );
tmp_value = calc_percentage( idle_low_cnt );
FloatToStr( tmp_value, demo_text );
mikrobus_logWrite( "> Idle [LOW]: ~ ", _LOG_TEXT );
mikrobus_logWrite( demo_text, _LOG_TEXT );
mikrobus_logWrite( " %", _LOG_LINE );
tmp_value = calc_voltage( idle_high_cnt );
FloatToStr( tmp_value , demo_text );
mikrobus_logWrite( "> Voltage: ~ ", _LOG_TEXT );
mikrobus_logWrite( demo_text, _LOG_TEXT );
mikrobus_logWrite( " mV", _LOG_LINE );
mikrobus_logWrite( "--------------------------------", _LOG_LINE );
}
mikrobus_logWrite( "--- Please, enter the command [ + ].", _LOG_LINE );
break;
}
}
}
}
Additional Functions :
Other mikroE Libraries used in the example:
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.