CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug Reports on this forum. Send them to support@ccsinfo.com

PCA9685
Goto page 1, 2, 3, 4  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Sterngleiter



Joined: 07 Jan 2013
Posts: 90

View user's profile Send private message

PCA9685
PostPosted: Fri Oct 11, 2019 2:48 pm     Reply with quote

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
temtronic



Joined: 01 Jul 2010
Posts: 7992
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Oct 11, 2019 7:53 pm     Reply with quote

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
Sterngleiter



Joined: 07 Jan 2013
Posts: 90

View user's profile Send private message

PostPosted: Sat Oct 12, 2019 1:06 am     Reply with 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();
}
PCM programmer



Joined: 06 Sep 2003
Posts: 21371

View user's profile Send private message

PostPosted: Sat Oct 12, 2019 4:28 am     Reply with quote

This function turns the LEDs off. If you want them on, DON'T call it.
Sterngleiter



Joined: 07 Jan 2013
Posts: 90

View user's profile Send private message

PostPosted: Sat Oct 12, 2019 4:36 am     Reply with quote

i know. i will start it again.
Sterngleiter



Joined: 07 Jan 2013
Posts: 90

View user's profile Send private message

PostPosted: Sat Oct 12, 2019 4:42 am     Reply with quote

how must I turn on all again?
temtronic



Joined: 01 Jul 2010
Posts: 7992
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Oct 12, 2019 3:53 pm     Reply with quote

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
Sterngleiter



Joined: 07 Jan 2013
Posts: 90

View user's profile Send private message

PostPosted: Sat Oct 12, 2019 4:06 pm     Reply with quote

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%
temtronic



Joined: 01 Jul 2010
Posts: 7992
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Oct 12, 2019 4:49 pm     Reply with quote

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
Sterngleiter



Joined: 07 Jan 2013
Posts: 90

View user's profile Send private message

PostPosted: Sun Oct 13, 2019 3:57 am     Reply with quote

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.
temtronic



Joined: 01 Jul 2010
Posts: 7992
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Oct 13, 2019 4:31 am     Reply with quote

hmm, can you control ANY of the LEDS or are they all always, totally off ?
PCM programmer



Joined: 06 Sep 2003
Posts: 21371

View user's profile Send private message

PostPosted: Sun Oct 13, 2019 4:31 am     Reply with quote

Post a link to a schematic of your hardware.
Ttelmah



Joined: 11 Mar 2010
Posts: 16944

View user's profile Send private message

PostPosted: Sun Oct 13, 2019 4:51 am     Reply with quote

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.
Sterngleiter



Joined: 07 Jan 2013
Posts: 90

View user's profile Send private message

PostPosted: Sun Oct 13, 2019 5:21 am     Reply with quote

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.
Sterngleiter



Joined: 07 Jan 2013
Posts: 90

View user's profile Send private message

PostPosted: Sun Oct 13, 2019 5:30 am     Reply with quote

how do i add a picture here?
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2, 3, 4  Next
Page 1 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group