How to use servo click library in pic16f1526 microcontroller to control the servo motor using PCA9685 module

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

Re: How to use servo click library in pic16f1526 microcontroller to control the servo motor using PCA9685 module

#16 Post by kumar123 » 01 Dec 2023 10:10

Hi,
I did whatever you suggest me but it was not working. I am sending my code.
I am not able to configure these variables _MIKROBUS1_GPIO is the SS pin and the _MIKROBUS1_I2C for the SDA and SCL pins of I2C.
SMC.rar
(281.12 KiB) Downloaded 9 times
Regards,
Himanshu Kumar

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

Re: How to Set SDA and SCL pins of i2c to control servo motor

#17 Post by kumar123 » 04 Dec 2023 09:53

Hi,
I am using servo click library to control the servo motor. I don't have development board so I don't want to use (T_SERVO_P)&_MIKROBUS1_I2C, (T_SERVO_P)&_MIKROBUS1_GPIO variables of this function servo_i2cDriverInit((T_SERVO_P)&_MIKROBUS1_GPIO,(T_SERVO_P)&_MIKROBUS1_I2C,0x40, 0x14 ). Is there any alternate way to configure SDA and SCL pins of PCA9685 module ? And without Dev. Board : EasyPIC PRO v7, can I control the servo motor?
I am using PIC16F1526 micro-controller. In my case PIC16F1526 micro-controller is a master and PCA9685 is a slave. I want to configure PCA9685 module using PIC16F1526 to control the servo motor. SDA, SCL pins of master is connected to SDA, SCL pins of slave respectively.

Regards,
Himanshu Kumar

User avatar
Tanja_Kovacevic
mikroElektronika team
Posts: 98
Joined: 09 Aug 2021 11:39

Re: How to use servo click library in pic16f1526 microcontroller to control the servo motor using PCA9685 module

#18 Post by Tanja_Kovacevic » 07 Dec 2023 12:05

Hi Kumar,

MikroBUS is just a socket for easier use of our click board.
You can use our library with example code and manually connect the click board with wires, using the same pins we mapped as mikroBUS.
Or even map other pins as Ivan has explained to you.

But the main issue is that you are using MCU that isn't supported on our boards with mikroBUS.
It doesn't have a DIP package form nor we have implemented it on any of our Development boards or MCU cards.

That's why you need to write your code for Servo click.

I am attaching the source code for that click,
so you can use the functions you need.

You can use this tutorial for writing the board definition for your board:
https://www.mikroe.com/blog/mikrosdk-bo ... tion-files

Maybe it is easier to try with Necto Studio
https://www.mikroe.com/necto
where you can choose a Generic board and write your board definition.
Here you can find the source code for it:
https://github.com/MikroElektronika/mik ... icks/servo
or you can download it in the compiler itself (Package Manager)


Anyway, we can't help you more than this with a custom project.

Kind regards,
Tanja
Attachments
Servo_Click-master-SW.zip
(521.18 KiB) Downloaded 10 times

Post Reply

Return to “mikroC PRO for PIC General”