PCA9685: problem in setting ON & OFF time

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PCA9685: problem in setting ON & OFF time

838 Views
brunoelectronic
Contributor I

Hi,

I am using PCA9685 servo controller board to run 3 servo motors from PIC Microcontroller PIC16F1938. I can able run the servo but problem in timing. I am confused on setting ON time & OFF time. For example, pca_write(servo number, on time, off time). pca_write(0, 409, 1648) should run the servo less than pca_write(0, 409, 2235).

On time1: 1648 - 409 = 1239

On time2: 2235 - 409 = 1826

But, in practical, the former on time of the Servo is greater than the latter. Why? Am i missing anything?

Function:

pca_write (unsigned int ServoN, unsigned long on_count, unsigned long off_count) {

I2C_Start();

I2C_Write (pca_address);

I2C_Write ((ServoN * 4) + 6); // LEDn reg

I2C_Write(on_count & 0xFF); // 8 LSB bits

I2C_Write((on_count & 0xF00 >> 8); // 4 MSB bits

I2C_Write(off_count & 0xFF); // 8 LSB bits

I2C_Write((off_count & 0xF00) >> 8); // 4 MSB bits

I2C_Stop();

Any help?

Thank you all.

Labels (1)
0 Kudos
1 Reply

730 Views
brunoelectronic
Contributor I

Is this forum active?!!

0 Kudos