View previous topic :: View next topic |
Author |
Message |
Sterngleiter
Joined: 07 Jan 2013 Posts: 90
|
PCA9685 |
Posted: Fri Oct 11, 2019 2:48 pm |
|
|
I need help please. Someone wrote a library here that works very well. Unfortunately, I do not understand one thing: All_led_off and All_led_on. All LEDs are not working anymore.
https://www.ccsinfo.com/forum/viewtopic.php?t=47908 |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9174 Location: Greensville,Ontario
|
|
Posted: Fri Oct 11, 2019 7:53 pm |
|
|
Are you saying that NOTHING works ?
IF so, what changes did you make to the hardware or software ?
You should run a simple 'blink the LED' program to confirm the PIC, LEDs and wiring has not changed.
If that works, then load a previous version of the program that did work. It sounds like you changed something as it used to work.
Jay |
|
![](templates/subSilver/images/spacer.gif) |
Sterngleiter
Joined: 07 Jan 2013 Posts: 90
|
|
Posted: Sat Oct 12, 2019 1:06 am |
|
|
I can not turn it on when I start this procedure. that was meant
Code: | void PCA9685AllLedOff(int address)
{
i2c_start(); // Start
i2c_write(address); // select pca9685
i2c_write(0xfc); // All LED Off register
i2c_write(0b00000000); // data for ALL_LED_OFF_L
i2c_write(0b00010000); // data for ALL_LED_OFF_H
I2c_stop();
} |
|
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Oct 12, 2019 4:28 am |
|
|
This function turns the LEDs off. If you want them on, DON'T call it. |
|
![](templates/subSilver/images/spacer.gif) |
Sterngleiter
Joined: 07 Jan 2013 Posts: 90
|
|
Posted: Sat Oct 12, 2019 4:36 am |
|
|
i know. i will start it again. |
|
![](templates/subSilver/images/spacer.gif) |
Sterngleiter
Joined: 07 Jan 2013 Posts: 90
|
|
Posted: Sat Oct 12, 2019 4:42 am |
|
|
how must I turn on all again? |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9174 Location: Greensville,Ontario
|
|
Posted: Sat Oct 12, 2019 3:53 pm |
|
|
OK, this _might_ work, I don't have a chip to test though
Code: |
void PCA9685AllLedOn(int address)
{
i2c_start(); // Start
i2c_write(address); // select pca9685
i2c_write(0xfa); // All LED ON register low
i2c_write(0b00000000); // data sent to 0xfa
i2c_write(0b00010000); // data sent to 0xfb
i2c_stop(); // Stop
} |
I've copied from the 'driver' the allOff function and changed the registers as required.
I'm surprised the original programmer didn't make this function.
Please copy/past/compile/test and report back
good luck
Jay |
|
![](templates/subSilver/images/spacer.gif) |
Sterngleiter
Joined: 07 Jan 2013 Posts: 90
|
|
Posted: Sat Oct 12, 2019 4:06 pm |
|
|
I've already tried that. nothing happens. I also can not find anything in data sheet about it. For example, I would like to turn it on again after 100% |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9174 Location: Greensville,Ontario
|
|
Posted: Sat Oct 12, 2019 4:49 pm |
|
|
Table 8, page 25 of 52, shows the ALL-ON, ALL_OFF CONTROL registers and bits.
I wish I had a chip to test but after re-reading it , I _think_ that
i2c_write(0b11111111); // data sent to 0xfa
i2c_write(0b00011111); // data sent to 0xfb
may turn all LEDs on although it says bit 4 set ('1'), should turn all LEDs on.
Jay |
|
![](templates/subSilver/images/spacer.gif) |
Sterngleiter
Joined: 07 Jan 2013 Posts: 90
|
|
Posted: Sun Oct 13, 2019 3:57 am |
|
|
No, nothing. I tested that again. no result. I am with my latain at the end. There must be a way to turn everything on at the same time. |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9174 Location: Greensville,Ontario
|
|
Posted: Sun Oct 13, 2019 4:31 am |
|
|
hmm, can you control ANY of the LEDS or are they all always, totally off ? |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Oct 13, 2019 4:31 am |
|
|
Post a link to a schematic of your hardware. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19369
|
|
Posted: Sun Oct 13, 2019 4:51 am |
|
|
The first thing to do, is run the I2C bus scanner program (in the code
library), and verify the chip is responding on the addresses you think it
is on. If it doesn't, you have a hardware problem.
It should respond on the address you expect, and also on 0xE0, and
0x06 (though I think the scanner does not test the reserved addresses
below 0x10).
Once you have verified the chip is being seen correctly, then we can
talk 'code'. There seems to be some confusion, since you say:
Quote: |
I can not turn it on when I start this procedure. that was meant
Code: |
void PCA9685AllLedOff(int address)
{
i2c_start(); // Start
i2c_write(address); // select pca9685
i2c_write(0xfc); // All LED Off register
i2c_write(0b00000000); // data for ALL_LED_OFF_L
i2c_write(0b00010000); // data for ALL_LED_OFF_H
I2c_stop();
}
|
|
Which is an all off function, not all on.
Jay has posted the equivalent 'on' function. |
|
![](templates/subSilver/images/spacer.gif) |
Sterngleiter
Joined: 07 Jan 2013 Posts: 90
|
|
Posted: Sun Oct 13, 2019 5:21 am |
|
|
the library is running very well. the chip also responds to the address. I think it is not a hardware problem. I'm doing something wrong. |
|
![](templates/subSilver/images/spacer.gif) |
Sterngleiter
Joined: 07 Jan 2013 Posts: 90
|
|
Posted: Sun Oct 13, 2019 5:30 am |
|
|
how do i add a picture here? |
|
![](templates/subSilver/images/spacer.gif) |
|