How to pass our selected SDA, and SCL pins in instead of pre-define in this "servo_i2cDriverInit(, ,0x40, 0x14 )"

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

How to pass our selected SDA, and SCL pins in instead of pre-define in this "servo_i2cDriverInit(, ,0x40, 0x14 )"

#1 Post by kumar123 » 15 Nov 2023 06:12

Hi,
I want use servo click library to control the servo motor using PIC16F1526 micro-controller and PCA9685 module. But in servo click library they are pre-define mikrobus and I2C for specific micro-controller given in below code

Code: Select all

void servo_i2cDriverInit(T_SERVO_P gpioObj, T_SERVO_P i2cObj, uint8_t slave_of_PCA9685, uint8_t slave_of_LTC2497){
    _slaveAddress_of_PCA9685 = slave_of_PCA9685;
    _slaveAddress_of_LTC2497 = slave_of_LTC2497;
    hal_i2cMap( (T_HAL_P)i2cObj );
    hal_gpioMap( (T_HAL_P)gpioObj );

    hal_gpio_csSet(0);
}
In this code i don't want to use
T_SERVO_P gpioObj, T_SERVO_P i2cObj
. I only want to use own specific pin like RC3 , RC4 of micro-controller is connected to SCL , SDA of PCA965 respectively.

Thank you

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

Re: How to pass our selected SDA, and SCL pins in instead of pre-define in this "servo_i2cDriverInit(, ,0x40, 0x14 )"

#2 Post by IvanJeremic » 15 Nov 2023 08:37

Hi,

Since we are already talking about this on this post (viewtopic.php?f=88&t=80294), lets continue the conversation there.

Regards,

Ivan.

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

Re: How to use own pins instead of mikrobus1_i2c

#3 Post by kumar123 » 29 Nov 2023 08:01

Hi,
I am using this piece of code for controlling servo motor using pca9685 module
code2.png
code2.png (210.2 KiB) Viewed 186 times
.
code1.png
code1.png (212.77 KiB) Viewed 186 times
.
The above code is compiling and not giving any error but my servo motor is not working. I am using pic16f1526 micor-controller, PCA9685 module to control servo motor.
what should be the value instead of _MIKROBUS1_I2C, _MIKROBUS1_GPIO, And what should I pass here instead of these two variable?
servo_i2cDriverInit((T_SERVO_P)&_MIKROBUS1_GPIO,(T_SERVO_P)&_MIKROBUS1_I2C,0x40, 0x14 );
Regards,
Himanshu Kumar

Post Reply

Return to “mikroC PRO for PIC General”