PWM click library is not working "PWM_P16.c" file not found

General discussion on mikroC PRO for PIC.
Post Reply
Author
Message
kumar123
Posts: 68
Joined: 17 Oct 2023 07:32

PWM click library is not working "PWM_P16.c" file not found

#1 Post by kumar123 » 18 Jan 2024 07:45

Hi,
I am working on PWM click libraries to control servo motor. I am using pic16f1526 microcontroller and PCA9685PW IC. The code I am using.

Code: Select all

#include "Click_PWM_types.h"
#include "Click_PWM_config.h"

void systemInit()
{
    mikrobus_gpioInit( _MIKROBUS1, _MIKROBUS_RST_PIN, _GPIO_OUTPUT );

    mikrobus_i2cInit( _MIKROBUS1, &_PWM_I2C_CFG[0] );

    mikrobus_logInit( _LOG_USBUART, 9600 );

    Delay_ms( 100 );
}

void applicationInit()
{
    pwm_i2cDriverInit( (T_PWM_P)&_MIKROBUS1_GPIO, (T_PWM_P)&_MIKROBUS1_I2C, PWM_I2C_ADDRESS );
    Delay_ms( 100 );
    pwm_outputEnable();
    pwm_devConfig( 1, 0, 0, 0, 1, 0 );
    pwm_setPreScale( 0x04 );
    pwm_devConfig( 1, 0, 0, 0, 0, 1 );
    pwm_outputConfig( 0x00, 1, 0, 0 );
    Delay_ms( 100 );
    mikrobus_logWrite( "--------------------------", _LOG_LINE );
    mikrobus_logWrite( " PWM  Click  ", _LOG_LINE );
    mikrobus_logWrite( "--------------------------", _LOG_LINE );
}

void applicationTask()
{
    uint16_t rawDc;
    uint8_t channId;
    uint8_t dutyCycle;
    channId = 0;
    mikrobus_logWrite( "Channel 0 false state  ", _LOG_LINE );
    pwm_channelState( channId, 0 );
    mikrobus_logWrite( "--------------------------", _LOG_LINE );
    Delay_ms( 2000 );
    
    mikrobus_logWrite( "Channel 0 set raw  ", _LOG_LINE );
    for ( rawDc = 0; rawDc < PWM_MAX_RESOLUTION; rawDc += 256 )
    {
        pwm_setChannelRaw( channId, 0, rawDc );
        mikrobus_logWrite( " >", _LOG_TEXT );
        Delay_ms( 500 );
    }
    mikrobus_logWrite( "", _LOG_LINE );
    mikrobus_logWrite( "--------------------------", _LOG_LINE );
    Delay_ms( 1000 );
    
    mikrobus_logWrite( "Channel 0 set  ", _LOG_LINE );
    for ( dutyCycle = 0; dutyCycle < 100; dutyCycle += 10 )
    {
        pwm_setChannel( channId, 0, dutyCycle );
        mikrobus_logWrite( " >", _LOG_TEXT );
        Delay_ms( 500 );
    }
    mikrobus_logWrite( "", _LOG_LINE );
    mikrobus_logWrite( "--------------------------", _LOG_LINE );
    Delay_ms( 1000 );
    
    mikrobus_logWrite( "All Channels raw set  ", _LOG_LINE );
    for ( rawDc = 0; rawDc < PWM_MAX_RESOLUTION; rawDc += 256 )
    {
        pwm_setAllRaw( rawDc );
        mikrobus_logWrite( " >", _LOG_TEXT );
        Delay_ms( 500 );
    }
    mikrobus_logWrite( "", _LOG_LINE );
    mikrobus_logWrite( "--------------------------", _LOG_LINE );
    Delay_ms( 1000 );
    
    mikrobus_logWrite( "All Channels set  ", _LOG_LINE );
    for ( dutyCycle = 0; dutyCycle < 100; dutyCycle += 10 )
    {
        pwm_setAll( dutyCycle );
        mikrobus_logWrite( " >", _LOG_TEXT );
        Delay_ms( 500 );
    }
    mikrobus_logWrite( "", _LOG_LINE );
    mikrobus_logWrite( "--------------------------", _LOG_LINE );
    Delay_ms( 1000 );
    
    mikrobus_logWrite( "All Channels false state  ", _LOG_LINE );
    pwm_allChannState( 0 );
    mikrobus_logWrite( "--------------------------", _LOG_LINE );
    Delay_ms( 2000 );
}

void main()
{
    systemInit();
    applicationInit();

    while (1)
    {
            applicationTask();
    }
}
When I tried to compile this code I got below error-
2024-01-18.png
2024-01-18.png (198.92 KiB) Viewed 299 times
Regards,
Himanshu Kumar

dehaplessdefeated@gmail.com
Posts: 1
Joined: 18 Jan 2024 10:58

Re: PWM click library is not working "PWM_P16.c" file not found

#2 Post by dehaplessdefeated@gmail.com » 18 Jan 2024 11:00

Hi,
Could you anyone help me for above query

Regards

User avatar
IvanJeremic
mikroElektronika team
Posts: 316
Joined: 05 Sep 2022 14:32

Re: PWM click library is not working "PWM_P16.c" file not found

#3 Post by IvanJeremic » 19 Jan 2024 11:45

Hi,

Can you tell me everything that you changed in the example code for the PWM click?

Regards,

Ivan.

kumar123
Posts: 68
Joined: 17 Oct 2023 07:32

Re: PWM click library is not working "PWM_P16.c" file not found

#4 Post by kumar123 » 19 Jan 2024 12:18

Hi,
I did not change any thing in the given code, I just changed two things Device name PIC16F1526 and MCU clock frequency 10MHz.
Device I am using PIC16F1526 and PCA9685 IC for controlling servo motor.

Regards,
Kumar

User avatar
IvanJeremic
mikroElektronika team
Posts: 316
Joined: 05 Sep 2022 14:32

Re: PWM click library is not working "PWM_P16.c" file not found

#5 Post by IvanJeremic » 23 Jan 2024 09:37

Hi,

Could you send me your entire folder project?

I can't seem to reproduce this issue at all.

Regards,

Ivan.

kumar123
Posts: 68
Joined: 17 Oct 2023 07:32

Re: PWM click library is not working "PWM_P16.c" file not found

#6 Post by kumar123 » 23 Jan 2024 13:55

Hi,
I am attaching my code. The micro- controller I am using pic18f67k40 and PCA9685 IC to control the servo motor.
I am not using any development board.
The device I am using only pic18f67k40 and PCA9685IC.
PIC.zip
(19.04 KiB) Downloaded 15 times
Regards,
Kumar

Post Reply

Return to “mikroC PRO for PIC General”